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.
<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:
<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:
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
Replace whit:
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="tborder">
<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.
$txt['avatar'] = 'Avatar';
And we're done. Hope you'll enjoy this.
Now does this resize the avatar correctly, like if width > height then width = ?? and if height > width then height = ??
It shows the avatar in the same size as it is everywhere else.
By the way, I forgot to ask in the first post, culd someone move this to the Tips and Tricks board, please?
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
Quote from: Kalina on October 27, 2008, 06:23:39 PM
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.
<td nowrap="nowrap">', $member['avatar']['image'], '</td>
<td nowrap="nowrap">', @$member['avatar']['image'], '</td>
Thanks Duncan, works like a charm!
8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50
how do i fix this,
Quote from: Nfanthr33 on October 29, 2008, 08:11:37 PM
8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50
how do i fix this,
Quote from: Nascar on October 16, 2008, 04:26:12 PM
Done whit the template edits. Now remians a small edit in Modifications.english.php.
$txt['avatar'] = 'Avatar';
And we're done. Hope you'll enjoy this.
Did you this in Modifications.english.php ?
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...
yes, yes i did, still going bad
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 :)
There isn't one for now, but there could be one, why? Do you just not want a manual edit????
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.
I'm not a coder myself, but I'd be glad to do a manual edit for you
hi
Thank you very much :).. I'd be eternally grateful.
And I appreciate your valuable time, talk soon.
Sincerely, Michael
Neat! Just did this with my forum and I used Duncan85's fix for the forum error log problem. I liker it.
lol
Thank you very much
Thank you ;)
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
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.
Does this even work for 2.x versions?