MyBB Community Forums
Add avatars to index Who's Online list of names - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Tutorials (https://community.mybb.com/forum-38.html)
+--- Thread: Add avatars to index Who's Online list of names (/thread-225825.html)



Add avatars to index Who's Online list of names - Skyon Archer - 2019-12-25

I haven't seen this so I thought I'd share it.  If it's already been posted by someone else, please disregard.

   
click image for larger view

Go to Forum root and edit index.php

Search for (line 61):
SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.username, u.invisible, u.usergroup, u.displaygroup

Change to this:
SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.username, u.invisible, u.usergroup, u.avatar, u.displaygroup

-------------

Search for (line 78):
$botkey = my_strtolower(str_replace('bot=', '', $user['sid']));

After, add this:
if($user['avatar']){
     $avatar = $user['avatar'];
}else{
     $avatar = 'images/default_avatar.png';
}
if($spiders[$botkey]['name']){
     $avatar = "images/online/".strtolower($spiders[$botkey]['name']).".png";
}

Save your changes.

Please save your bot avatars in a folder named "online" within the "images" folder.  These images should match the name you have identified in your Administrative Control Panel > Configuration > Spiders/Bots list.

For example, if I named a bot "Google", the image should be named "google.png"

-------------

Now, in your template "index_whosonline_memberbit" . . .

Change it from this:
{$user['profilelink']}{$invisiblemark}

To this:
<img src="{$avatar}" style="width: 20px; height: 20px; border-radius: 50px; border: 1px solid #D8DFEA; padding: 1px; margin-top: 4px; margin-right: 0; margin-bottom: -8px; margin-left: 4px" alt="" /> {$user['profilelink']}{$invisiblemark}

Save your changes.


That's all it is to it.  Hope this helps  Smile


RE: Add avatars to index Who's Online list of names - Nna - 2020-02-24

Where can i locate the forum root index.php? cpanel or where?