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
    
..are you there? –  Aliyah Feb 24 '13 at 1:55
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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