Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

closed as off-topic by toscho Aug 2 at 20:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

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

1 Answer 1

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.

share|improve this answer

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