Default Avatar

Mixed forum with code snippets, guides and styles
Forum rules
Everything in this forum is for everybody
But support only for Donators!
Post Reply
User avatar
Stoker
Site Admin
Site Admin
Posts: 3521
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Default Avatar

Post 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 6023 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 6023 times
Board rules! No PM support
User avatar
Blackwolf
BBCoder IV
BBCoder IV
Posts: 272
Joined: 04 Dec 2010, 12:36
BBCodes: 101
Favourite BBCode: Dropcap
Favourite MOD: mchat
Location: Melbourne Australia

Default Avatar

Post by Blackwolf »

Better late than never....super snippet, thanks Stoker
Ultimate Edition, Ultimate Edition Oz, Oz Unity

“We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us.”
Post Reply