Skip to:
Content
Pages
Categories
Search
Top
Bottom

User Online Icon

  • Avatar of jamesyeah
    jamesyeah
    Participant

    @jamesyeah

    Hey,

    Just a quick little idea, was wondering how hard it might be to implement, or if it was possible.

    I was thinking it would be quite cool to add a little green dot to the corner of a users avatar if they are currently online, would that be possible?

    James

Viewing 10 replies - 1 through 10 (of 10 total)
  • Bit of a blast from the past, but: http://trac.buddypress.org/ticket/612

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    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.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    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! ;)

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    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';

    Avatar of abcde666
    abcde666
    Participant

    @erich73

    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 !

    Avatar of jamesyeah
    jamesyeah
    Participant

    @jamesyeah

    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

    Avatar of luvs
    luvs
    Member

    @luvs123

    @r-a-y, I would love to use this, but I get: `Fatal error: Class ‘BP_Core_User’ not found in`

    Avatar of James
    James
    Participant

    @janismo

    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.

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    @luvs123 – BP_Core_User refers to an older version of BuddyPress.

    I would try something like what shanebp outlines here:

    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-display-if-the-user-is-online-or-not-in-the-forum-topic-and-profile/#post-99118

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.