Open includes/functions.php
Find (around line 3880):
- Code: Select all
// Which timezone?
$tz = ($user->data['user_id'] != ANONYMOUS) ? strval(doubleval($user->data['user_timezone'])) : strval(doubleval($config['board_timezone']));
After, add:
- Code: Select all
// Adding Avatar Variable
$avatar_img = '';
if ($user->data['user_avatar'])
{
switch ($user->data['user_avatar_type'])
{
case AVATAR_UPLOAD:
$avatar_img = $phpbb_root_path . $config['avatar_path'] . '/';
break;
case AVATAR_GALLERY:
$avatar_img = $phpbb_root_path . $config['avatar_gallery_path'] . '/';
break;
}
$avatar_img .= $user->data['user_avatar'];
$avatar_img = '<img src="' . $avatar_img . '" width="' . $user->data['user_avatar_width'] . '" height="' . $user->data['user_avatar_height'] . '" alt="" />';
}
Next, find (should be pretty close to where you already are):
- Code: Select all
'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit),
After it, add:
- Code: Select all
'AVATAR' => $avatar_img,
It's that simple. And to add it to a template, just type in {AVATAR} and it will show up. However, it is suggested that you use
- Code: Select all
<!-- IF S_USER_LOGGED_IN -->{AVATAR}<!-- ENDIF -->
because users not logged in will not have an avatar.












