Jump to content

PHP Gravatar code


carnold

Recommended Posts

Hello all! I use wordpress for blogging and on this site i am trying to display users gravatars on the site. If users have not set a gravatar, then i would like it to show the "default" image it shows now. I am also looking to display the users name, nickname and a edit my profile link for the logged in users. Here is the code i have now but it will always show my gravatar:

<h2><?php _e('Your Gravatar'); ?></h2>

 

<?php global $userdata; get_currentuserinfo();

 

echo($userdata->first_name);

 

echo " ";

 

echo($userdata->last_name); ?>

 

 

 

 

 

<?php global $user_email;

 

get_currentuserinfo();

 

echo "<img src='";

 

echo gravatar($user_email);

 

echo "' alt='' class='gravatar' width='60' height='60' ALIGN=LEFT />";

 

?>

 

 

 

Nickname:

 

<?php global $userdata; get_currentuserinfo(); echo($userdata->user_login); ?>

 

<?php global $user_email;

 

Ooppss, here is a link to my site: http://www.mytimewithgod.net and on the left side of the page you will see "your gravatar". Thanks for any help

Link to comment
https://forums.phpfreaks.com/topic/50874-php-gravatar-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.