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:

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 😉

 

My latest tweets

New short on Blooness 👉 Exposure to blue light from screens at night could have negative effects on reproductive function, by disrupting the circadian rhythm.
https://buff.ly/4ePGVKD

New short on Blooness 👉 One of the flagship posts of the Blooness guide is available in audio format. How to achieve full vitality, lose weight or gain muscle thanks to proteins in a Mediterranean diet and moderate in carbohydrates https://b
https://buff.ly/4dvcV5C

New short on Blooness 👉 Sugars to avoid on labels: glucose syrup, raffinose, maltose, maltodextrin, sucrose, wheat dextrose, glucose syrup, processed starch, corn syrup…
https://buff.ly/47OQXtd

Load more

Don't miss business advice by email

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

Leave a Reply

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

en_USEN