Tuesday, December 3, 2013

How to display recently registered users on WordPress


 

If you allow userregistration on your WordPress blog or website, what about displaying the 5 latest registered users? Here is a simple and efficient recipe to do so.
Simply paste the code below where you want to display recently registered users. This code will display 5 users, you can change this number on line 2.


<ul class="recently-user">
<?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>' .get_avatar($username->comment_author_email, 45).'<a href="'.$username->user_url.'">'.$username->user_nicename."</a></li>";
}
?>
</ul>
 
 
 
 
 
WordPress Tutorial

A Tutorial On How To Create A Website Using Wordpress. 

Great Guide For Beginners.

 

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates