shortcode – wpv-user-reg-date
The shortcode [wpv-user field=”user_registered”] displays the registration date of a WP User, but it doesn’t accept the “format” attribute, so the result is always Y-m-d G:i:s (ex: 2019-09-28 13:17:08).
It is possible to use a custom shortcode to change the date format and display, for example, “User since SEPTEMBER 2019”:
// wpv-user-reg-date shortcode
add_shortcode( 'wpv-user-reg-date', 'format_reg_date_func');
function format_reg_date_func($atts)
{
$user_id = $atts['userid'];
$format = $atts['format'];
$reg_date = date($format, strtotime(get_userdata($user_id)->user_registered));
return $reg_date;
}
Then I can use this shortcode anywhere passing the “format” attribute:
[wpv-user-reg-date userid="" format="m/d/Y"]
You can find this solution on this Toolset forum thread:
https://toolset.com/forums/topic/formatting-the-output-of-user_registered-shortcode/
