Hey DJPaul,
I think jamesyeah is talking about a general online status icon for BP and not for the buddypress.org/forums/.
@jamesyeah, check out the /bp-core/bp-core-classes.php file.
This will give you a headstart:
global $bp;
$user = new BP_Core_User( $bp->displayed_user->id); //i'm assuming you're viewing someone's profile page here
$user_status = $user->status;
I’ll take a look at this later tonight, but we’ll see if a solution is posted by then
Well, of course he is, but I don’t have eight month old samples for *everything*. It’s pretty close for anyone who wants to implement this as a plugin.
I know your code offers the “dot” portion of his request, DJPaul.
Here’s the online status portion:
EDIT: Deleted function… needs more testing with other accounts that are not administrators!
Okay, here’s my crack at finding out if a displayed user ID is online:
function is_displayed_user_online() {
global $bp;
$user = new BP_Core_User();
$fetchOnlineUsers = array_values($user->get_online_users());
// grab online user IDs
$onlineIDs = $fetchOnlineUsers[0];
// loop through each online user ID; if online user ID matches displayed user ID, then displayed user is online, hence return true
foreach($onlineIDs as $online) {
if($bp->displayed_user->id == $online->user_id) {
return true;
}
}
}
//let's test out the function
//put this in a profile template
if(is_displayed_user_online())
echo 'user is online';
else
echo 'user is offline';
can we get this feature into BP-core ?
so that Admin is able to activate or deactivate this feature ?
Or can we get a plugin for this ?
Thanks !
Hey guys,
Thanks for your feedback, this looks like exactly what I was after, I’ll try and put this together as a plugin as I think it could be pretty cool.
James
@r-a-y, I would love to use this, but I get: `Fatal error: Class ‘BP_Core_User’ not found in`
wouldn’t it be easier to overlay css/border color for online users?
do not know how to do it, no need to ask me , smth like is user logged in etc.