Latest Tech and Tips

How to Display Recently Registered Users in WordPress

8

For multi-user WordPress websites, you might desire to display your users on various areas of your internet site. For instance, you can display a checklist of writers with characters, or include a writer details box, and so on In this tutorial we will certainly reveal you how to display recently registered usersin WordPress These users do not require to be writers. It can be made use of for an area website that enables individual enrollment.

First point you require to do is duplicate as well as paste the adhering to code in your style’s functions.php data or in a site-specific plugin.


feature wpb_recently_registered_users() {

international $wpdb;.

$ recentusers='<< ul course ="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.= '<';.

return $recentusers;.
}

Now you can display the users on your website by utilizing the adhering to layout tag in your style's layout data such as sidebar.php, footer.php etc:

<