Title: comment_author_user_ID
Last modified: August 18, 2016

---

# comment_author_user_ID

 *  Resolved [Stevish](https://wordpress.org/support/users/stevish/)
 * (@stevish)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/comment_author_user_id/)
 * Alright, here’s my dilemma:
 * My blog is designed around a specific community and therefore all users must 
   be logged in to comment. What I want to do is add pictures (not using favatars
   or gravatars or anything that requires my computer-illiterate users to do anything
   other than upload a file) to go alongside the user’s comment. Example: when Bob
   posts I want to see Bob’s face next to the comment.
 * I have all the programming in place to be able to handle pictures there, all 
   I need is a way to distinguish which user is commenting, and add the appropriate
   picture file.
 * My first idea was use “comment_author()” in the filename, making it `<?php comment_author()?
   >.jpg`. But comment_author() can change if the user changes his/her display name,
   thus creating a link to a picture that doesn’t exist (BobSmith.jpg instead of
   Bob.jpg). Also, WordPress allows spaces in names (Bob Smith) which is not allowed
   in filenames.
 * So I was thinking that there’s gotta be a hack to add an extra tag (like comment_author_user_ID)
   that will remain constant regardless of what an individual user changes in his/
   her user settings. I just don’t know how to pull this information out, as WordPress
   is designed to be able to take comments from people with no user ID.
 * Anyone have any ideas? I’m open to anything to get these pictures to work. Any
   kind of hacking, coding or plugining is fine, as long as I can get this to work.
 * Thanks,
       -Steve

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Stevish](https://wordpress.org/support/users/stevish/)
 * (@stevish)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/comment_author_user_id/#post-280326)
 * Quick addition:
 * My average user is computer-illiterate. All I want them to have to do is provide
   me with a picture of themselves.
 *  Thread Starter [Stevish](https://wordpress.org/support/users/stevish/)
 * (@stevish)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/comment_author_user_id/#post-280786)
 * Alright, for the benefit of those who are reading this, I found the answer. I
   didn’t know how gravatars worked and assumed that they required my users to do
   something… I was wrong.
 * Basically, I hacked the crap out of the [gravatars plugin](http://www.gravatar.com/implement.php#section_2_2),
   and in the end, it boiled down to one function: md5. Basically it encrypts the
   user’s E-mail address into a long alphanumeric code that looks something like
   j47hfdjs93892hjdkhskd882j84hf49k. With that, I simply made a link to md5($comment-
   >comment_author_email).jpg (not that simply, of course, but that’s in essence
   what I had), and called it an avatar. Then I just had to write a script for users
   to upload their own pictures, and rename it to their E-mail in md5.
 * Ok, that’s about all I got right now. Sorry if it didn’t make sense, it’s been
   a long day

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘comment_author_user_ID’ is closed to new replies.

 * 2 replies
 * 1 participant
 * Last reply from: [Stevish](https://wordpress.org/support/users/stevish/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/comment_author_user_id/#post-280786)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
