Skip to:
Content
Pages
Categories
Search
Top
Bottom

Who’s Online Widget

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

  • danbp
    Participant

    @danbp

    Hi,
    never heard of this kind of functionnality for BP. Do you mean a way to show WHERE the actual user is on the site ?
    Sounds like tracking or user history. But such information is mostly used by site admins only and is handled on back-end, not on front-end.
    Anyway, if you want more details about the few plugins doing that, here’s an overview. It may exist other resource about this. Google is your friend !


    tronix-ex
    Participant

    @tronix-ex

    Hi danbp,

    I actually googled it but didn’t find except wp-useronline it does the same functionalities but sometimes it shows wrong url and also it tracks users by their ip not the username.

    Please suggest something like this as buddypress has already who’s online widget which is good but if it can also show the browsing page it would be good.

    Thanks,


    danbp
    Participant

    @danbp

    ???, you haven’t answered to my question! What do you mean by browsing page ?

    Bp’s widget let you access to the online user profile by clicking on the user avatar showed in the widget. What do you expect more or different ?


    tronix-ex
    Participant

    @tronix-ex

    Oh sorry please se below.

    Q. Do you mean a way to show WHERE the actual user is on the site?
    A. Yes

    For example:-

    Who’s Online:
    1. [avatar] user currently viewing this [page] in the site
    2. [avatar] user currently viewing this [page] in the site
    3. [avatar] user currenty viewing this [page] in the site


    danbp
    Participant

    @danbp

    I have no real idea for this. You have to code that as nothing ready to use exist. Similar question here.
    Note also that BP pages are dynamic, so what ever you can built won’t, imo never, be exact.

    Ie. user A is on a profile activity and another is on members directory. What would you get ? At best, only the /members/ page… that is a bit vague, no ? And who cares, outside evtl. you ?

    Note also that the nav history is browser territory, and that each client has different settings, even deactivated history, so you can’t really trust user’s history…

    My recommandation would be: don’t loose your time trying to do this. BP let members know about there activities, focus on this and encourage it, instead of tracking there navigation. 😉


    tronix-ex
    Participant

    @tronix-ex

    Well I appreciate your quick responses over my questions but I have to find a way because its my client requirements.

    Could you help me in these items please?

    1. how to get the total number of current online users?
    2. I need to add auto refresh on the current online users list
    3. how to get the last activity date of each current online user?

    Thanks again,


    danbp
    Participant

    @danbp

    Clients requiring many things ! Some can be done, some not. It’s to you to explain them that it’s not possible. Or only with a very huge additionnal budget. This argument is mostly the best to opposite to an obtuse “i want this feature”. Diplomacy, diplomacy… 👿

    1) You count the number of avatars on the widget ! Or something like this. 😉
    2) who’s online refreshes after 5 mn. See https://buddypress.trac.wordpress.org/ticket/3590
    3) try with bp_get_user_last_activity()

    Also wp-content\plugins\buddypress\bp-members\classes\class-bp-core-whos-online-widget.php


    tronix-ex
    Participant

    @tronix-ex

    Thanks danbp for suggesting stuff. please see below my answers.

    1. okay
    2. no solutions at all
    3. I am not getting anything using this function


    tronix-ex
    Participant

    @tronix-ex

    I even tried to pull the data using this <?php echo bp_activity_latest_update( bp_displayed_user_id() ); ?> but no success.

    I actually want to get the time of the last activity.


    danbp
    Participant

    @danbp

    It is wrong as it search for an activity and not site access…

    Try this


    tronix-ex
    Participant

    @tronix-ex

    Thanks for your response danbp but its a different thing that you suggested.


    danbp
    Participant

    @danbp

    Yes it’s different and ?
    And this is how to use what i already suggested

    function users_last_activity() {
    $user_id = bp_displayed_user_id();
    //$activity = bp_get_user_last_activity( $user_id ); // raw date/time
    $activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __('active %s', 'buddypress') ); // ago format like on members directory
    
    	if( bp_is_active( 'activity' ) ) {
    	 echo $activity;
    	}
    }
    
    // testing the result on profile header
    add_action( 'bp_profile_header_meta', 'users_last_activity' );

    tronix-ex
    Participant

    @tronix-ex

    yes that works for members header and showing active user time. But I want to display the last activity(comments/posts/replies/topic-created) time of each online user.

    For example:

    [avatar] user last activity was at 11:00pm
    [avatar] user last activity was at 03:17am
    [avatar] user last activity was at 09:29am

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Skip to toolbar