• Resolved kevingoldman

    (@kevingoldman)


    Hi All,

    What would it take for this plugin to track logins from Trusona’s #NoPasswords plugin?

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

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

    (@faiyazalam)

    Add this code in your theme functions.php file

    add_action('set_logged_in_cookie', 'custom_set_logged_in_cookie', 10, 6);
    
    function custom_set_logged_in_cookie($logged_in_cookie, $expire, $expiration, $user_id, $logged_in_text, $token) {
        $user = get_user_by('id', $user_id);
        if (!empty($user->user_login)) {
            do_action('custom_wp_login', $user->user_login, $user);
        }
    }

    Now do a minor change in the file:
    user-login-history/includes/class-user-login-history.php

    Add a new line:
    $this->loader->add_action('custom_wp_login', $user_tracker, 'save_user_login', 10, 2); // new line for Trusona
    after this code:
    $this->loader->add_action('wp_login', $user_tracker, 'save_user_login', 10, 2);

    I have not checked this code.
    Please test and let me know if any issue.

    Thread Starter kevingoldman

    (@kevingoldman)

    Faiyaz,

    You are too kind. Thank you!

    I tried adding both lines of code but get “header” errors. (The errors are below).

    I wouldn’t expect you to look at this. But, if you do and it’s a simple fix, your input is greatly appriciated.

    • Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /path…/html/wp-content/plugins/trusona/includes/trusona-functions.php:62) in /path…/html/wp-content/plugins/user-login-history/admin/class-user-login-history-user-tracker.php on line 274
    • Warning: Cannot modify header information – headers already sent by (output started at /path…/html/wp-content/plugins/trusona/includes/trusona-functions.php:62) in /path…/html/wp-includes/pluggable.php on line 1216`
    • This reply was modified 6 years, 8 months ago by kevingoldman.
    • This reply was modified 6 years, 8 months ago by kevingoldman.
    Plugin Author Faiyaz Alam

    (@faiyazalam)

    In the same file, replace the code:
    $this->loader->add_action('init', $user_tracker, 'do_session_start');
    with:
    $this->loader->add_action('init', $user_tracker, 'do_session_start', 0);

    If above does not work, you have to remove the php closing tag at the bottom from all the PHP files, containing classes or functions, of all the plugins. This is just to make sure that if any files printing anything before sending header.
    I found these two Trusona files with closing tag at the bottom:
    wordpress/wp-content/plugins/trusona/trusona-openid.php
    wordpress/wp-content/plugins/trusona/includes/trusona-functions.php

    I request you to checkout the Upcoming Version 1.7.

    Thanks for your feedback.

    • This reply was modified 6 years, 8 months ago by Faiyaz Alam.
    • This reply was modified 6 years, 8 months ago by Faiyaz Alam.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Integration with Trusona?’ is closed to new replies.