Monday, November 23, 2020
Home Blogging How to Show User Registration Date in WordPress

How to Show User Registration Date in WordPress

Do you need to present the person registration date in WordPress? Usually widespread membership websites and boards show the person registration date on profile as “member since 2015”. On this article, we’ll cowl how one can present person registration date in WordPress.

The place and How You Need to Present Person Registration Date?

A few of chances are you’ll simply need to show a person’s registration date within the admin columns of the Customers web page. This provides you with a fast overview of when a person joined your web site and can help you kind by registration date.

One other utilization state of affairs is to show a person’s registration date on the ‘Edit Profile’ web page. This may permit any administrator and the person themselves to see once they joined your web site.

Final however most likely the preferred utilization state of affairs is whenever you need to show the person registration date on their public profile on the front-end of your web site.

Let’s check out how you are able to do all of them.

Including Registered Date Column on Customers Web page in Admin Space

Very first thing that you must do is set up and activate the Admin Columns plugin. Upon activation, that you must go to Settings » Admin Columns to configure the plugin.

Beneath the admin columns tab, click on on customers after which click on on add column button.

Subsequent choose ‘Registered” within the Sort drop down menu and click on on retailer updates button.

Now you can go to the customers display screen the place you will note a brand new column labeled ‘Registered’ displaying the date when a person registered in your WordPress web site.

See what different issues you are able to do to add and customise admin columns in WordPress.

Displaying Registration Date Discipline in Person Profile

For displaying registration date on the edit profile web page, you have to to add a customized plugin to your web site.

Merely create a brand new file in your pc utilizing a textual content editor like Notepad and put it aside as membersince.php in your desktop.

Subsequent open the file and paste the next code inside it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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 after which add it to your WordPress web site.

Lastly you possibly can hook up with your WordPress web site utilizing a FTP shopper after which go to /wp-content/plugins/ folder. Choose the membersince.php file out of your pc after which add it.

Now you possibly can go to your WordPress plugins web page and activate this plugin in your web site.

That’s all. Confirm all the pieces is working by enhancing a person profile on in your WordPress admin space, and you will note the person registration date.

You May Also Like : How to Move from LiveJournal to WordPress

Displaying Person Registration Date on Your Web site

On this methodology, we will probably be utilizing a easy shortcode to show any customers registration date on the front-end of your WordPress web site.

First you have to so as to add the next code in your theme’s features.php file or in a site-specific plugin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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');

Subsequent, you possibly can show a person’s registration date by merely utilizing the shortcode like this:

[membersince user=peter]

Exchange peter with the username that you simply need to present.

We hope this text helped you present registration date in WordPress person profiles. You may additionally need to see our tutorial on how one can add further person profile fields in WordPress registration.

If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

50 Best Online Jobs From Home For Students – Earn 20K PM

In latest years, the alternatives for online jobs from home for students have gained great reputation. This is as a result of many of the...

Best Answers to the Question “Why should you be hired for this Internship?”

What is the greatest approach to ace an internship interview? Especially for a more energizing who has by no means appeared for a job-related...

Does Instagram Notify You if Someone Screenshots Your Story?

When Snapchat first burst on the scene, there have been loads of individuals very completely happy concerning the prospect of sending pictures to people...

How to Change Background Color on Instagram Story

It's arduous for me to recollect Instagram earlier than the tales characteristic was launched — it is a simple possibility for sharing updates and...

Recent Comments