1

Topic: Show avatar...

Im wondering where to find or how to show the logged in users avatar on frontpage?

I have tried in the faq about integration but it wont work, i also looked around in viewtopic but im not so good at php so i dont know
how to show the avatar, so please help me big_smile

2

Re: Show avatar...

You want to show all avatars of all logged in users on the frontpage?

Do this:
index.php, line 182:

$result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

change to

  $result = $db->query('SELECT o.user_id,u.use_avatar, ident FROM '.$db->prefix.'online o,  '.$db->prefix.'users u WHERE u.id=o.user_id and idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

Go to line 186

if ($pun_user_online['user_id'] > 1)
$users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';

replace with

 
    {
    if ($pun_config['o_avatars'] == '1' && $pun_user_online['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
      {
      if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$pun_user_online['user_id'].'.gif'))
        $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$pun_user_online['user_id'].'.gif" '.$img_size[3].' alt="" />';
      else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$pun_user_online['user_id'].'.jpg'))
        $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$pun_user_online['user_id'].'.jpg" '.$img_size[3].' alt="" />';
      else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$pun_user_online['user_id'].'.png'))
        $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$pun_user_online['user_id'].'.png" '.$img_size[3].' alt="" />';
       }
     $users[] = "\n\t\t\t\t".'<dd>'.$user_avatar.'<a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';    
  }

But it looks really ugly I think.....

The German PunBB Site:
PunBB-forum.de

Re: Show avatar...

I agree.....

Go Canada! - No matter what, except when Stephen Harper is Prime Minster!
NHL is back, GO TORONTO MAPLE LEAFS! even if they lose...
[Firefox Rules!] - [Amazing Race] - [My Site!]

4

Re: Show avatar...

This solution sorta works for me. Only .jpg though.