Update user meta on logout
-
I am having some trouble, I need to update some user meta during the log out process, I also need to update the user meta if the user is automatically logged out for being innactive. I have created a stack exchange question about it but not really having much success. Is anyone able to provide any insight, can this be done, if so how – what hooks do I need to target.
my existing code is below – it doesnt work, the
$expirein
value is super low so that I am not waiting forever for the autologout.add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_hour'); function keep_me_logged_in_for_1_hour( $expirein) { $expirein = 120; return $expirein; // 2min } add_action('clear_auth_cookie', 't_offline_update', 10); function t_offline_update() { $userinfo = wp_get_current_user(); update_user_meta( $userinfo->ID, 't_online_status', 'offline' ); }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Update user meta on logout’ is closed to new replies.