• Resolved Jake Hall

    (@geekserve)


    Hi guys,

    I am trying to update a meta column each time a user logs out of the site, currently I have the following within my plugin:

    add_action('template_redirect', function() {
                global $current_user;
                get_currentuserinfo();
    
                $this->bbpis_userID = $current_user->ID;
            }, 10 );        
    
            add_action('template_redirect', array( $this, 'bbpis_whosonline_update' ), 10 );
            add_action('clear_auth_cookie', array( $this, 'bbpis_useroffline' ), 10 );

    There is a problem however, the user id gets destroyed when the user goes through the logout process.

    Does anyone know of a way I can use to resolve this?

Viewing 1 replies (of 1 total)
  • Thread Starter Jake Hall

    (@geekserve)

    Solved, I realised that template_redirect was far too late, so changed the hook to init instead.

    All is good!

Viewing 1 replies (of 1 total)

The topic ‘User ID handling upon logout’ is closed to new replies.