Skip to main content
1 of 4
xLRDxREVENGEx
  • 1.2k
  • 1
  • 15
  • 24

get_user_meta Short Profile Section

Ok so i have added a custom field into the users edit profile page where they can add a link to a url of an image they want. I am currently using this for contribitors and above but i also have a small little profile box on my site that gets a users avatar from gravatar. I used the code from before but changed it around to get the current signed on users authorpic or get the gravatar. See code below

$profilepic = get_user_meta('author_pic');
$imgtagbeg = ('<img style="height:52px; width:52px" src="');
$imgtagend = ('"/>');
    if ($profilepic)
        echo $imgtagbeg,$profilepic,$imgtagend; 
    else
        echo get_avatar( $user_email, '52', $default = 'http://www.gravatar.com/avatar.php?gravatar_id=$md5&size=80&default=$default' );

What i want to do is if the current user signed in has a avatar linked in his profile field then use that instead of gravatar. But if the author does have a gravatar and has left the field blank in the profile use that or get the default gravatar

xLRDxREVENGEx
  • 1.2k
  • 1
  • 15
  • 24