How To Display Recently Registered Users In WordPress
How To Display Recently Registered Users In WordPress 

Do you want to find out who has just joined WordPress?

In the case of multi-user WordPress, you may want to show newly registered users on your website in order to persuade more people to join up for an account. You may wish to highlight your recently registered users on your site from time to time to foster a feeling of community and urge others to join, join your forum, or establish an account.

In this article, we’ll teach you how to showcase newly registered users on your WordPress site. But first, let’s go through the fundamentals.

You can watch the video tutorial below for this article:

Who are the recently registered users?

A registered user is someone who has already signed up for a website, app, or other system. To establish their identity, registered users often offer some form of credentials (such as a username or e-mail address, as well as a password) to the system: this is known as logging in. 

The recently registered users are the ones who have registered into your website just a short while back. They are usually displayed on the opening of your website to show new users that you have loyal users as well which helps in the business aspect.

Now, let’s go forward with the steps to display the recently registered users in WordPress.

  • First, login and go straight up to your WordPress dashboard.
  • Hover on to Appearance.
  • Then, go ahead and click on Theme Editor
How To Display Recently Registered Users In WordPress 

Further, at the right-hand facet of the display you’ll see Theme Functions. Click on it.

How To Display Recently Registered Users In WordPress 
  • Now, go and scroll down to enter the following small piece of code:

NOTE: Before making any code-related changes, it is suggested to have a backup of your website JUST IN CASE anything goes wrong, then you can at least restore it afterwards.

Code:

function wpb_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;  

}
How To Display Recently Registered Users In WordPress 

Once you are done copy pasting this code, click on the Update File option that you’ll see below. 

Now that the file has been updated, you may show the users on your website by utilising the Template Tag in your Theme Template Files such as sitebar.php, footer.php, and so on.

You may use a Shortcode to showcase newly registered users on a certain page without having to create a page design. The steps for that are the following:

  • Click on Widget
How To Display Recently Registered Users In WordPress 

  • From the list of widgets, drag and drop the text widget to the sidebar.
  • In the Title box, go ahead and type whichever title you wish to keep. 
  • Now, finally, you have to go right ahead and enter the following code:

‘Wpb_newusers’

How To Display Recently Registered Users In WordPress 
  • Once you’ve successfully added this code, click on the Save button.

After you’ve saved this code, you can go to your website and you’ll see the list of recently registered users. 

Also Read: How To Add Animated GIFs In WordPress

0 Comments

Submit a Comment

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

Need Professional Help?

We can help you with website fixes and ongoing maintenance.