Easily Display/Show a List of Recently Registered Users in WordPress

If you run a WordPress Website that enables user registration, displaying the list of recently registered users in your WordPress website is another way of making your website attractive. This JovialGuide will teach you how to easily display recently registered users in your WordPress website.

First Step

Copy and paste the following lines of code to the functions.php file available in your theme.

function wp_recently_registered_users()
{ global $wpdb; $recentusers = '<ul class="recently-user">' ; $usernames = $wpdb ->get_results ( "SELECT user_nicename, user_url, user_email FROM $wpdb- >users ORDER BY ID DESC LIMIT 5" ); foreach ( $usernames as $username ) 
{ if (! $username ->user_url) : $recentusers .= '<li>' .get_avatar( $username - >user_email, 45) . $username - >user_nicename. "</a></li>" ; else : $recentusers .= '<li>' .get_avatar( $username - >user_email, 45). '<a href="' . $username ->user_url. '">' . $username ->user_nicename. "</a></ li>" ; endif; } $recentusers .= '</ul>' ; return $recentusers ; } 

Now that you’ve added the above lines of code in the functions.php file available in your theme. It’s time to display the list of recently registered users.

Display Recently Registered Users in WordPress Template Files

If you’d like to display the recently registered users on the bottom of your WordPress website or on the sidebar of your website. Locate the footer.php or sidebar.php page template. This is available in your theme. Paste the following code snippets where you want the list to display.

<?php wp_recently_registered_users (); ?>

Display Recently Registered Users in WordPress Post & Pages

Certainly, you’ll want to display your recently registered users in your WordPress post or page. Paste the following lines of code in the functions.php file available in your WordPress theme. The below code should be placed immediately below the first code you pasted in your functions.php file.

add_shortcode('wp_newusers', 'wp_recently_registered_users'); 

Now that you’ve added the above code to the functions.php file of your theme, it’s time to display the recently registered users on your post or page. The code above creates a shortcode which you could use to easily display the list of recently registered users on your WordPress post or page. Here’s the shortcode you’ll use.

[wp_newusers]

Use the shortcode above anyway in your WordPress post or page to display your list.

See

WordPress users looking for the best WordPress web hosting provider in 2019, see top 10 best WordPress web hosting service providers in 2019

If you are looking for the best Joomla web hosting provider in 2019, we wrote a JovialGuide that shows you the top 10 best web hosting companies that offer Joomla hosting in 2019. These top 10 best Joomla web hosting service providers in 2019 offer quality Joomla website hosting services.

Magento users aren’t left behind! We also wrote a JovialGuide that lists out the top 10 best Magento web hosting companies in 2019.

Conclusion

Displaying a list of recently registered users in your WordPress website adds attraction to your website. It’s also a simple way of welcoming your new users.

If this guide is helpful to you, please do well to leave a comment.

JovialGuide

We provide comprehensive tutorials. Reach us on Facebook via JovialGuide.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Shares