Skip to content

Instantly share code, notes, and snippets.

@sadrul
Last active February 3, 2020 17:03
Show Gist options
  • Save sadrul/f6ab4d7dae5261879489 to your computer and use it in GitHub Desktop.
Save sadrul/f6ab4d7dae5261879489 to your computer and use it in GitHub Desktop.
Buddypress user last activity insert
<?php
add_action( 'wp_head', 'record_user_last_activity' );
function record_user_last_activity(){
$get_users = get_users( array( 'fields' => array( 'ID' ) ) );
if(!empty($get_users)){
foreach($get_users as $single){
bp_update_user_last_activity($single->ID);
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment