Area51 @ 4seven.de

Mod Base and Testarea
It is currently 23 Feb 2025, 19:40

All times are UTC + 1 hour




Post new topic TOPIC_LOCKED  [ 1 post ] 
Author Message
PostPosted: 18 Dec 2011, 22:00 
Offline
Tiptop
Tiptop
User avatar

Joined: 11 Feb 2008, 11:49
Posts: 241
Avatar everywhere

With this Snippet you can show your Avatar everywhere on Board

open

includes/functions.php

find

Code:
    // The following assigns all _common_ variables that may be used at any point in a template.
    $template->assign_vars(array(


after add

Code:
    'USER_AVATAR'                    => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),


find

Code:
 ?>


before add

Code:
/**
* Get user avatar
*
* @param string $avatar Users assigned avatar name
* @param int $avatar_type Type of avatar
* @param string $avatar_width Width of users avatar
* @param string $avatar_height Height of users avatar
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
*
* @return string Avatar image
*/
if (!function_exists('get_user_avatar')){
function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false)
{
    global $user, $config, $phpbb_root_path, $phpEx;

    if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
    {
        return '';
    }

    $avatar_img = '';

    switch ($avatar_type)
    {
        case AVATAR_UPLOAD:
            if (!$config['allow_avatar_upload'] && !$ignore_config)
            {
                return '';
            }
            $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
        break;

        case AVATAR_GALLERY:
            if (!$config['allow_avatar_local'] && !$ignore_config)
            {
                return '';
            }
            $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
        break;

        case AVATAR_REMOTE:
            if (!$config['allow_avatar_remote'] && !$ignore_config)
            {
                return '';
            }
        break;
    }

    $avatar_img .= $avatar;
    return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}}


open

includes/functions_display.php

find

Code:
function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false)
{
    global $user, $config, $phpbb_root_path, $phpEx;

    if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
    {
        return '';
    }

    $avatar_img = '';

    switch ($avatar_type)
    {
        case AVATAR_UPLOAD:
            if (!$config['allow_avatar_upload'] && !$ignore_config)
            {
                return '';
            }
            $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
        break;

        case AVATAR_GALLERY:
            if (!$config['allow_avatar_local'] && !$ignore_config)
            {
                return '';
            }
            $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
        break;

        case AVATAR_REMOTE:
            if (!$config['allow_avatar_remote'] && !$ignore_config)
            {
                return '';
            }
        break;
    }

    $avatar_img .= $avatar;
    return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}


replace with

Code:
if (!function_exists('get_user_avatar')){
function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false)
{
    global $user, $config, $phpbb_root_path, $phpEx;

    if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
    {
        return '';
    }

    $avatar_img = '';

    switch ($avatar_type)
    {
        case AVATAR_UPLOAD:
            if (!$config['allow_avatar_upload'] && !$ignore_config)
            {
                return '';
            }
            $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
        break;

        case AVATAR_GALLERY:
            if (!$config['allow_avatar_local'] && !$ignore_config)
            {
                return '';
            }
            $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
        break;

        case AVATAR_REMOTE:
            if (!$config['allow_avatar_remote'] && !$ignore_config)
            {
                return '';
            }
        break;
    }

    $avatar_img .= $avatar;
    return '<img src="' . (str_replace(' ', '%20', $avatar_img)) . '" width="' . $avatar_width . '" height="' . $avatar_height . '" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
}}


open

includes/ucp/ucp_pm_viewmessage.php

find

Code:
    if (!function_exists('get_user_avatar'))
    {
        include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    }


replace with

Code:
    //if (!function_exists('get_user_avatar'))
    //{
        include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
    //}    


Clear all Board-, Style- and Browsercaches

Now u can put the Avatar everywhere in Forum-Templates via {USER_AVATAR}

_________________
Mod-Bot / Service-Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic TOPIC_LOCKED  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.013s | 24 Queries | GZIP : Off ]