X

List last five registered users

Place this PHP code anyplace within your wordpress theme and it will display the latest 5 registered member to your website.



Code Snippet:


<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>

Comments  Leave a Reply

  1. This
    is a marvelous idea. However, can you give a brief overview as to how I would
    place this into a widget area?

  2. Tweets that mention Wordpress List last five registered users – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com January 29, 2011 at 6:49 pm

    […] This post was mentioned on Twitter by HN Firehose and wp_freak, WPSNIPP. WPSNIPP said: #wordpress List last five registered users http://bit.ly/hIBhfm #blog please RT 🙂 […]

  3. WordPress list last five registered users…

    Place this code in your WordPress theme to display the last five registered users….

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!