Show most recent users on footer of your bbpress forum
-
Well, if someone what show most recent signed up users on footer of your bbpress forum, you can use my function below:
function show_recent_users($howmany=10, $show_avatar=false){
global $bbdb;
$recent_users = $bbdb->get_results( "SELECT * FROM $bbdb->users ORDER BY ID DESC LIMIT $howmany" );
if($show_avatar){
$users = array();
foreach($recent_users as $user){
$users[0].= '<td>' . bb_get_avatar( $user->ID, 48 ) . '</td>';
$users[1].= '<td><anc href="' . get_user_profile_link($user->ID) . '">'. $user->display_name . '</td>';
}
echo "<table id='tb-users'> ";
echo "<tr>" . $users[0] . "</tr>";
echo "<tr>" . $users[1] . "</tr>";
echo "<table>";
}else{
echo "s| ";
foreach($recent_users as $user){
echo '<anc href="' . get_user_profile_link($user->ID) . '">'. $user->display_name . ' | ';
}
}
}
Replaces anc to a, of course, I used and to bbpress don’t treat it as a markup code.
To show just name uses:
show_recent_users(10);
To show gravatar and name, uses:
show_recent_users(10,true);
And now, just put the code above in top of the file footer.php that can be found on your theme
- You must be logged in to reply to this topic.