Try
$users = UserOnline_Template::compact_list( 'site' , 'list' );
Hmmmm…this is what I have:
$users = UserOnline_Template::compact_list( 'site' , 'list' );
foreach($users as $user) {
echo $user;
}
It returns this error: Catchable fatal error: Object of class stdClass could not be converted to string.
the $user is an object not a string, you do a var_dump($user); instead of echo $user; and see what it returns first.
Ah, duh 😉 Thanks!
For anyone else wanting to extract this info, here is the beginnings of what I’m setting up in order to grab the user avatar and customize the list.
if (function_exists('get_users_browsing_site')):
$users = UserOnline_Template::compact_list( 'site' , 'list' );
foreach ($users as $user) {
echo get_wp_user_avatar( $user->user_id, 'thumbnail' );
echo '<a href="'. get_author_posts_url( $user->user_id ) .'">';
echo $user->user_name;
echo '</a>';
}
endif;