How to setup default avatar?

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
Matrix Leader
Registered User
Posts: 160
Joined: Sun Oct 09, 2011 9:19 am
Location: Dubai, U.A.E.
Name: Matrix Leader
Contact:

How to setup default avatar?

Post by Matrix Leader »

Hi guys,

On some forums that I visit, if I don't upload my own Avatar, I get the default forums avatar which usually has their logo....

how can I set a default avatar to be automatically assigned for members that sign up until they upload their own avatar (if they ever choose to)?
BlackBerry Matrix Website (For all your BlackBerry OS updates, apps, etc)
BlackBerry Matrix Forums
User avatar
John P
Registered User
Posts: 1237
Joined: Mon Jan 21, 2008 3:55 pm
Location: Netherlands
Name: John
Contact:

Re: How to setup default avatar?

Post by John P »

Make it default in the user table, field user_avatar.

Value should be "avatar/default.jpg"

Then all new users have this avatar until they choose another.
Image
Webhosting, Custom MODs, Technical management, MOD installation and Webdesign
User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: How to setup default avatar?

Post by Oyabun1 »

Stef775 wrote:Make it default in the user table, field user_avatar.

Value should be "avatar/default.jpg"

Then all new users have this avatar until they choose another.
I just tried that and it doesn't work.

However, there is a file edit that can be made that does work.

Download, backup, and open includes/functions_display.php

Find

Code: Select all

 	if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
	{
		return '';
	} 
Inline 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) . '" />'; 
Change no_avatar.gif to the name of your default avatar and place the image in the avatars/gallery/ folder

Only use a good FTP client, such as FileZilla, to transfer the files. (FTP clients provided in host control panels can cause problems.) Use a proper text editor to make the edit, such as one of these, text editors. The encoding to save files in is UTF8 without BOM.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests
User avatar
Matrix Leader
Registered User
Posts: 160
Joined: Sun Oct 09, 2011 9:19 am
Location: Dubai, U.A.E.
Name: Matrix Leader
Contact:

Re: How to setup default avatar?

Post by Matrix Leader »

Oyabun1 wrote:
Stef775 wrote:Make it default in the user table, field user_avatar.

Value should be "avatar/default.jpg"

Then all new users have this avatar until they choose another.
I just tried that and it doesn't work.

However, there is a file edit that can be made that does work.

Download, backup, and open includes/functions_display.php

Find

Code: Select all

 	if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config))
	{
		return '';
	} 
Inline 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) . '" />'; 
Change no_avatar.gif to the name of your default avatar and place the image in the avatars/gallery/ folder

Only use a good FTP client, such as FileZilla, to transfer the files. (FTP clients provided in host control panels can cause problems.) Use a proper text editor to make the edit, such as one of these, text editors. The encoding to save files in is UTF8 without BOM.
Thank you sir!
BlackBerry Matrix Website (For all your BlackBerry OS updates, apps, etc)
BlackBerry Matrix Forums
User avatar
SGMonkey
Registered User
Posts: 61
Joined: Mon Mar 24, 2014 5:57 pm
Location: UK

Re: How to setup default avatar?

Post by SGMonkey »

I know this is an old post. But as far as I am aware, it is still relevant.

I have a related question. If i wanted to link directly to the current themes "no_avatar.gif" how would I go about doing that?

f.ex, I have a forum with multiple styles, each style comes with a different "no_avatar.gif"

I tried doing something like this

Code: Select all

return '<img src="{T_THEME_PATH}/images/no_avatar.gif" alt="' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . '" />';
But it doesn't seem to work. Just leaves me with the text, "user avatar" above the users profile field.

Any ideas how i would go about doing this?

Thanks in advance!

EDIT: On second look, this doesn't seem to do anything. No matter the image path, it just says "User avatar" above the profile. Even when I set it back to default it says the same thing.
Locked

Return to “[3.0.x] MOD Writers Discussion”