Sostituire il nome utente con l'avatar nella lista utenti Online

Area dedicata alle Guide
Regole del forum
Immagine
Rispondi
Avatar utente
Galandas
Staff phpBB3World
Staff phpBB3World
Messaggi: 792
Iscritto il: 4 nov 2012, 9:18
Località: phpbb3world
Contatta:

Sostituire il nome utente con l'avatar nella lista utenti Online

Messaggio da Galandas » 9 dic 2016, 22:43

Sostituire il nome utente con l'avatar nella lista utenti Online

1. in include/functions.php
Cerca:

Codice: Seleziona tutto

?>
Aggiungi prima:

Codice: Seleziona tutto

    function get_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR')
    {
        global $user, $config, $phpbb_root_path, $phpEx;

        if (empty($avatar) || !$avatar_type)
        {
            return '';
        }

        $avatar_img = '';

        switch ($avatar_type)
        {
            case AVATAR_UPLOAD:
                $avatar_img = $phpbb_root_path . "download/file.$phpEx?avatar=";
            break;

            case AVATAR_GALLERY:
                $avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
            break;
        }

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

Codice: Seleziona tutto

$sql = 'SELECT username, username_clean, user_id, user_type, user_allow_viewonline, user_colour
Sostituirli con:

Codice: Seleziona tutto

$sql = 'SELECT username, username_clean, user_id, user_type, user_allow_viewonline, user_colour, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height
Versione solo avatar (tranne gli utenti senza)
Cerca:

Codice: Seleziona tutto

$user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
                            $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
Sostituirli con:

Codice: Seleziona tutto

                        $user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);

                        if(!$item_id)
                        {
                            $user_online_profile = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'profile' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
                            $user_online_full = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
                            $avatar = ($row['user_avatar']) ? get_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 50 : (50 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 50 : (50 / $row['user_avatar_width']) * $row['user_avatar_height']) : $user_online_link;
                            if($row['user_avatar'])
                            {
                                $user_online_link = '<a href="'.$user_online_profile.'">'.$avatar.'</a>';
                            }
                        }
                        
                        $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
Avatar && versione nome utente (ad eccezione degli utenti che non ce l'hanno): apportare la prima modifica sopra, e per il secondo, Sostituire con:

Codice: Seleziona tutto

$user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);

                        if(!$item_id)
                        {
                            $user_online_profile = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'profile' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
                            $user_online_full = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
                         $avatar = ($row['user_avatar']) ? get_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 50 : (50 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 50 : (50 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';
                        if(!$item_id)
                        {
                            $user_online_link = $avatar.$user_online_link;
                        } 
                        }
                        
                        $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
Menu Forum ha scritto:

Rispondi

Torna a “[3.0.x] Guide”

Chi c’è in linea

Visitano il forum: Nessuno e 5 ospiti