• Resolved drcheap

    (@drcheap)


    The plugin appears to only be tracking log-ins for admin accounts. All admin accounts are tracked, but no other accounts.
    We use the standard wp-login interface for log-ins.
    Theme is Divi.
    We use S2Member for our paid membership management. Custom user types for membership do show up in the drop-down filters, but no records appear for their login histories.
    Users who have standard “member” accounts similarly have no records for their login histories.
    If I change an S2Member paid membership account to an Admin account, then admin-level logins are tracked and do appear in the records. When I change that account back to either “member” or so it’s S2Member custom membership type then any future logins do not appear. Past logins from when that was an admin account show up, but new logins as “member” or as a custom membership type are not being tracked.
    Thank you in advance for any help you can offer! We’re really hoping to be able to use this plugin to track IP addresses that may be compromising member accounts.
    Ah, and just to head-off the obvious: yes, we did check our display filters! =)

    • This topic was modified 7 years, 12 months ago by drcheap.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Faiyaz Alam

    (@faiyazalam)

    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.

    Thread Starter drcheap

    (@drcheap)

    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?

    Thread Starter drcheap

    (@drcheap)

    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.
    Plugin Author Faiyaz Alam

    (@faiyazalam)

    @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!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Only Logging Admin Logins’ is closed to new replies.