Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there any way to display a user's (registered) registration date on the comment.

Lets say i have a written an article, registered users A, B, C and D left a comment on my article.

I can display comment date, commenter's name and email by default .

I want to display the commenter's registration date also.

How can this be done?

share|improve this question
add comment

2 Answers

In your wp_list_comments callback function, you can call get_userdata to get any additional comment author data:

$userdata = get_userdata( $comment->user_id );
echo 'Registered: ' . $userdata->user_registered;

// format the date
// Sunday January 13th 2013
echo 'Registered: ' . date( 'l F jS Y', strtotime( $userdata->user_registered ) );
share|improve this answer
    
It works ,,, thanks , but how do i display only the date. 2011-06-03 06:21:49 , i want to remove the time ... –  pradip Jan 13 '13 at 8:07
    
I tried using ... <strong class="timestamp"> </strong> but changes to last year instead of the date ! –  pradip Jan 13 '13 at 8:10
    
@pradip see php's date and strtotime to format the date. –  Milo Jan 13 '13 at 16:29
    
Many Thanks ! It works perfectly ! –  pradip Jan 13 '13 at 17:17
add comment

All the information you need is in the user Object pulled by get_user_by.

$user = get_user_by('login','login-name');
var_dump($user);

The information may already be available though. Check your theme carefully to see what information has already been pulled.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.