- This topic has 1 reply, 1 voice, and was last updated 14 years, 4 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eMember › Way to call member profile image with php?
Hi… as the title suggests, I’m trying to use each member’s profile image in the comments_template.php.
So far, I have this… for some reason, the file_exists wasn’t working, and I’m currently at this ghetto solution:
$user_info = get_userdata($comment->user_id);
$em = $comment->user_id + 4;
if($comment->user_id<50000000) {
echo ‘<img class=”emem_profile_image” src=”http://www.mmocheatsplus.com/wp-content/uploads/emember/’ . $em . ‘.jpeg” width=64 height=64 />’;
}
else {
echo ‘<img class=”emem_profile_image” src=”http://www.mmocheatsplus.com/wp-content/plugins/wp-eMember/images/default_image.gif” width=64 height=64 />’;
}
But as you could have guessed, the else is never firing because everyones user id is less then that huge number… I just had to put some sort of conditional to keep this same idea of code, even though I know it’s not necessary.
Like I said above, for some reason the file_exists isn’t checking properly, and I couldn’t find a solution on the internet. I must have tried this 5+ times, all making sure there weren’t any typos. I even did absolute paths, and it wasn’t finding a file that was for sure there.
The original code I got from the emember_misc_functions.php file where it uses code to check for existance of the actual emember user id and if it has a .gif, .jpg, etc, then use that url for the image to display in the profile.
Like I said, mine is a makeshift version of that, and I even used a simple +4 addition to the commenters WordPress user ID, since through testing, my user IDs and WP ids are off by 4.
Anyways… is there a simple way to properly call the profile image, and if the user hasn’t uploaded one, display the default?
Thanks.
Nevermind… I found a solution that uses the old code and all is well in the world again.