Here is a very useful WordPress extension for those who manage WordPress sites with regularly registered members – particularly under BuddyPress – and who need to see who the latest registered members are.
Indeed, the users page in the WordPress dashboard displays a list in alphabetical order, and it is not easy to see the latest registered users at a glance.
Fortunately, a developer working for DreamHost had the good idea to develop a plugin to display the latest subscribers to your WordPress / BuddyPress site:
A very practical extension, certainly, but it is even more so with this little piece of code that I am going to share with you, and which you will need to put in your functions.php file. Indeed, with the extension, you will be able to see the latest registered on your WordPress by clicking in the “Registered” column. But this is something you will have to do every time.
So to display members by registration date by default, here is the code to insert in functions.php:
[coded]
/**
* SHOW RECENT USERS BY DEFAULT. COMPLEMENTARY SNIPPET TO THE RECENTLY REGISTERED PLUGIN!
*/
add_action( 'pre_user_query', 'tgm_order_users_by_date_registered' );
function tgm_order_users_by_date_registered($query) {
global $pagenow;
if ( ! is_admin() || 'users.php' !== $pagenow || isset( $_GET['orderby'] ) ) {
return;
}
$query->query_orderby = 'ORDER BY user_registered DESC';
}
[/coded]
If this feature helped you, don't hesitate to let me know in the comments and by sharing the article! See you soon for new news 😉