Hello,

i'd like to know if this is possible (and if yes how :)) to display BeautyTips only on the author display name. Also inthis tooltip I'd like to add a view to display first information level about the profile (like on LinkedIn fore example). I have created a view but now I really don't see how to do this.

Thanks by advance.

François

CommentFileSizeAuthor
#4 user-infobox-popup.txt8.07 KBsoulfroys
#1 user-b.png82.38 KBsoulfroys
#1 user-c.png78.65 KBsoulfroys
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

soulfroys’s picture

Title: Is it possible to use this module for "Display Name" » User profile info/details mouseover popup (Facebook/LinkeIn like)
Component: User interface » Code
Priority: Major » Normal
FileSize
78.65 KB
82.38 KB

Hi!

I just do it for a project! I took the liberty of changing the title to help others find this thread, ok?

There must be better ways to do this (as always in Drupal), but I used the template_preprocess_user_picture function. In fact, as I use the Imagecache Profiles module and I needed to use a copy of this function that can be found in the imagecache_profile.module file. The code and css is not finalized yet, but as soon as I finish I'll post here ... :)

Secret: you must use unique names and unique selectors to work properly (.

(Sorry for my Poor english)

Great references

        if (!empty($account->uid) && user_access('access user profiles')) {
          $attributes = array('attributes' => array('title' => 'Ver perfil', 'class' => 'bt_' . $account->uid ), 'html' => TRUE);
          $image = theme('imagecache', $preset['presetname'], $picture, $alt);
          $vars['picture'] = l($image, "user/$account->uid", $attributes);

          /* USER POPUP INFO FACEBOOK LIKE */

          $image = theme('imagecache', 'usuario_foto_padrao', $picture, $alt);
          $user_picture = l($image, "user/$account->uid", $attributes);
          
          // Load profiles fields
          profile_load_profile($account);
          
          $output =  '<div id="user-profile-details">' . "\n";
          $output .= '<div>' . $user_picture . '</div>' . "\n";
          $output .= '<div>Nome: ' . check_plain($account->profile_nome) . '</div>' . "\n";
          $output .= '<div>Área: ' . check_plain($account->profile_NOME_CCUSTO) . '</div>' . "\n";
          $output .= '<div>Telefone: ' . check_plain($account->profile_telefone) . '</div>' . "\n";
          $output .= '<div>E-mail: ' . check_plain($account->mail) . '</div>' . "\n";
          $output .= '<div>Sobre mim: ' . $account->profile_sobremim . '</div>' . "\n";
          $output .= '</div>' . "\n";

          // Beautytips code
          if(module_exists('beautytips')) {
            /* UNIQUE NAME */
            $bt_name_id = 'bt_user_picture_' . $account->uid;
            /* UNIQUE SELECTOR */
            $cssSelect = 'div.picture .bt_' . $account->uid;
            $options[$bt_name_id] = array(
              'cssSelect' => $cssSelect,
              'text' => $output,
              'hoverIntentOpts' => array(
                'interval' => 100,
                'timeout' => 2000,
              ),
            );
            beautytips_add_beautytips($options);
            drupal_add_js(drupal_get_path('module', 'beautytips'). '/other_libs/jquery.hoverIntent.minified.js');
          }
          
          /* END - USER POPUP INFO FACEBOOK LIKE */

        }
        else {
          $attributes = array('class' => 'tooltipsy');
          $vars['picture'] = theme('imagecache', $preset['presetname'], $picture, $alt, $title, $attributes);
        }

User B

User A

User C

User A

FrancoisL’s picture

Hello soulfroys,

no problem for the title (your english is better than mine :)).

Thanks for this great solution I will try on my side and let you know how it is for me.

François

allvip’s picture

where should I insert this code?

soulfroys’s picture

FileSize
8.07 KB

Hi @allvip

You can insert the code in the template.php file, more details available in the following links:
- How to override a theme function (a Drupal how-to)
- Beginners guide to overriding themable output

The original code comes from Imagecache Profiles module, which I use in my project. My complete code are attached. It is not perfect, but works.

allvip’s picture

thanks but is not working for me. I inserted the code at the end of my template.php an I get this errors:

Notice: Undefined variable: preset in include_once() (line 200 of /home/allvip/public_html/sites/all/themes/responsive_bartik/template.php).
Notice: Undefined variable: picture in include_once() (line 200 of sites/all/themes/responsive_bartik/template.php).
Notice: Undefined variable: alt in include_once() (line 200 of sites/all/themes/responsive_bartik/template.php).
Notice: Undefined variable: title in include_once() (line 200 of sites/all/themes/responsive_bartik/template.php).
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in theme_get_registry() (line 277 of includes/theme.inc).
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in theme_get_registry() (line 277 of includes/theme.inc).
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in theme_get_registry() (line 277 of includes/theme.inc).

allvip’s picture

I inserted the code from user-infobox-popup.txt and nothing happens when I hover over or click a user name link.

Note.I do not use any view , just want this for my normal pages.
I did cleared the caches every time.beauty tips module is with Add beautytips js to every page checked.
I this code only for drupal 6?

soulfroys’s picture

I this code only for drupal 6?

Exactly. To make it work in D7 you need to use the core function or the Imagecache Profile function (if you need this module) as a starting point.

This code only works for user pictures, not for usernames.

soulfroys’s picture

Issue summary: View changes

just adding example

JA100685’s picture

Issue summary: View changes

does this mean that your provided code shall be inserted in "core function" user.module? sorry but i am very new to drupal and hoping you guys can help me get started

soulfroys’s picture

@JA100685
Nope... please see this: About overriding themable output

ugintl’s picture

Can you plz tell me how to use it in D7?

pifagor’s picture

Status: Active » Closed (outdated)