Opened 8 years ago
Closed 6 years ago
#38048 closed defect (bug) (invalid)
Weird behaviour of "add_action('wp_login','func')" in combination with wishlist member
Reported by: | jobst | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.6.1 |
Component: | Plugins | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Hi
I added a ticket at wishlist as well as I cannot figure out where this problem is starting.
I am also not sure when this started but I cannot see changes in the login time of Wishlist members - so I debugged.
Wishlist adds a function to the list of hooks for wp_login in its main file wpm.php like so
add_action('wp_login', array(&$WishListMemberInstance, 'Login'));
I turned off all plugins that were not needed for this and only kept the required ones, e.g. wishlist. woocommerce e.g.
I put a line at the end of my functions.php with a marker file like so:
add_action('wp', function(){ error_log("HERE_HERE_HERE_HERE"); error_log(print_r($GLOBALS['wp_filter']['wp_login'],1)); exit; } );
I then basically accessed the "my_account" page.
The php log file did NOT show an entry of wishlist in the wp_login
action hook array.
I then disabled every action hook for wp_login, even mine.
The php log file STILL did NOT show an entry of wishlist in the wp_login
action hook array.
Then I changed in the file wpm.php from
add_action('wp_login', array(&$WishListMemberInstance, 'Login'));
to
add_action('wp_login', array(&$WishListMemberInstance, 'Login'),20,2);
and sure enough it showed up, and the login time for the members changed.
I looked at the function "add_action" and "add_filter" but I could not see anything what could prevent the login member function to be added.
So is this a bug?
Is this because of the sheer size of &$WishListMemberInstance
that add_action does not want to do it?
However, just before the class definition of WishlistMember I added a function called MyTestFunction
and replaced the array(&$WishListMemberInstance,'Login')
with MyTestFunction
and looked at the debug output and sure enough the function was added to the list of wp_login hooks.
I added a ticket to wishlist as well.
Jobst
Hi @jobst,
I have been unable to replicate the issue you are describing. However, it seems like this is an issue specifically with the plugin, and not core. I am going to close this out, but if you can share a specific code example that demonstrates the issue in core, please feel free to reopen!