How to Show Recently Registered Users in WordPress

If you’re using WordPress, you already know that you can allow your visitors to register and become a part of your community. Although WordPress asks users to register and login with usernames, you can easily change that and allow anyone to use their email address for registration/login purposes instead.

After you allow visitors to register, you may grant them different things on your website which an average visitor can’t have access to. For example, registered users can feel more like home when commenting on your posts or you can give them exclusive materials to download.

After some time of hard work, you might end up having more than just a few registered users on your WordPress powered website. Hopefully, new users will be registering daily and that’s just the right time to show a list of registered users somewhere on the site.

In this short tutorial, we are going to show you how to:

Show recently registered users by using a code

If you place a widget or designate a certain section of the homepage to display recently registered users, it might actually help you attract even more people. A simple list of few of the last registered users will show how active your site really is. To make everything even better, you can easily show a user’s avatar next to their username. So, if you have decided it’s time to show the list, here’s how you can do that manually:

  1. Open functions.php file
  2. Copy and paste the following code:
  3. function 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 3");
    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>";
    $recentusers .= '</ul>';
    return $recentusers;
  4. Save changes

Now you have prepared the turf for showcasing your recently registered users. If you take a closer look at the code, you will find that the 4th line is a place to define a number of users which will be displayed on the list. You are free to change the number to any number you want but we feel 3-5 is the best choice to go with.

But you’re still not done here. The function is added to your functions.php file and now you have to display it somewhere on your site.

Probably the easiest way to do that is to create a shortcode which you can put in your posts, pages or a widget:

  1. Open functions.php file
  2. Copy and paste the following code:
  3. add_shortcode('recent_registered', 'recently_registered_users');
  4. Save changes
  5. Use [recent_registered] shortcode anywhere you want to display the users

If you want to display new users in your templates, your header or footer, for example, you can do that with the following code:

<?php recently_registered_users(); ?>

Or you can execute the shortcode you have already created:

<?php echo do_shortcode('[recent_registered]'); ?>

That’s it. Now you have your 3 latest registered user displayed on your site. You can further style the code to make the list look better and to match your site’s design.

If you’re not into coding, let us show you how to display recently registered users with a plugin.

Show recently registered users with a plugin

Displaying a few of the last registered users on your website might have more benefits than you think. And it might look really cool if the list gets changed every day or even every few hours. That’s how you show that your content is really interesting to others and you might actually attract more people to your site by showing how many people have already registered.

As usual, everything in WordPress can be done through coding or through a plugin which already contains the code you don’t even have to see. In this part, we will show you a simple plugin which can do the job for you.

Display Recently Registered Users


Display Recently Registered Users

After you install Display Recently Registered Users plugin, it will create a widget for you and display the information about latest users. You can easily customize date format, Gravatar, choose the number of registered users which will be shown in the widget and there is a neat CSS class wrapper which will help you customize the looks of your widget.

This free plugin is relatively simple to install and setup:

  1. Navigate to Plugins->Add New
  2. Find “Display Recently Registered Users” plugin
  3. Install it and activate
  4. Go to Appearance->Widgets
  5. Search for “Display Recently Registered Users” widget and drag and drop it on the sidebar, footer or wherever you want the widget to appear
  6. Now you will have a few options which will help you set up the widget:

    Title: Write the title of your widget which will appear on top (default: Welcome new users)
    Show User Name: choose if you want to show username or not
    Show Join Date: choose if you want to show the date when that user has registered to your site
    Show Gravatar: choose if you want to show user’s gravatar image
    Hyperlink Gravatar: choose this option if you want the gravatar image to link to user’s URL if one exists
    Number of users to show: Type in the number of users which will be shown on the list (default: 5)
    Text before date: Type in the text you want to appear before the join date (default: Joined on)
    Date (PHP) format: Choose how you want to display the date in PHP format
    Gravatar size: choose the size of Gravatar image in pixels (default: 45; max: 512)
    CSS Class name: type in CSS class which will control the look of your recently registered users list
  7. Don’t forget to save the changes

That’s it. As you can see, everything is really easy to setup and will look good on your site. Have you installed the plugin? Leave a link and show us how the list looks like on your website.

Summing up

Displaying the list of the last registered users can be beneficial for those sites that tend to get many new users on a daily basis. The list can help you showcase the activity and popularity of your blog, and it’s nice that you can get one quite easily. If you have such a site, take your time and style the list so it matches your site perfectly.

On the other hand, if you only get a few new users per month, think twice about implementing the code or installing the plugin.

Start Blog Book


This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

One thought on “How to Show Recently Registered Users in WordPress

  1. I have an education website that provides national exam’s routine, results & many more education resources. A lot of students have registered on my website but I never think of recently registered users & showing it on my site. Now I know, It can be a brilliant idea to attract more students to be registered on my site. So, I am going to try this code & display the recently registered users on my website. I am not expert in WordPress, I hope I will get your help if I need to do this properly.

Leave a Reply

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