Tulip Media

Entrepreneurial thoughts

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 shorts on Blooness 👉 Training dedicated to the best oilseeds for health is finally available in audio format https://buff.ly/3xo9fTS
https://buff.ly/43DkrYR

New shorts on Blooness 👉 If there was only one supplement to take, it would be magnesium (along with vitamin D). The complete guide to the best multivitamins on the market still available here with free access https://buff.ly/49bHqvp
https://buff.ly/49c3rKK

New shorts on Blooness 👉 The latest Blooness training on #proteins is available in audio format https://buff.ly/4aijbMW
https://buff.ly/3TP67cB

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