Forked from shanebp/gist:b73343e9c9a6509d2bbc47de80c881c1
Created
October 17, 2020 20:50
-
-
Save mzdebo/92c620f9912fc0d29b69259e749f2ed4 to your computer and use it in GitHub Desktop.
add last_activity timestamp to all BP members
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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