Skip to content

Instantly share code, notes, and snippets.

@shanebp
Last active January 19, 2023 02:37
Show Gist options
  • Save shanebp/b73343e9c9a6509d2bbc47de80c881c1 to your computer and use it in GitHub Desktop.
Save shanebp/b73343e9c9a6509d2bbc47de80c881c1 to your computer and use it in GitHub Desktop.
add last_activity timestamp to all BP members
/*
* Paste in your theme functions.php or in bp-custom.php.
* Load the site in a browser
* Remove from your theme functions.php or bp-custom.php.
*/
function buddypress_add_last_activity() {
$members = get_users( 'fields=ID' );
// $members = get_users( 'fields=ID&role=subscriber' );
foreach ( $members as $user_id ) {
bp_update_user_last_activity( $user_id, bp_core_current_time() );
}
}
add_action('bp_init', 'buddypress_add_last_activity' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment