To reproduce the bug, I installed a fresh WP setup and S2Member plugin.
I placed the following code in theme’s functions.php file:
add_action('wp_login', 'on_login');
function on_login($username) {
var_dump($username);exit;
}
The above function is called only if I do admin login.
It means there is bug in S2Member plugin.
You should create support topic for S2Member.
Please check this similar issue:
https://wordpress.org/support/topic/not-loging-with-userpro-userultra-plugins/
Thanks.
Thanks. I will check in with them and report back. I appreciate your work checking it out!
@drcheap, I’m experiencing the same problem. Can you let us know what you hear from s2member?
Ok, so I have tried three different tracking plugins and all had the same problem. After a little discussion in the support forums for s2Member, here is what we discovered. The problem is caused by using the wp_login hook, which s2Member or something else on my site is bypassing. If you change the wp_login hook to wp_authenticate in the tracking plugin, it should work. I found a different plugin that was recommended over on the s2Member forums and modified that plugin by editing one line and now it is tracking fine.
If Faiyaz could point me to the right file and line to make the change in this plugin, I would be happy to give it a try and see if it works on this plugin as well.
Here’s the thread on the s2Member support forums about it: https://forums.wpsharks.com/t/s2member-login-does-not-trigger-wp-login-event/4498/11
-
This reply was modified 7 years, 12 months ago by
drcheap.
@drcheap
wp_login hook is fired after user is authenticated successfully.
wp_authenticate hook is fired before authentication.
So, it is not good idea to use this hook.
I have checked the code of S2Member and found that it is usign wp_login to redirect after login that is why my plugin does not work.
For more info, you can see this file: \wordpress\wp-content\plugins\s2member\src\includes\hooks.inc.php
LINE 125: add_action('wp_login', 'c_ws_plugin__s2member_login_redirects::login_redirect', 10, 2);
To fix this you have to change priority from 10 to 0 (i.e. zero) in the following file:
wordpress\wp-content\plugins\user-login-history\includes\class-user-login-history.php
LINE 177:$this->loader->add_action('wp_login', $user_tracker, 'save_user_login', 10, 2);
After this, my plugin code will be excuted before S2Member and it will work fine.
Please make sure to check if S2Member plugin is working fine after doing change in my plugin file.
You can also tell about this change to S2Member support so that they can tell you if there may be in conflict with the plugin.
Hope this help.
Looking forward to hearing from you.
Thanks.
-
This reply was modified 7 years, 12 months ago by
Faiyaz Alam.
-
This reply was modified 7 years, 12 months ago by
Faiyaz Alam.
I just tried making this change and all appears to be working correctly with site. I’ll give an update after a bit to see if it’s capturing data for users. Thanks!