Show user registration date

This topic contains 4 replies, has 3 voices, and was last updated by  Fulvio Di Stefano 3 years, 11 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #8042

    Fulvio Di Stefano
    Free User
    Post count: 134

    I want to show the date/year when a user registered to my site in the author box, can it be done out of the box with this plugin, if not, any quick tip?

    #8046

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    we don’t have a shortcode for that at this time, but I will take that up as a suggestion for the developers to consider adding to a future version.

    In the meantime I will ask the developers to comment here in case they know of a quick workaround.

    #8059

    Fulvio Di Stefano
    Free User
    Post count: 134

    Great, I will appreciate quick fix (snippet) thanks

    #8060

    Patrik
    Moderator
    Post count: 1971

    Hi,

    Go to UsersWP->General->Author box->Author box Content (bootstrap) and put [#user_registered#] in the content where you need and then try adding following code in functions.php file of your currently active theme or via Code Snippets plugin and let me know if it works or not:

    add_filter('uwp_author_box_output', 'uwp_author_box_output_cb', 10, 1);
    function uwp_author_box_output_cb($output){
    	global $post;
    
    	if(!$post){
            return $output;
        }
        
    	$author_id = $post->post_author;
    	$user = get_user_by('id', $author_id);
    	$key = '[#user_registered#]';
    	$value = date("M Y", strtotime($user->user_registered));
    	$output = str_replace( $key, $value, $output );
        return $output;
    }

    This is the way to create and use your own custom tag for the author box. You will find more tags you can use in your author box content.

    Regards,
    Patrik

    #8064

    Fulvio Di Stefano
    Free User
    Post count: 134

    Hey Patrick, it works, great

Viewing 5 posts - 1 through 5 (of 5 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket