MyBB Community Forums
[Modification] How to show user avatar in the Who's Online? - 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: [Modification] How to show user avatar in the Who's Online? (/thread-216700.html)

Pages: 1 2


[Modification] How to show user avatar in the Who's Online? - Moody's - 04-02-2018

Hi,
I hope the subject is in the right place.

How to show user avatar in the Who's Online.

View:

[Image: EkranResmi2018-04-0222.42.44.png]

[Image: EkranResmi2018-04-0223.04.13.png]

Open the FTP -> index.php:

Find the following code: (line 59)
SELECT s.sid, s.ip, s.uid, s.time, s.location, s.location1, u.username, u.invisible, u.usergroup, u.displaygroup

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

And open the Admin KP -> Themes and Templates -> Templates -> Your Theme Templates -> Index Templates -> index_whosonline_memberbit

Open and replace all the codes with this one.

<div style="float: left">{$comma}<div style="margin-left: 5px"></div></div><div style="margin-top: 5px"><img src="{$user['avatar']}" width="20px" height="20px" style="float: left; margin-top: -4px; border-radius: 2px; border: 1px solid #ccc; margin-right: 3px"><div style="float: left; margin-top: -1px">{$user['profilelink']}{$invisiblemark}</div></div>

---

Open the FTP -> online.php:

Find this code: (Line 207)

SELECT DISTINCT s.sid, s.ip, s.uid, s.time, s.location, u.username, s.nopermission, u.invisible, u.usergroup, u.displaygroup

Change:

SELECT DISTINCT s.sid, s.ip, s.uid, s.time, s.location, u.username, s.nopermission, u.avatar, u.invisible, u.usergroup, u.displaygroup

Admin KP -> Themes & Templates -> Templates -> Your Theme Templates -> Whos Online Templates -> online_row

Replace all the codes with this one.

<tr>
<td class="trow1"><img src="{$user['avatar']}" width="38px" height="38px" style="float: left; margin-right: 5px; border-radius: 3px"/>{$online_name}{$user_ip}</td>
<td align="center" class="trow2">{$online_time}</td>
<td class="trow1" width="50%">{$location}</td>
</tr>

Good works!


RE: [Modification] How to show user avatar in the Who's Online? - mrdangem - 04-07-2018

Wow, the procedure is very complex but its worth it. I will try this later! Thanks man!


RE: [Modification] How to show user avatar in the Who's Online? - kuttysoft - 04-13-2018

i am follow the instruction wow awesome work bro


RE: [Modification] How to show user avatar in the Who's Online? - Eldenroot - 05-17-2018

Unfortunately there is an issue for users with default avatar...


RE: [Modification] How to show user avatar in the Who's Online? - kuttysoft - 03-28-2019

[Image: Screenshot_976.png]'

I meet another issue  user name not next 

its goes next line for new user online 

help me to fix


RE: [Modification] How to show user avatar in the Who's Online? - Michael2014 - 09-02-2019

(05-17-2018, 02:12 PM)Eldenroot Wrote: Unfortunately there is an issue for users with default avatar...

this works...

src="{$user['avatar']}" onerror="this.src='/images/default_avatar.png';"

(09-02-2019, 11:59 PM)Michael2014 Wrote:
(05-17-2018, 02:12 PM)Eldenroot Wrote: Unfortunately there is an issue for users with default avatar...

this works...

src="{$user['avatar']}" onerror="this.src='/images/default_avatar.png';"

the other way would be to add the following to index.php::

EDIT*

            if ($user['avatar'] != "")
            {
                $user_avatar = '<img class="onlined" src="'.$user['avatar'].'" alt="Avatar" title="'.$user['username'].' \'s Avatar" width="100%" height="100%">';
            }
            else
            {
                $user_avatar = '<img class="onlined" src="images/default_avatar.png" alt="Avatar" title="'.$user['username'].' \'s Avatar" width="100%" height="100%">';
            }

and use {$user_avatar}

and this works better imo


RE: [Modification] How to show user avatar in the Who's Online? - effone - 09-03-2019

I think I did that with our incomplete (yet usable) plugin (no core edit) :
https://github.com/mybbgroup/Bauble-name

It has the ability to set avatars for spiders as well.


RE: [Modification] How to show user avatar in the Who's Online? - Michael2014 - 09-04-2019

(09-03-2019, 12:16 PM)effone Wrote: I think I did that with our incomplete (yet usable) plugin (no core edit) :
https://github.com/mybbgroup/Bauble-name

It has the ability to set avatars for spiders as well.

Thanks for the heads up! No core edit is better, no doubt.


RE: [Modification] How to show user avatar in the Who's Online? - WallBB - 09-04-2019

(09-03-2019, 12:16 PM)effone Wrote: I think I did that with our incomplete (yet usable) plugin (no core edit) :
https://github.com/mybbgroup/Bauble-name

It has the ability to set avatars for spiders as well.

effone, I think you also did this long time back on your site. Am I right ? Smile


RE: [Modification] How to show user avatar in the Who's Online? - vintagedaddyo - 09-05-2019

informative thanks Wink