Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: Marcus Forsberg in Oktober 16, 2008, 04:26:12 NACHMITTAGS

Titel: [Tip] Avatar on Who's Online
Beitrag von: Marcus Forsberg in Oktober 16, 2008, 04:26:12 NACHMITTAGS
Hi guys!

This is a simple tip to show how to add avatars to the Who's online list.




Let's begin by opening Who.template.php.

Code (find) Auswählen
<td nowrap="nowrap">', $member['time'], '</td>

Replace whit:

<td nowrap="nowrap">', $member['avatar']['image'], '</td>
<td nowrap="nowrap">', $member['time'], '</td>



That will add the avatar, but is doesn't look very good, does it?
We'll fix this now:

Code (Find) Auswählen
<td colspan="3"><b>', $txt[139], ':</b> ', $context['page_index'], '</td>

Replace whit:
<td colspan="4"><b>', $txt[139], ':</b> ', $context['page_index'], '</td>

That makes it a bit nicer, right?
Not, let's continue whit the last few edits:

Code (Find) Auswählen
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">

Replace whit:

<table cellpadding="4" cellspacing="0" border="0" width="100%" class="tborder">



Code (Find) Auswählen
<td style="width: 14ex;"><a href="' . $scripturl . '?action=who;start=', $context['start'], ';sort=time', $context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ? ';asc' : '', '">', $txt['who_time'], ' ', $context['sort_by'] == 'time' ? '<img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></td>
<td>', $txt['who_action'], '</td>


Replace whit:

<td>', $txt['avatar'], '</td>
<td style="width: 14ex;"><a href="' . $scripturl . '?action=who;start=', $context['start'], ';sort=time', $context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ? ';asc' : '', '">', $txt['who_time'], ' ', $context['sort_by'] == 'time' ? '<img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></td>
<td>', $txt['who_action'], '</td>





Done whit the template edits. Now remians a small edit in Modifications.english.php.

Code (Add to the end of the file) Auswählen

$txt['avatar'] = 'Avatar';





And we're done. Hope you'll enjoy this.
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: lordtron in Oktober 16, 2008, 05:04:23 NACHMITTAGS
Now does this resize the avatar correctly, like if width > height then width = ?? and if height > width then height = ??
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Marcus Forsberg in Oktober 17, 2008, 10:06:03 VORMITTAG
It shows the avatar in the same size as it is everywhere else.
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Marcus Forsberg in Oktober 23, 2008, 10:32:02 VORMITTAG
By the way, I forgot to ask in the first post, culd someone move this to the Tips and Tricks board, please?
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Kalina in Oktober 27, 2008, 06:23:39 NACHMITTAGS
I added this to my board but now when someone views the who's online page, my error log fills up with this:

8: Undefined index: avatar
File: /home/mydomain/public_html/Themes/default/languages/Who.english.php (main sub template - eval?)
Line: 29
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Kermit in Oktober 27, 2008, 06:27:24 NACHMITTAGS
Zitat von: Kalina in Oktober 27, 2008, 06:23:39 NACHMITTAGS
I added this to my board but now when someone views the who's online page, my error log fills up with this:

8: Undefined index: avatar
File: /home/mydomain/public_html/Themes/default/languages/Who.english.php (main sub template - eval?)
Line: 29


to fix that,you should do this in Who.template.php.


Code (find) Auswählen

   <td nowrap="nowrap">', $member['avatar']['image'], '</td>


Code (replace with) Auswählen

   <td nowrap="nowrap">', @$member['avatar']['image'], '</td>


Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Kalina in Oktober 27, 2008, 06:54:56 NACHMITTAGS
Thanks Duncan, works like a charm!
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: tyhgdgh in Oktober 29, 2008, 08:11:37 NACHMITTAGS
8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50


how do i fix this,
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Kermit in Oktober 30, 2008, 06:17:11 VORMITTAG
Zitat von: Nfanthr33 in Oktober 29, 2008, 08:11:37 NACHMITTAGS
8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50


how do i fix this,
Zitat von: Nascar in Oktober 16, 2008, 04:26:12 NACHMITTAGS


Done whit the template edits. Now remians a small edit in Modifications.english.php.

Code (Add to the end of the file) Auswählen

$txt['avatar'] = 'Avatar';





And we're done. Hope you'll enjoy this.

Did you this in Modifications.english.php ?
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: SpectroPro in Oktober 30, 2008, 09:09:03 VORMITTAG
When posting tips, could people please post (maybe in the subject) what version of smf the tip is for?  That would be a huge help to those of us that enjoy using the new and better version of SMF rather than the old 1.x versions...  ;)    Sometimes, we have to go through several files, that have the same code, before finding that the tips are for 1.x smf....

Just a thought...
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: tyhgdgh in November 11, 2008, 02:42:02 VORMITTAG
yes, yes i did, still going bad
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: editor1 in Dezember 06, 2008, 02:12:11 VORMITTAG
Hi
I was wondering if there was a mod pack that would do the same thing for 1.1.7, if so, what would it be?
thank :)
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: tyhgdgh in Dezember 06, 2008, 04:25:26 VORMITTAG
There isn't one for now, but there could be one, why? Do you just not want a manual edit????
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: editor1 in Dezember 06, 2008, 04:30:11 VORMITTAG
Hi, thank you for the response  :) I really appreciate it,
unfortunately I don't know how to install anything manually but would love to learn as it would help immensely.
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: tyhgdgh in Dezember 06, 2008, 04:31:27 VORMITTAG
I'm not a coder myself, but I'd be glad to do a manual edit for you
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: editor1 in Dezember 06, 2008, 02:15:43 NACHMITTAGS
hi
Thank you very much :).. I'd be eternally grateful.
And I appreciate your valuable time, talk soon.
Sincerely, Michael
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: brandonroy in Dezember 20, 2008, 02:28:44 VORMITTAG
Neat! Just did this with my forum and I used Duncan85's fix for the forum error log problem. I liker it.
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: FlixyaFriend in Januar 19, 2009, 04:25:15 VORMITTAG
lol
Thank you very much
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: enjoy1985 in Januar 20, 2009, 10:01:04 NACHMITTAGS
Thank you  ;)
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Milutin M. in Januar 30, 2009, 01:44:43 NACHMITTAGS
How do i fix this , error . This is my error log :



8: Undefined index: avatar
Datoteka: /home/www/MyDomain/forum/Themes/default/MessageIndex.template.php (main sub template - eval?)
Linija: 58


Thanks
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Rumbaar in März 10, 2009, 10:43:58 NACHMITTAGS
Did you apply Duncan85 fix for the language string in Post #8?

But I think ultimately there might be issues with the avatar call when there are guests involved.  Hence the value isn't populated for a guest and an error is encountered.
Titel: Re: [Tip] Avatar on Who's Online
Beitrag von: Yigal in Juli 04, 2009, 03:17:39 VORMITTAG
Does this even work for 2.x versions?