List wordpress latest registered users

November 15, 2008 · Print This Article

If you allow user registration on your blog, listing your latest users along with their url could be a good thing to get more users.

But there’s no WordPress function to do that……

Just paste the following code anywhere on your template.

It will list your 5 latest registered users.

If you want to get more or less users, simply change the 5 in the SQL query.

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


Related articles:

Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.