Family Encyclopedia >> Electronics

How to display user registration date in WordPress

Do you want to display the user registration date in WordPress? Popular membership sites and forums often display the user's registration date in the profile as "member since 2015". In this article, we will cover how to display user registration date in WordPress.

How to display user registration date in WordPress

Where and how do you want to display the user registration date?

Some of you may 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 her 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's registration date on their public profile on the front end of your website.

Let's take a look at how you can make them all.

Add a registered date column on the users page in the admin area

The 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.

How to display user registration date in WordPress

Under the Admin Columns tab, click Users and then click the Add Column button.

Next, select 'Registered' from the Type dropdown menu and click the Store Updates button.

You can now visit the users screen, where you will see a new column labeled 'Registered' showing the date a user registered on your WordPress site.

How to display user registration date in WordPress

See what other things you can do to add and customize admin columns in WordPress.

Show the registration date field in the user's profile

To display the registration date on the edit profile page, you will need to upload a custom plugin to your website.

Just create a new file on your computer using a text editor like Notepad and save it as membersince.php on your desk.

Then open the file and paste the following code inside it.

 % 1 $ s 
% 1 $ s

Miembro desde:% 2 $ s

'; $ 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 an FTP client and then go to / wp-content / plugins / binder. Select the membersince.php file from your computer and then upload it.

You can now go to the WordPress plugins page and activate this plugin on your website.

That is all. Verify that everything is working by editing a user profile in your WordPress admin area, and you will see the user's registration date.

How to display user registration date in WordPress

Show user registration date on your website

In this method, we will use a simple shortcode to display any user's registration date on the front end of your WordPress site.

You'll first need to add the following code to your theme's functions.php file or a site-specific plugin.

 función wpb_user_registration_date ($ atts, $ content = null) $ userlogin = shortcode_atts (array ('user' => FALSE,), $ atts); $ uname = $ userlogin ['usuario']; if ($ uname! == FALSE) $ user = get_user_by ('login', $ uname); if ($ usuario == falso) $ mensaje = 'Lo sentimos, no se encontró tal usuario.'; else $ udata = get_userdata ($ user-ID); $ registered = $ udata-> user_registered; $ message = 'Miembro desde:'. fecha ("d F Y", strtotime ($ registrado)); else else $ message = 'Por favor ingrese un nombre de usuario.'; devolver $ mensaje; add_shortcode ('membersince', 'wpb_user_registration_date'); 

You can then display a user's registration date simply by using the shortcode like this:

[miembrosdesde usuario = peter]

Replace Peter with the username you want to display.

We hope this article has helped you to display the 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 enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.