[wp-trac] [WordPress Trac] #38048: Weird behaviour of "add_action('wp_login', 'func')" in combination with wishlist member
WordPress Trac
noreply at wordpress.org
Wed Sep 14 00:26:53 UTC 2016
#38048: Weird behaviour of "add_action('wp_login','func')" in combination with
wishlist member
-----------------------------------------------+---------------------------
Reporter: jobst | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: General | Review
Severity: normal | Version: 4.6.1
Focuses: ui, accessibility, administration | Keywords:
-----------------------------------------------+---------------------------
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
--
Ticket URL: <https://core.trac.wordpress.org/ticket/38048>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list