Posted on October 16, 2013 , Last Modified on: October 16, 2013

Custom listing of Recent Visitors

/* custom Recent visitor code to list it anywhere for logged in user */
$visitors = visitors_get_recent_visitors(get_current_user_id(), 5);//pass the user id for which we are retriving and how many we want
foreach( (array) $visitors as $visitor_id ){

    echo bp_core_get_userlink( $visitor_id );//display the name of the 

    //bp_core_get_user_displayname( $visitor_id ); //use it to fetch the user display name
    //bp_core_get_user_domain( $visitor_id ); //use it to get user profile url
    //bp_core_fetch_avatar( array('item_id'=> $visitor_id, 'height'=>25, 'width'=> 25)); //fetch user avatar
}

#recent-visitors