The answer from @Ralf912 (the second 'here' in my comment!) is all you need/want.
This little function should help you out:
(please make a backup of functions.php
before adding this code snippet in that file.
/**
* Display Members registration year
*
* @author @Ralf912
* @return date(year)
* @uses echo do_shortcode( '[memberSince]' );
*
* @version Wordpress 4.6.1
*/
add_shortcode( 'memberSince', 'wpse241751_display_year' );
function wpse241751_display_year(){
$users = get_users();
foreach( $users as $user ) {
$udata = get_userdata( $user->ID );
$registered = $udata->user_registered;
printf( 'Member since %s<br>', date( 'Y', strtotime( $registered ) ) );
}
}
You can use now the following shortcode [memberSince]
for explample in a template you can add: echo do_shortcode( '[memberSince]' );
this will display(example): Member since 2016
To add also a month you could change in that function date( 'Y',
into date( 'M Y',
.
Please read also Codex info about: get_userdata and get_users
Last edit/update
There is also a way to display the outcome by adding the code directly in a Template by using the following snippet.
$users = get_users();
foreach( $users as $user )
{
$udata = get_userdata( $user->ID );
$registered = $udata->user_registered;
printf( 'Member since %s<br>', date( 'Y', strtotime( $registered ) ) );
}
Be aware that you have to remove the shortcode from the template and that when using this approach the function is useless and therefore also should be removed from functions.php
.