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.

 

 

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

Be Sociable, Share!

Leave a comment