Default Avatar

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

Default Avatar

Post by Stoker » 27 Jul 2011, 06:40

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) . '" />';
no_avatar.gif

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
no_avatar.gif
You do not have the required permissions to view the files attached to this post.
Board rules! No PM support
Sure, I can install the Mod for you ;)
Like the site? Then buy me a bear


User avatar
Blackwolf
BBCoder IV
BBCoder IV
Posts: 272
Joined: 04 Dec 2010, 10:36
BBCodes: 101
Favourite BBCode: Dropcap
Favourite MOD: mchat
Location: Melbourne Australia

Default Avatar

Post by Blackwolf » 17 Nov 2012, 03:21

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.”