[Tutorial] Adaugare Avatar in [ Five Top MOD]

Locked
User avatar
Sorin.
Membru
Membru
Posts: 1128
Joined: 8 years ago
Location: 127.0.0.1
Has thanked: 0
Been thanked: 0
Zodiac:
Age: 23
Contact:
Status: Offline

7 years ago

Acest snippet permite MODificarii Top Five sa arate avatarul celui care a scris in subiect.

Deschideti includes/top_five.php
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
Cauta :

Code: Select all

global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template;

Adauga dupa :

Code: Select all

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

Code: Select all

Cauta :

Code: Select all

'SELECT'   => 'u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name',

Inlocuieste cu :

Code: Select all

'SELECT'   => 'u.user_id, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, t.topic_title, t.forum_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name',

Cauta :

Code: Select all

$is_guest = $row['user_id'] != ANONYMOUS ? false : true;
Adauga dupa :

Code: Select all

$user_avatar = ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '';

Cauta :

Code: Select all

'TOPIC_TITLE'    => $user->lang['IN'] . ' ' . $topic_title));

Inlocuieste cu :

Code: Select all

'TOPIC_TITLE'    => '<span style="float: left; margin-right: 8px;">' . $user_avatar . '</span>' . ' ' . $user->lang['IN'] . ' ' . $topic_title));

STERGE :

Code: Select all

 // cache this data for ever, cache is purged when adding or deleting users
      $cache->put('_top_five_newest_users', $newest_users);

Cauta :

Code: Select all

SELECT user_id, username, user_colour, user_regdate
Inlocuieste cu :

Code: Select all

SELECT user_id, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height,  username, user_colour, user_regdate
Cauta :

Code: Select all

     $newest_users[$row['user_id']] = array(
            'user_id'            => $row['user_id'],
            'username'            => $row['username'],
              'user_colour'         => $row['user_colour'],
                'user_regdate'         => $row['user_regdate'],

Adauga dupa :

Code: Select all

'user_avatar'      => $row['user_avatar'],
            'user_avatar_type'   => $row['user_avatar_type'],
            'user_avatar_width'   => $row['user_avatar_width'],
            'user_avatar_height'   => $row['user_avatar_height'],

Cauta :

Code: Select all

 'REG_DATE'         => $user->format_date($row['user_regdate']),
         'USERNAME_FULL'      => $username_string)
Adauga inainte :

Code: Select all

'USER_AVATAR'      => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
            'USER_AVATAR_THUMB'   => ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="http://i.epvpimg.com/Qg3Pd.gif" width="25px;" height="25px;" alt="" />',

Cauta :

Code: Select all

SELECT user_id, username, user_colour, user_posts
Inlocuieste cu :

Code: Select all

SELECT user_id, user_avatar, user_avatar_type, user_avatar_width, user_avatar_height, username, user_colour, user_posts
Cauta :

Code: Select all

$user_posts[$row['user_id']] = array(
            'user_id'      => $row['user_id'],
                'username'      => $row['username'],
                'user_colour'   => $row['user_colour'],
            'user_posts'    => $row['user_posts'],

Adauga dupa :

Code: Select all

'user_avatar'      => $row['user_avatar'],
            'user_avatar_type'   => $row['user_avatar_type'],
            'user_avatar_width'   => $row['user_avatar_width'],
            'user_avatar_height'   => $row['user_avatar_height'],

Caută:

Code: Select all

'S_SEARCH_ACTION'   => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
         'POSTS'          => $row['user_posts'],
         'USERNAME_FULL'      => $username_string)

Adauga inainte :

Code: Select all

'USER_AVATAR'      => get_user_avatar($data['user_avatar'], $data['user_avatar_type'], $data['user_avatar_width'], $data['user_avatar_height']),
            'USER_AVATAR_THUMB'   => ($row['user_avatar']) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], ($row['user_avatar_width'] > $row['user_avatar_height']) ? 25 : (25 / $row['user_avatar_height']) * $row['user_avatar_width'], ($row['user_avatar_height'] > $row['user_avatar_width']) ? 25 : (25 / $row['user_avatar_width']) * $row['user_avatar_height']) : '<img src="http://i.epvpimg.com/Qg3Pd.gif" width="25px;" height="25px;" alt="" />',

Deschideti top_five_body.html

Cauta :

Code: Select all

<td valign="top"><!-- BEGIN top_five_topic --><!-- IF top_five_topic.NO_TOPIC_TITLE-->{top_five_topic.NO_TOPIC_TITLE}<!-- ELSE --><a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a><br />&nbsp;&nbsp;{top_five_topic.USERNAME_FULL}&nbsp;&nbsp;{top_five_topic.LAST_TOPIC_TIME}<br /><!-- ENDIF --><!-- END top_five_topic --></td>
               <td valign="top"><!-- BEGIN top_five_active -->{top_five_active.USERNAME_FULL}<br />&nbsp;&nbsp;{L_POSTS}: <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a><br /><!-- END top_five_active --></td>
               <td valign="top"><!-- BEGIN top_five_newest -->{top_five_newest.USERNAME_FULL}<br />&nbsp;&nbsp;{L_JOINED}: {top_five_newest.REG_DATE}<br /><!-- END top_five_newest --></td>

Inlocuieste cu :

Code: Select all

<td valign="top"><!-- BEGIN top_five_topic --><div style="margin-top: 3px"><!-- IF top_five_topic.NO_TOPIC_TITLE-->{top_five_topic.NO_TOPIC_TITLE}<!-- ELSE --><a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a><br />{top_five_topic.USERNAME_FULL}&nbsp;{top_five_topic.LAST_TOPIC_TIME}<br /></div><!-- ENDIF --><!-- END top_five_topic --></td>
                   <td valign="top"><!-- BEGIN top_five_active --><div style="margin-top: 3px"><span style="float: left; margin-right: 8px;">{top_five_active.USER_AVATAR}&nbsp;{top_five_active.USER_AVATAR_THUMB}</span>{top_five_active.USERNAME_FULL}<br />{L_POSTS}: <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a><br /></div><!-- END top_five_active --></td>
                   <td valign="top"><!-- BEGIN top_five_newest --><div style="margin-top: 3px"><span style="float: left; margin-right: 8px;">{top_five_newest.USER_AVATAR}&nbsp;{top_five_newest.USER_AVATAR_THUMB}</span>{top_five_newest.USERNAME_FULL}<br />{L_JOINED}: {top_five_newest.REG_DATE}<br /></div><!-- END top_five_newest --></td>
» Previzualizare :

Image

Părere buna
Locked

Return to “Tutoriale”