Do you want to show the user registration date in WordPress? Often popular membership sites and forums display the user registration date on profile as “member since 2015”. In this article, we will cover how to show user registration date in WordPress.
Where and How You Want to Show User Registration Date?
Some of you may just want to display a user’s registration date in the admin columns of the Users page. This will give you a quick overview of when a user joined your website and allow you to sort by registration date.
Another usage scenario is to display a user’s registration date on the ‘Edit Profile’ page. This will allow any administrator and the user themselves to see when they joined your website.
Last but probably the most popular usage scenario is when you want to display the user registration date on their public profile on the front-end of your website.
Let’s take a look at how you can do all of them.
Adding Registered Date Column on Users Page in Admin Area
First thing you need to do is install and activate the Admin Columns plugin. Upon activation, you need to visit Settings » Admin Columns to configure the plugin.
Under the admin columns tab, click on users and then click on add column button.
Next select ‘Registered” in the Type drop down menu and click on store updates button.
You can now visit the users screen where you will see a new column labeled ‘Registered’ showing the date when a user registered on your WordPress site.
See what other things you can do to add and customize admin columns in WordPress.
Showing Registration Date Field in User Profile
For showing registration date on the edit profile page, you will need to upload a custom plugin to your website.
Simply create a new file on your computer using a text editor like Notepad and save it as membersince.php
on your desktop.
Next open the file and paste the following code inside it.
<?php /* Plugin Name: Member Since Plugin URI: https://www.wpbeginner.com Description: Adds registration date on edit user profile screen. Version: 1.0 Author: WPBeginner */ namespace ShowMemberSince; add_action( 'plugins_loaded', 'ShowMemberSince\init' ); /** * Adding needed action hooks */ function init(){ foreach( array( 'show_user_profile', 'edit_user_profile' ) as $hook ) add_action( $hook, 'ShowMemberSince\add_custom_user_profile_fields', 10, 1 ); } /** * Output table * @param object $user User object */ function add_custom_user_profile_fields( $user ){ $table = '<h3>%1$s</h3> <table class="form-table"> <tr> <th> %1$s </th> <td> <p>Member since: %2$s</p> </td> </tr> </table>'; $udata = get_userdata( $user->ID ); $registered = $udata->user_registered; printf( $table, 'Registered', date( "M Y", strtotime( $registered ) ) ); } ?>
Save your file and then upload it to your WordPress site.
Finally you can connect to your WordPress site using a FTP client and then go to /wp-content/plugins/
folder. Select the membersince.php file from your computer and then upload it.
Now you can go to your WordPress plugins page and activate this plugin on your website.
That’s all. Verify everything is working by editing a user profile on in your WordPress admin area, and you will see the user registration date.
Showing User Registration Date on Your Website
In this method, we will be using a simple shortcode to display any users registration date on the front-end of your WordPress site.
First you will need to add the following code in your theme’s functions.php file or in a site-specific plugin.
function wpb_user_registration_date($atts, $content = null ) { $userlogin = shortcode_atts( array( 'user' => FALSE, ), $atts ); $uname = $userlogin['user']; if ($uname!== FALSE) { $user = get_user_by( 'login', $uname ); if ($user == false) { $message ='Sorry no such user found.'; } else { $udata = get_userdata( $user-ID ); $registered = $udata->user_registered; $message = 'Member since: ' . date( "d F Y", strtotime( $registered ) ); } } else { $message = 'Please provide a username.'; } return $message; } add_shortcode('membersince', 'wpb_user_registration_date');
Next, you can display a user’s registration date by simply using the shortcode like this:
[membersince user=peter]
Replace peter with the username that you want to show.
We hope this article helped you show registration date in WordPress user profiles. You may also want to see our tutorial on how to add additional user profile fields in WordPress registration.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Tom
Hello Nice code thank you but is it possible with the shortcode to show the register date of the user which actually logged in?
WPBeginner Support
For tracking user activity like logins, you would want to use a plugin like one in our article below:
https://www.wpbeginner.com/plugins/how-to-monitor-user-activity-in-wordpress-with-simple-history/
Admin
joody
this code still works today 2021-12-7, great!
WPBeginner Support
Glad the code still works!
Admin
Ralph
TYPO: There is one typo in the code in method 3 that results in the error of date always showing the same value: On line 37 is
$udata = get_userdata( $user-ID );
while it should be:
$udata = get_userdata( $user->ID );
(Notice the arrow instead of the dash)
WPBeginner Support
Thanks for pointing that out, the typo should be fixed
Admin
Dave S
Great post! I installed the plug in and now I can see when my customers subscribed to my site!!
WPBeginner Support
Thank you, glad our recommendation could help
Admin
chergui djaouida
please i need to introduce the date of registration of a user in a php code not by a shortcode how to do?
Isabelle Laplante
«Showing Registration Date Field in User Profile» costum Plugin works but do not show the real date… For every users, the added information is«Member since: Jun 2015» … Wich is not the case… Can you help?
WPBeginner Support
The code converts date into relative date. If you want to show proper date then change the line:
1-click Use in WordPress
with this
1-click Use in WordPress
Admin
Jody Hockley
Hi,
Thanks for the plugin, nice easy fix for a simple problem.
I have just used the second option to show in the User profile page. However it only show month and year, not the day. How would I alter the plugin code to show the day too?
Thanks for your help, much appreciated
Jody
Gerard
Very nice :).
I needed only first code snippet (which works).
Just one little note: on line 37 you should make it ‘$user->ID” you forgot the ‘>’, else it shows notices when debuggin.
Thank you.
Davis
Admin Columns plugin developer requires $60US to sort by registration date. If you are a site manager, find a better solution. WP should include this ultra-basic functionality in all WP installs.
Hemang Rindani
Insightful article. WordPress is the most user friendly CMS that can create complex websites with very less or no technical knowledge. It comes with rich set of modules and plugins that can transform your digital dream into a reality. However, it is important to identify the secured and authenticated tools for your WordPress website to improve the overall website security. WP is capable of handling multiple sites with multiple users which has been a requirement of big organizations. WP provides some great features to manage user accounts and prevent the website from unauthorized access using certain plugins with your website. There are also tools to enhance the user experience like the one described in the article to provide a great personal feel to the user.
Thanks for the article.
Patrick Catthoor
This looked like a feature I could use for my website. So, I tried all 3 methods.
Method 1 works like a charm, but both methods 2 and 3 always provide the same date: 01 January 1970. Something must be wrong, but I couldn’t figure out what.
Any ideas?
Celito C. Macachor
I realize this is an old issue, but I just came across this article after a recent search. Great, insightful articles, but I have the same concern as Patrick’s. In the all users list, the registration date is correct. While it is not critical, only one date (July 2016) is shown for all users in the Member since field. Has this issue been resolved? Thanks for any updated information.