Page 1 of 1

Avatar on index

Posted: 27 Jul 2011, 08:40
by Stoker
Avatar on index
Written by Stoker

A little guide that will show you how to get the users avatar shown on forum index.
I have chosen to place it in the Who is online area, but you can place it anywhere you like.
avatar.png
Open index.php
Find:

Code: Select all

'NEWEST_USER'	=> sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
Add after, on a new line:

Code: Select all

'USER_AVATAR'                    => get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']),

Prosilver

Open styles/prosilver/template/index_body.html
Find:

Code: Select all

<!-- IF S_DISPLAY_ONLINE_LIST -->
	<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
	<p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}
	<!-- IF LEGEND --><br /><em>{L_LEGEND}: {LEGEND}</em><!-- ENDIF --></p>
<!-- ENDIF -->
Replace with:

Code: Select all

<!-- IF S_DISPLAY_ONLINE_LIST -->
	<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
 <table><tr><!-- IF S_USER_LOGGED_IN and USER_AVATAR --><td valign="top" style="padding-right:6px;">{USER_AVATAR}</td><!-- ENDIF --><td>
 <p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}
	 <!-- IF LEGEND --><br /><em>{L_LEGEND}: {LEGEND}</em><!-- ENDIF --></p>
	</td></tr></table>
<!-- ENDIF -->

Subsilver2

Open styles/subsilver2/template/index_body.html
find:

Code: Select all

<!-- IF LEGEND -->
		<td class="row1" rowspan="2" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<!-- ELSE -->
Replace with:

Code: Select all

<!-- IF LEGEND -->
		<td class="row1" rowspan="2" align="center" valign="middle"><!-- IF S_USER_LOGGED_IN and USER_AVATAR --><br /><br />{USER_AVATAR}</td><!-- ENDIF --></span></td>
	<!-- ELSE -->
The attachment av2.JPG is no longer available
Credits to vectra-mods for the subsilver2 instructions.

Upload changed files and refresh the template(s)

Avatar on index

Posted: 28 Sep 2011, 12:22
by Blackwolf
Can I trouble you...again....to view my ca_black section of code....?? and what I need to change please? ;)

Code: Select all

<!-- IF S_DISPLAY_ONLINE_LIST -->
    {$CA_PANEL_START}
	<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
   <p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{LOGGED_IN_USER_LIST}<br />{ONLINE_BOTLIST}
	<!-- IF LEGEND --><br /><em>{L_LEGEND}: {LEGEND}</em><!-- ENDIF --></p>
	{$CA_PANEL_END}
	<!-- IF WHO_WAS_HERE_LIST2 -->
		<h3>{L_WHO_WAS_HERE}</h3>
		<p>{WHO_WAS_HERE_LIST2} ({WHO_WAS_HERE_EXP})<br />{WHO_WAS_HERE_RECORD}<br />{WHO_WAS_HERE_LIST}</p>
	<!-- ELSEIF U_ACP -->
		<h3>{L_WHO_WAS_HERE}</h3>
		<p>{L_WWH_UPDATE_NEED}</p>
	<!-- ENDIF -->
I tried to do it myself but the avatar was the default size......I'm no coder!! :oops:

Code: Select all

<!-- IF S_DISPLAY_ONLINE_LIST -->
    {$CA_PANEL_START}
	<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
   <p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{LOGGED_IN_USER_LIST}<br />{ONLINE_BOTLIST}
	<!-- IF LEGEND --><br /><em>{L_LEGEND}: {LEGEND}</em><!-- ENDIF --></p>
<!-- IF S_USER_LOGGED_IN and USER_AVATAR --><td valign="top" style="padding-right:6px;">{USER_AVATAR}</td><!-- ENDIF --><td>
<p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}
	{$CA_PANEL_END}
	<!-- IF WHO_WAS_HERE_LIST2 -->
		<h3>{L_WHO_WAS_HERE}</h3>
		<p>{WHO_WAS_HERE_LIST2} ({WHO_WAS_HERE_EXP})<br />{WHO_WAS_HERE_RECORD}<br />{WHO_WAS_HERE_LIST}</p>
	<!-- ELSEIF U_ACP -->
		<h3>{L_WHO_WAS_HERE}</h3>
		<p>{L_WWH_UPDATE_NEED}</p>
	<!-- ENDIF -->
You can also see I prefer a larger avatar ....is there a way to make it auto resize so as to not be 150px × 200px
on the bottom of the forum but half those dimensions on the bottom? please....... :D

Avatar on index

Posted: 29 Sep 2011, 22:00
by Stoker
Avatar here is not resized.
Try do a search here for resized avatar, I know it has been asked before.

Avatar on index

Posted: 29 Sep 2011, 23:43
by Blackwolf
Thanks. Found it.