Exemplo n.º 1
0
     if (is_logged_in()) {
         // Set avatar size for logged in users in the Front-office
         $avatar_size = $Settings->get('bubbletip_size_front');
     } else {
         // Set avatar size for Anonymous users
         $avatar_size = $Settings->get('bubbletip_size_anonymous');
         $avatar_overlay_text = $Settings->get('bubbletip_overlay');
         $link_class = 'overlay_link';
     }
 }
 $width = $thumbnail_sizes[$avatar_size][1];
 $height = $thumbnail_sizes[$avatar_size][2];
 // Display user avatar with login
 // Attributes 'w' & 'h' we use for following js-scale div If image is downloading first time (Fix bubbletip)
 echo '<div class="center" w="' . $width . '" h="' . $height . '">';
 echo get_avatar_imgtag($User->login, 'login', true, $avatar_size, 'avatar_above_login', '', $avatar_overlay_text, $link_class, true, '');
 echo '</div>';
 if (!($Settings->get('allow_anonymous_user_profiles') || is_logged_in() && $current_User->check_perm('user', 'view', false, $User))) {
     // User is not logged in and anonymous users may NOT view user profiles, or if current User has no permission to view additional information about the User
     echo '</div>';
     /* end of: <div class="bubbletip_user"> */
     break;
 }
 // Additional user info
 $user_info = array();
 // Preferred Name
 if ($User->get_preferred_name() != $User->login) {
     $user_info[] = $User->get_preferred_name();
 }
 // Location
 $location = array();
Exemplo n.º 2
0
/**
 * Get avatar <img> tags for list of user logins
 *
 * @param list of user logins
 * @param if true show user login after each avatar
 * @param avatar size
 * @param style class
 * @param image align
 * @param mixed read status, Set icon of the read status, 'left'/'left_message' - if user has left the conversation ( left messsage will display different title ), TRUE - users have seen message, FALSE - users have not seen the message
 *              leave it on NULL - to not display read status icon
 * @param if true show user avatar
 * @param separator between users
 * @param boolean set true to also show deleted users with 'Deleted user' label
 * @return coma separated login <img> tag
 */
function get_avatar_imgtags($user_logins_list, $show_login = true, $link = true, $size = 'crop-top-15x15', $class = 'avatar_before_login', $align = '', $read_status = NULL, $show_avatar = true, $separator = '<br />', $show_deleted_users = false)
{
    if (!is_array($user_logins_list)) {
        $user_logins_list = explode(', ', $user_logins_list);
    }
    $user_imgtags_list = array();
    foreach ($user_logins_list as $user_login) {
        $icon = '';
        if (!is_null($read_status)) {
            // Add icon behind user login (read status)
            if ($read_status === 'left') {
                // user has left the conversation
                $icon = get_icon('bullet_black', 'imgtag', array('alt' => sprintf(T_('%s has left this conversation.'), $user_login), 'style' => 'margin:1px 4px'));
            } elseif ($read_status === 'left_message') {
                // user has left the conversation before this message
                $icon = get_icon('bullet_black', 'imgtag', array('alt' => sprintf(T_('%s has left the conversation and has not received this message.'), $user_login), 'style' => 'margin:1px 4px'));
            } elseif ($read_status) {
                // User has seen a message
                $icon = get_icon('allowback', 'imgtag', array('alt' => sprintf(T_('%s has seen this message.'), $user_login), 'style' => 'margin:0 2px'));
            } else {
                // User has not seen a message
                $icon = get_icon('bullet_red', 'imgtag', array('alt' => sprintf(T_('%s has NOT seen this message yet.'), $user_login), 'style' => 'margin:1px 4px'));
            }
        }
        if (empty($user_login)) {
            // user login is empty, we can't show avatar
            if ($show_deleted_users) {
                // show this users as deleted user
                $user_imgtags_list[] = '<span class="nowrap">' . get_avatar_imgtag_default($size, $class, $align) . '<span class="user deleted"><b>' . T_('Deleted user') . '</b></span></span>';
            }
        } else {
            $user_imgtags_list[] = '<span class="nowrap">' . $icon . get_avatar_imgtag($user_login, $show_login, $link, $size, $class, $align, '', '', $show_avatar) . '</span>';
        }
    }
    return implode($separator, $user_imgtags_list);
}