BBCodeBox3

prosilver | subsilver2

Willkommen und einen schönen Mittag, Guest  Beim nächsten Piep ist es zwischen 11:00 und 12:00 Uhr

It is currently Mon 6. May 2024, 11:33

All times are UTC + 1 hour [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
PostPosted: Mon 24. May 2010, 01:53 
Administrator
User avatar

Posts: 427

Last 3 Topics:
Tabmenu Test
[Snippet] Avatar Ev...
[DEV] Zero and X-P...

Joined:
Sun 13. Jan 2008, 23:44

Avatar Everywhere

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}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC + 1 hour [ DST ]


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:
cron
POWERED_BY
[ Time : 0.056s | 19 Queries | GZIP : Off | Board-Version: 3.0.7 PL1 ]