[Tip] Avatar on Who's Online

Started by Marcus Forsberg, October 16, 2008, 04:26:12 PM

Previous topic - Next topic

Marcus Forsberg

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) Select
<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) Select
<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) Select
<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) Select
<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) Select

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





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

lordtron

Now does this resize the avatar correctly, like if width > height then width = ?? and if height > width then height = ??

VainSoftGames.com - New Design To Gaming

Marcus Forsberg

It shows the avatar in the same size as it is everywhere else.

Marcus Forsberg

By the way, I forgot to ask in the first post, culd someone move this to the Tips and Tricks board, please?

Kalina

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

Kermit

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.


Code (find) Select

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


Code (replace with) Select

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


My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

Kalina

Thanks Duncan, works like a charm!

tyhgdgh

8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50


how do i fix this,

Kermit

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.

Code (Add to the end of the file) Select

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





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

Did you this in Modifications.english.php ?
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

SpectroPro

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...
Stats:  SMF v. 2b4  -  Mambo v4.65  -  Bridge v2.0b1

http://www.therealityrocks.com    http://forum.therealityrocks.com/trr
- Greg

tyhgdgh


editor1

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 :)

tyhgdgh

There isn't one for now, but there could be one, why? Do you just not want a manual edit????

editor1

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.

tyhgdgh

I'm not a coder myself, but I'd be glad to do a manual edit for you

editor1

hi
Thank you very much :).. I'd be eternally grateful.
And I appreciate your valuable time, talk soon.
Sincerely, Michael

brandonroy

Neat! Just did this with my forum and I used Duncan85's fix for the forum error log problem. I liker it.

FlixyaFriend

samsung ue46c8000 [nofollow]


Milutin M.

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

Advertisement: