I need to update all users status to recent so they appear on the members list. I am using buddypress.

If you need anything else, just ask.

  • ..are you there? – Androliyah Feb 24 '13 at 1:55

BP uses a meta value called 'last_active' to determine who should be shown in the Members directory. You can write a loop that will set this value for each member. I should note, though, that manually setting this 'last_active' value can lead to misleading results, since the string 'active x minutes ago' appears throughout BuddyPress, and in this case will have been forged.

Anyway, something like this:

global $wpdb;
foreach ( $wpdb->get_col( "SELECT ID FROM $wpdb->users" ) as $user_id ) {
    bp_update_user_meta( $user_id, 'last_activity', bp_core_current_time() );

You may want to insert some logic for excluding spammed/deleted members, but how that's done depends on whether you're running multisite.

Not the answer you're looking for? Browse other questions tagged or ask your own question.