Donation Manager [Paid] [Deleted]

Hi again,

The new navigationTabs doesn't seem to be working properly for me. It ignores whatever position I set it to, home, middle, end, doesn't matter what it is, the nav tab position won't change. It is set to 'end', which for my setup is AFTER the Members link but before Help, but the Donate tab is even being placed in front of the Wiki tab which has a position of 'middle':

20120302021437162.jpeg


Any idea why this might be happening? Doesn't make sense that it's getting placed in front of a navtab whose position is 'middle' (wiki) when Donate's position is set to 'end' :confused:
 
Are you changing the listener? You can try changing the order of execution but listeners.
 
Are you changing the listener? You can try changing the order of execution but listeners.
I was messing with NavigationTabs.php - but I noticed the new one is set to 'end' by default (so I've left it alone), prior to this it was 'middle', which I had manually changed to 'end' to get it to display after my Members tab but before the Help tab. Now it's already set to 'end', but it's showing up in that odd spot, and if I change it to middle, or home, it makes no difference, it's as if it's glued there.

The line I'm changing in testing is: 'position' => 'end',

PHP:
<?php
 
class Merc_DonationManager_Listener_NavigationTabs extends XenPlus_Listener_NavigationTabs
{
    public function execute(array &$extraTabs, $selectedTabId)
    {
        $visitor = XenForo_Visitor::getInstance();
 
        if ($visitor->hasPermission('donation', 'viewNav'))
            $extraTabs['donations'] = array(
                'title' => new XenForo_Phrase('merc_donate'),
                'href' => XenForo_Link::buildPublicLink('donations'),
                'position' => 'end',
                'linksTemplate' => 'merc_donation_navigation_tab',
                'canViewDonations' => $visitor->hasPermission('donation', 'viewDonations'),
                'canViewDonors' => $visitor->hasPermission('donation', 'viewDonors'),
            );
    }
}
 
There is 2 lots of files. Due to a refactor you will have 2 sets and I will later release a cleanup mod for my earlier versions. It defaults to middle and the reason you see it as being middle still is you were looking at your old version. However the code block you are coding is the new code. Check your navigation tabs listener and see which file it is pointing to. It should be the one you have here.
 
Just did a clean install of this - One user did a donation, did not have the IPN set up yet so I went to manually add it and this is what I recieved.

Mysqli prepare error: Unknown column 'last_donation_date' in 'field list'

Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
Zend_Db_Adapter_Abstract->query() in Merc/DonationManager/DataWriter/Donation.php at line 115
Merc_DonationManager_DataWriter_Donation->updateGoalAndUserAmountTotals() in Merc/DonationManager/DataWriter/Donation.php at line 62
Merc_DonationManager_DataWriter_Donation->_postSave() in XenForo/DataWriter.php at line 1385
XenForo_DataWriter->save() in Merc/DonationManager/ControllerAdmin/Donation.php at line 143
Merc_DonationManager_ControllerAdmin_Donation->actionSave() in XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
XenForo_FrontController->run() in /home/brothe8/public_html/forum/admin.php at line 13
 
no - additionally I had another donation and although I recieved it to my paypal I did not get it - I should only have to enable to IPN correct to forum/donations
 
Okay I spotted the issue. It is only with fresh installs which is why I have missed it. If you can just run a query run this one...
Code:
ALTER TABLE merc_user_donate ADD last_donation_date INT UNSIGNED DEFAULT 0 NOT NULL
It should solve your issue. I will make another release once I have a chance.
 
There is 2 lots of files. Due to a refactor you will have 2 sets and I will later release a cleanup mod for my earlier versions. It defaults to middle and the reason you see it as being middle still is you were looking at your old version. However the code block you are coding is the new code. Check your navigation tabs listener and see which file it is pointing to. It should be the one you have here.

Oh I notice there's two now:
/library/Merc/Listener/NavigationTabs.php
/library/Merc/Listener/DonationManager/NavigationTabs.php

Seems like all the files inside the DonationManager dir are the old files.

The navigation_tabs event code listener is currently pointing to the Merc_DonationManager_Listener_NavigationTabs class which is the new NavigationTabs.php inside /library/Merc/Listener/

Old NavigationTabs.php is Merc_Listener_DonationManager_NavigationTabs which the current event listener is not set to.

At any rate both have the position set to 'end' - as far as I can tell it should be reading the new file / code and stick the navtab in the end. :confused:
 
Okay I spotted the issue. It is only with fresh installs which is why I have missed it. If you can just run a query run this one...
Code:
ALTER TABLE merc_user_donate ADD last_donation_date INT UNSIGNED DEFAULT 0 NOT NULL
It should solve your issue. I will make another release once I have a chance.


have no idea of how to run that but will look for your release asap
 
Oh I notice there's two now:
/library/Merc/Listener/NavigationTabs.php
/library/Merc/Listener/DonationManager/NavigationTabs.php

Seems like all the files inside the DonationManager dir are the old files.

The navigation_tabs event code listener is currently pointing to the Merc_DonationManager_Listener_NavigationTabs class which is the new NavigationTabs.php inside /library/Merc/Listener/

Old NavigationTabs.php is Merc_Listener_DonationManager_NavigationTabs which the current event listener is not set to.

At any rate both have the position set to 'end' - as far as I can tell it should be reading the new file / code and stick the navtab in the end. :confused:
It should be working :/
 
I don't see any reasoning for it to happen like this other than a typo or another mod. And I have looked over all the spelling andit looks fine...
 
Try making the function return straight away and see if it removes the link at least.
 
Try making the function return straight away and see if it removes the link at least.
Made it return right away and the navtab was still there, so I removed everything in the function to ensure there was no chance, and the navtab was still there. I even did the same for the old NavigationTabs.php inside /Listener/DonationManager/ and the Donate NavTab showed still. So what I have is two empty navtab functions yet I still have a navtab... only thing that gets rid of it is disabling the addon completely (and I presume disabling the event code listener for the navtabs in development would do the same).

I'm beyond perplexed at this point. I guess I'm going to try a fresh install if nothing pops up soon.


Edit:
I think I found the culprit, not sure how I missed it, but you were originally right about multiple files being the issue, there's actually 3 navigationtabs.php files, all the ones the addon is using are inside Merc/DonationManager/, I was looking in Merc/Listener/NavigationTabs.php, and /Merc/Listener/DonationManager/NavigationTabs.php

The one inside Merc/DonationManager/NavigationTabs.php was set to 'middle' - the culprit!


Edit2:
Okay I spotted the issue. It is only with fresh installs which is why I have missed it. If you can just run a query run this one...
Code:
ALTER TABLE merc_user_donate ADD last_donation_date INT UNSIGNED DEFAULT 0 NOT NULL
It should solve your issue. I will make another release once I have a chance.

Hey Robbo, despite fixing the issue I was having I did do a fresh install and ran into the same issue the user above ran into when adding a new donation manually. I tried to run your query but it tells me the merc_user_donate table doesn't exist. Looking at the database there's 4 tables prefixed with merc: merc_donation, merc_donation_goal, merc_donation_log, merc_donor.

merc_donation has the 'last_donation_date' column in it, but I guess the addon isn't reading this table?
 
Could you please advise when you will have a fix so I can properly use this addon on my site
I'll get another minor release out tonight.

Hey Robbo, despite fixing the issue I was having I did do a fresh install and ran into the same issue the user above ran into when adding a new donation manually. I tried to run your query but it tells me the merc_user_donate table doesn't exist. Looking at the database there's 4 tables prefixed with merc: merc_donation, merc_donation_goal, merc_donation_log, merc_donor.
merc_donation has the 'last_donation_date' column in it, but I guess the addon isn't reading this table?
I used the wrong table from before the refactor. Run this query:
Code:
ALTER TABLE merc_donor ADD last_donation_date INT UNSIGNED DEFAULT 0 NOT NULL
 
Thanks for all the fixes Robbo, you're doing a great job.

Quick question, which file or where in your code can I find where it sets the beginning and end date for monthly donations? I want to change mine to display yearly rather than monthly donation goals and I know it will be awhile before you implement this, so I'll just modify the code myself in the mean time.
 
Thanks for all the fixes Robbo, you're doing a great job.

Quick question, which file or where in your code can I find where it sets the beginning and end date for monthly donations? I want to change mine to display yearly rather than monthly donation goals and I know it will be awhile before you implement this, so I'll just modify the code myself in the mean time.
It isn't really a simple modification. Due to how the goal log works and other little areas it isn't a simple thing to change. Bad early design really. You can look at Merc_DonationManager_Model_Donation::updateGoalInfo() in library/Merc/DonationManager/Model/Donation.php on line 281 and change it to check for the current year instead. I don't know if this will work as intended though. I might add in a hacky way of doing it so people can have one of a few presets for now (1 week, 2 weeks, 1 month, 3 months, 6 months, 1 year, 2 years sounds ok to me). Then later on when I have time again do it properly with custom set times and functionality for when a goal ends.
 
Top Bottom