Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] How to display if User is Online or Not in Forum Topic and Profile

Viewing 26 replies (of 26 total)

  • mohammad-mursaleen
    Participant

    @mohammad-mursaleen

    This might help someone. Have made the following simple script to get online status within members loop.

    $user_id = bp_get_member_user_id();
    $status = 'offline' ;
    
    $last_activity = bp_get_user_last_activity( $user_id );
    
    $exact_time = time();
    
    $time_ago = date("Y-m-d h:i:s",$exact_time – 3 * 60); // time 3 minutes ago
    
    if( $last_activity > $time_ago ){ // check if user activity for last few minutes
    $status = 'online' ;
    } 

    You can use it within while loop of members-loop.php.

    Hope this would help.
    Thanks!

Viewing 26 replies (of 26 total)
  • The topic ‘[Resolved] How to display if User is Online or Not in Forum Topic and Profile’ is closed to new replies.
Skip to toolbar