Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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