WordPress: display users by registration date

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:

Don't miss business advice by email

No spam, just an email when new content is published.

Recently Registered

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 😉

Leave a Reply

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

 

What are the best (and worst) meats for healthy longevity? This is the subject of the new chapter devoted to the natural diet of ruminants, and the modifications made by humans, for better and for worse 👉 https://blooness.com/alimentation-ruminants/

Load more

Don't miss business advice by email

No spam, just an email when new content is published.

en_USEN