Advertisement:

Author Topic: [Tip] Avatar on Who's Online  (Read 36556 times)

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
[Tip] Avatar on Who's Online
« on: October 16, 2008, 04:26:12 PM »
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:

Code: [Select]
<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:
Code: [Select]
<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:

Code: [Select]
<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:

Code: [Select]
<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.
« Last Edit: October 16, 2008, 04:27:44 PM by Nascar »

Offline lordtron

  • Sophist Member
  • *****
  • Posts: 1,247
  • Gender: Male
    • VainSoft
Re: [Tip] Avatar on Who's Online
« Reply #1 on: October 16, 2008, 05:04:23 PM »
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

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: [Tip] Avatar on Who's Online
« Reply #2 on: October 17, 2008, 10:06:03 AM »
It shows the avatar in the same size as it is everywhere else.

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: [Tip] Avatar on Who's Online
« Reply #3 on: October 23, 2008, 10:32:02 AM »
By the way, I forgot to ask in the first post, culd someone move this to the Tips and Tricks board, please?

Offline Kalina

  • Semi-Newbie
  • *
  • Posts: 47
  • Gender: Female
Re: [Tip] Avatar on Who's Online
« Reply #4 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

Offline Kermit

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,365
  • Gender: Male
Re: [Tip] Avatar on Who's Online
« Reply #5 on: October 27, 2008, 06:27:24 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

Offline Kalina

  • Semi-Newbie
  • *
  • Posts: 47
  • Gender: Female
Re: [Tip] Avatar on Who's Online
« Reply #6 on: October 27, 2008, 06:54:56 PM »
Thanks Duncan, works like a charm!

Offline tyhgdgh

  • Jr. Member
  • **
  • Posts: 284
  • Gender: Male
  • thismany
    • VGRecordist
Re: [Tip] Avatar on Who's Online
« Reply #7 on: October 29, 2008, 08:11:37 PM »
Code: [Select]
8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50

how do i fix this,

Offline Kermit

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,365
  • Gender: Male
Re: [Tip] Avatar on Who's Online
« Reply #8 on: October 30, 2008, 06:17:11 AM »
Code: [Select]
8: Undefined index: avatar
File: /var/www/html/forum/Themes/default/languages/modifications.english.php (eval?)
Line: 50

how do i fix this,


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

Offline SpectroPro

  • Jr. Member
  • **
  • Posts: 376
  • Gender: Male
    • The Reality Rocks Group
Re: [Tip] Avatar on Who's Online
« Reply #9 on: October 30, 2008, 09:09:03 AM »
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

Offline tyhgdgh

  • Jr. Member
  • **
  • Posts: 284
  • Gender: Male
  • thismany
    • VGRecordist
Re: [Tip] Avatar on Who's Online
« Reply #10 on: November 11, 2008, 02:42:02 AM »
yes, yes i did, still going bad

editor1

  • Guest
Re: [Tip] Avatar on Who's Online
« Reply #11 on: December 06, 2008, 02:12:11 AM »
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 :)

Offline tyhgdgh

  • Jr. Member
  • **
  • Posts: 284
  • Gender: Male
  • thismany
    • VGRecordist
Re: [Tip] Avatar on Who's Online
« Reply #12 on: December 06, 2008, 04:25:26 AM »
There isn't one for now, but there could be one, why? Do you just not want a manual edit????

editor1

  • Guest
Re: [Tip] Avatar on Who's Online
« Reply #13 on: December 06, 2008, 04:30:11 AM »
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.

Offline tyhgdgh

  • Jr. Member
  • **
  • Posts: 284
  • Gender: Male
  • thismany
    • VGRecordist
Re: [Tip] Avatar on Who's Online
« Reply #14 on: December 06, 2008, 04:31:27 AM »
I'm not a coder myself, but I'd be glad to do a manual edit for you

editor1

  • Guest
Re: [Tip] Avatar on Who's Online
« Reply #15 on: December 06, 2008, 02:15:43 PM »
hi
Thank you very much :).. I'd be eternally grateful.
And I appreciate your valuable time, talk soon.
Sincerely, Michael

Offline brandonroy

  • Jr. Member
  • **
  • Posts: 166
  • Gender: Male
    • Brandon
Re: [Tip] Avatar on Who's Online
« Reply #16 on: December 20, 2008, 02:28:44 AM »
Neat! Just did this with my forum and I used Duncan85's fix for the forum error log problem. I liker it.

Offline FlixyaFriend

  • Semi-Newbie
  • *
  • Posts: 18
    • samsung ue46c8000
Re: [Tip] Avatar on Who's Online
« Reply #17 on: January 19, 2009, 04:25:15 AM »
lol
Thank you very much


Offline Milutin M.

  • Semi-Newbie
  • *
  • Posts: 10
Re: [Tip] Avatar on Who's Online
« Reply #19 on: January 30, 2009, 01:44:43 PM »
How do i fix this , error . This is my error log :


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

Thanks