Forums

Show user info in a tooltip (1 post)

  1. jojalamic
    Member
    Posted 5 months ago #

    I whant to display user info in a tooltip. I use a jquery plugin to for the tooltip. 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>';
    }?>
    </div>

    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;
    
    }
    add_filter('user_contactmethods','new_contactmethods',10,1);

    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 tooltip so far: tooltip

Reply

You must log in to post.

About this Topic