Categorized | How to, Wordpress

Tags | Wordpress

Add Latest Registered Users list in your sidebar.

Posted on 13 June 2009 by Raman

Add Latest Registered Users list in your sidebar

If you are getting a lot of user registrations and want to flaunt it, then what else can be the best than show your “Latest User Registeres” list in your sidebar.

What you have to do is just paste the following code to your sidebar -

<h2>Latest registered users</h2>
<ul>
<?php
$usernames = $wpdb->get_results(”SELECT user_nicename, user_url FROM $wpdb->users ORDER BY ID DESC LIMIT 5“);

foreach ($usernames as $username) {
echo ‘<li><a href=”‘.$username->user_url.’”>’.$username->user_nicename.”</a></li>”;
}
?>

</ul>

This will display a list of latest 5 registered users in your sidebart along with the url.

You can change the number of users in list by simply changing the number 5 (in red) in above code.

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts

Leave a Reply

Affiliate Theme Advertise Here
Advertise Here