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?


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 ) );
| 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

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

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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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