This $bp->loggedin_user->id
will only give you a single id, of the current logged in user.
btw – it also requires use of the $bp global
.
You don’t need to use that global. Use bp_loggedin_user_id()
instead.
BuddyPress does not track logged in users. It does not use sessions.
It does use timestamps in the database to indicate recent activity.
So you could use custom sql to return user ids.
For example:
function shahid_get_recent_active() {
global $wpdb;
$time = time() - (60 * 10); // current time minus 10 minutes
$cutoff = date('Y-m-d h:i:s', $time);
$user_ids = $wpdb->get_col( "SELECT user_id FROM {$wpdb->prefix}bp_activity WHERE type="last_activity" AND date_recorded > '$cutoff' " );
var_dump( $user_ids );
}
add_action( 'bp_ready', 'shahid_get_recent_active' );
$user_ids
will be an array.
Related Posts:
- How to get a buddypress user profile link and a certain user profile field for the current post author?
- How to Modify/Change a Buddypress/WordPress Account Activation Process
- Integrating Buddypress, Wootumblog and WPMU Sitewide tags
- BuddyPress: Allow only one email domain to register
- Ability to set character limit in BuddyPress?
- Add BuddyPress Profile Menu Item [closed]
- BuddyPress: Adding a new tab in groups
- How to display random users with avatars
- BuddyPress: hook to add new profile fields and groups
- wp_editor on front end – JavaScripts not included
- Syncing BuddyPress and WordPress profile fields [closed]
- Buddypress Full documentation [closed]
- What problems can BuddyPress make? [closed]
- How to force buddypress users to complete profile after registration? [closed]
- how to get current user name by user_id in buddypress?
- What’s the easiest way to change the default landing page for BuddyPress groups?
- BuddyPress | Check if user is in current group [closed]
- How to override Member’s Avatars in BuddyPress [closed]
- Buddypress send email notification only if user is not logged in [closed]
- Redirect after User Activation [closed]
- Rename Buddypress Profile Tab
- Delete all user attachments
- How to re-enable admin bar with Buddypress active? (BP bar removed) [closed]
- Login redirect to certain bp profile page
- How to ensure buddypress custome profile field is unique
- Show buddypress notification in the frontend [closed]
- Buddypress and WordPress on different subdomains with the same database?
- Display link with current user’s username in it in Custom Menu
- BuddyPress Xprofile check if user can view field [closed]
- How to reply to Buddypress notifications? [closed]
- Posting Photos and Other Attachments in a BuddyPress Forum?
- How to update BuddyPress xprofile fields programmatically? [closed]
- BuddyPress: How to get info of users filtered by some x-profile data? [closed]
- How to check if the current page is a “personal activity”-page in buddypress? [closed]
- Buddypress get member meta info for specific user ID [closed]
- Redirect after registration in BuddyPress [closed]
- Remove tabs from buddypress groups and members pages [closed]
- changing the signup button url in WPMU/Buddypress
- Buddypress profile pictures sync across WordPress Multisite Network
- Make Profile link, link to the BuddyPress profile instead of the WordPress dashboard? [closed]
- Buddypress – Send New User Activation Link to Admin [closed]
- How to Change BuddyPress Mystery Man Graphic without Overwriting Core Image File [closed]
- I’m trying to Add a new Buddypress menu tab and it is not showing up [closed]
- How to get larger version of author avatar
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- Exclude User from Activity Stream in BuddyPress?
- How to run scripts when a new blog is created in Buddypress?
- Changing default Buddypress avatar affects all site avatars (because gravatar)
- Showing the user’s username in registration email or activation page with BuddyPress [closed]
- Display four buddypress activies [closed]
- How to remove unused avatar uploads in buddypress [closed]
- Buddypress Fake (non-bot) Users [closed]
- Conditional based on the User Role of the Current Profile the user is viewing – BuddyPress [closed]
- BuddyPress | How to merge the “setting” & “profile” pages into one page? [closed]
- List User Comments on User Profile BuddyPress [closed]
- cubepoints/buddypress show new rank on activity? [closed]
- Upload files into buddypress profiles [closed]
- BuddyPress: What is the use of is_default_option field in wp_bp_xprofile_fields table? [closed]
- How do I find the bbpress forum ID for a forum in a buddypress group?
- How to get Viewing profile ID in buddypress? [closed]
- Is it possible to have a network of BuddyPress sites, a-la WordPress MU, with single-sign-on? [closed]
- Redirect users based on custom field
- delete a photo tag in rtmedia [closed]
- How to make a Discussion Group ”Sticky” in BuddyPress [closed]
- Can’t Find BBPress data in Database
- Buddypress register.php user redirect [closed]
- How to get user id which is done by buddypress [closed]
- BuddyBoss (BuddyPress / bbPress) moderation filters not doing anything
- How to add a count in a custom tab in a Buddypress group
- Two people sharing user in WordPress [closed]
- how to make a profile entry read only except for site managers [closed]
- Table ‘wp_signups’ doesn’t exist [closed]
- Forcing WordPress to work differently
- Show activities of defined BuddyPress groups [closed]
- How to edit buddypress templates? [closed]
- Is there a plugin or something that allows you to use BuddyPress without having to create a BuddyPress-ready theme?
- Add an extra field to BuddyPress activity form
- Query users which have same dynamically generated roles as the current user
- Buddypress – adding custom post to members
- BuddyPress – Get a List of Defined xProfile fields [closed]
- How to create a theme specific translation of buddypress? [closed]
- Remove post content from buddypress activity [closed]
- BuddyPress Toolbar
- Buddypress Registartion template [closed]
- Does BuddyPress Have An Action Hook for remove_user? [closed]
- how to remove mandatory required fields in buddypress registration [closed]
- Can you use the buddypress profile system without installing the whole of buddypress? [closed]
- How to auto-accept a friend-request in buddypress based on user meta
- Best practices for securing a Buddypress installation?
- After Upgrade to Buddypress 1.2.6 from 1.2.5.2 , admin bar area displayed incorrectly for guest-visitors
- User-based media gallery
- Customizing the BuddyPress blog loop
- switch_to_blog( ) content disappears after load
- BuddyPress returning incorrect xprofile date [closed]
- Buddypress bp_has_members function custom search with meta query [closed]
- Show Specific Buddypress Group Activity Stream in page template
- Buddypress, BBPress – deqeue bp, bbp css and get group member count
- buddypress activity social share
- Buddypress dynamic profile field
- Is it possible to remove ‘group’ from slug for buddypress groups