Default Avatar

Guides & Snippets for phpBB3. Try the Snippets here and share Your own Snippets
There is no support here! Only Read Access!
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

Moved here: viewtopic.php?f=45&t=1254
Board rules! No PM support
User avatar
Fire-Fox
BBCoder IV
BBCoder IV
Posts: 275
Joined: 22 Mar 2010, 13:24
Location: Denmark

Re: Default Avatar

Post by Fire-Fox »

Nice one !
User avatar
kevinviet
BBCoder III
BBCoder III
Posts: 123
Joined: 06 Mar 2010, 04:52

Re: Default Avatar

Post by kevinviet »

Thanks Stoker
Mario14125
I have been banned!
I have been banned!
Posts: 26
Joined: 29 Apr 2010, 10:38
Location: Poland

Re: Default Avatar

Post by Mario14125 »

1. We have chosen an avatar upload to any directory on your server. I suggest that you upload it to the folder in which there are other avatars: /images/avatars/gallery/
2. For this avatar should be access via the link http://www.twojeforum.pl/images/avatars ... avatar.png (of course replace the underlined name of the proper name for our server, and file an avatar
3. Open the file includes/functions_user.php and change the default values:

Code: Select all

'user_avatar'                   =>'',
'user_avatar_type'              => 0,
'user_avatar_width'             => 0,
'user_avatar_height'    => 0,
on

Code: Select all

'user_avatar'                   => 'http://www.twojeforum.pl/images/avatars/gallery/avatar.png',
'user_avatar_type'             => 2,
'user_avatar_width'             => 128,
'user_avatar_height'    => 128,
By changing the correct path to the avatar. Remember to include the default size of an avatar. In this case it is 128×128th If your avatar is a different size, enter the correct aspect ratio.

Changing the default avatar on existing users
If you want to set the default avatar of all those who do not have an avatar in general need to perform such a SQL query

Code: Select all

UPDATE `phpbb_users` SET `user_avatar` = 'http://www.twojeforum.pl/images/avatars/gallery/avatar.png',
`user_avatar_type` = '2',
`user_avatar_width` = '128',
`user_avatar_height` = '128'
WHERE `user_avatar` = '' ;
By changing the correct path to the avatar. Remember to include the default size of an avatar. In this case it is 128×128th If your avatar is a different size, enter the correct aspect ratio.

This method works "one time" - if the user removes the avatar from the profile it will not show him anything. So it is not forced upon anyone that does not want to have as an avatar is a must use "the default avatar.

///sorry for my bad english
Click Here!
cisco007
BBCoder VI
BBCoder VI
Posts: 1015
Joined: 16 Mar 2010, 18:14
Location: Don't really know!

Re: Default Avatar

Post by cisco007 »

that is a lot of steps, where as the first post is easier, simpler, and no sql statements!
Mario14125
I have been banned!
I have been banned!
Posts: 26
Joined: 29 Apr 2010, 10:38
Location: Poland

Re: Default Avatar

Post by Mario14125 »

But I just wrote a another way of how you can make a default avatar... You do not need to scream...
Click Here!
User avatar
Georgio
BBCoder II
BBCoder II
Posts: 53
Joined: 06 Mar 2010, 19:10
Location: Cabanes, Spain
Contact:

Re: Default Avatar

Post by Georgio »

Stoker » 06 Apr 2010, 14:23 wrote: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. [...]
[profile]Stoker[/profile], what's the difference between v1 & v2, i want to chose your version; ¿what you recommend me?
[hrc=red]2[/hrc]
what do you mean with "every where on the board" ? Do you mean down at "who's on line" at index??
Last edited by Georgio on 26 May 2010, 20:17, edited 1 time in total.
cisco007
BBCoder VI
BBCoder VI
Posts: 1015
Joined: 16 Mar 2010, 18:14
Location: Don't really know!

Re: Default Avatar

Post by cisco007 »

it's up to you which one you want, it depends on which one you feel comfortable with, read the description it tells you the difference between the two!
User avatar
billoo
BBCoder II
BBCoder II
Posts: 24
Joined: 15 May 2010, 22:46

Re: Default Avatar

Post by billoo »

first one worked better for me
second one didnt work
when i used both the name of user was misplaced then i removed second one thanks
User avatar
Ashley.S.
BBCoder II
BBCoder II
Posts: 36
Joined: 05 Mar 2010, 12:24
Location: Falmouth, Cornwall, UK
Contact:

Re: Default Avatar

Post by Ashley.S. »

don't know if you lot are aware or not, but the second ways find does not work in the latest version of phpBB3, instead you need to instead find:

Code: Select all

	if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
	{
		return '';
	}
as posted here: http://www.phpbb.com/community/viewtopi ... #p11276755
Regards,
-Ashley.S. [ Pluto Hosting Managing Director & ProphpBB Moderator ]
Locked