WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I whant to display user info in a hovercard. I use a jquery plugin to for the hovercard. I call my file like this <?php include 'includes/tooltip.php'; ?> and this is my code from tooltip.php.

<div class="tip-info">
<?php if ($comment->user_id) {$userdata=get_userdata($comment->user_id); 
echo '<span>'. $userdata->display_name . '</span>';
echo '<span>'. $userdata->user_description .'</span>';
echo '<span>'. $userdata->twitter.'</span>';
echo '<span>'. $userdata->facebook .'</span>';
echo '<span>'. $userdata->google .'</span>';  

I use this code for extra fields in user profile google twitter etc..

function new_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter'; // Add Twitter
$contactmethods['facebook'] = 'Facebook'; // Add Facebook
$contactmethods['google'] = 'google'; // Add google
unset($contactmethods['yim']); // Remove YIM
unset($contactmethods['aim']); // Remove AIM
unset($contactmethods['jabber']); // Remove Jabber
return $contactmethods;


The problem is with guests, their name is not displayed and the twitter, google, facebook fields are displayed for all users even for guest. Can any one tell me is my approach good. Is there another way to retrive user info ?

This is a photo whith the hovercard and what I whant to achive. Tip info

share|improve this question

closed as too localized by toscho Mar 2 '13 at 23:38

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Is this question still relevant? – toscho Feb 18 '13 at 23:54

Jetpack for Wordpress has hover cards for authors with gravatars. You could check for presence of data before echoing out the icon.

share|improve this answer
Yes but all users from my site have to make a gravata account, and this is not my interest. – Joj Ala Dec 10 '11 at 19:02

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