Title: Last activity timestamp for BuddyPress
Last modified: March 30, 2017

---

# Last activity timestamp for BuddyPress

 *  [snart](https://wordpress.org/support/users/snart/)
 * (@snart)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/quick-question-for-php-masters-here/)
 * _[ Moved to the [Fixing WordPress sub-forum](https://wordpress.org/support/topic/before-posting-in-everything-wordpress/).]_
 * Hey guys,
 * I moved all my users from Ning to WordPress+BuddyPress (yay!), and I need to 
   generate a last activity timestamp for all the users so they show up in my BuddyPress
   members list. Boone B Gorges (BuddyPress superstar!) provided the following script:
 *     ```
       $user_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->users}");
       foreach ( $user_ids as $user_id ) {
           if ( ! bp_core_get_user_last_activity( $user_id ) ) {
               bp_core_update_user_last_activity( $user_id );
           }
       }
       ```
   
 * I just need some help “finishing” it. He said I need to declare the $wpdb global.
   I don’t know PHP, so appreciate if anyone could help. I have a local instance
   of WordPress to test, so no worries about destroying my main site. 🙂
 * I’m going to follow the instructions here to run the script: [http://exygy.com/run-one-time-wordpress-script/](http://exygy.com/run-one-time-wordpress-script/)
 * Thank so much – I’m loving this platform so far!

Viewing 1 replies (of 1 total)

 *  [Zübeyir Muştak](https://wordpress.org/support/users/abulogics/)
 * (@abulogics)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/quick-question-for-php-masters-here/#post-9068821)
 * Hi there!
    Can you please guide me that where you want to display this information?
   1- In user profile page. 2- In admin area (Where all user are listed)

Viewing 1 replies (of 1 total)

The topic ‘Last activity timestamp for BuddyPress’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Zübeyir Muştak](https://wordpress.org/support/users/abulogics/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/quick-question-for-php-masters-here/#post-9068821)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
