Page 1 of 1

Default Avatar

Posted: 27 Jul 2011, 08:40
by Stoker
Default Avatar
Written by blkjack-21 and Stoker

This snippet will give users a default avatar. Off course only if they haven't chosen one in UCP :)
First version by blkjack-21 will display the default avatar everywhere on the board, the second version by Stoker will only display default avatar on viewtopic.

Version 1 by blkjack-21

Open: includes/functions_display.php
Find:

Code: Select all

if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
	{
		return ''; 
In line find:

Code: Select all

		return '';
Replace with:

Code: Select all

	return '<img src="images/avatars/gallery/no_avatar.gif" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
Last step is to upload this image to the images/avatars/gallery/ folder
Last step is to upload this image to the images/avatars/gallery/ folder
no_avatar.gif (474 Bytes) Viewed 6190 times

Version 2 by Stoker

Open prosilver/template/viewtopic_body.html
Find:

Code: Select all

<!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}">{postrow.POSTER_AVATAR}</a><!-- ELSE -->{postrow.POSTER_AVATAR}<!-- ENDIF -->
In line add after:

Code: Select all

<!-- ELSE --><img src="{ROOT_PATH}images/gallery/no_avatar.gif" width="125" height="125" alt="" />

Open subsilver2/template/viewtopic_body.html
Find:

Code: Select all

			<!-- IF postrow.POSTER_AVATAR -->
				<tr>
					<td>{postrow.POSTER_AVATAR}</td>
				</tr>
Add after:

Code: Select all

			<!-- ELSE -->
				<tr>
					<td><img src="{ROOT_PATH}images/gallery/no_avatar.gif" width="125" height="125" alt="" /></td>
				</tr>
Save, upload changed files and refresh the templates
Last step is to upload this image to the images/avatars/gallery/ folder
Last step is to upload this image to the images/avatars/gallery/ folder
no_avatar.gif (474 Bytes) Viewed 6190 times

Default Avatar

Posted: 17 Nov 2012, 05:21
by Blackwolf
Better late than never....super snippet, thanks Stoker