==README for addon_avatar.php==
Release date: March 30, 2005
Most recent update: February 5, 2026
miniBB version: 3.3 and higher
Author: Paul Puzyrev (minibb.com)

This is the first add-on released on the base of universal miniBB algorithm which allows to display any info from user's table in his posts. Addon is NOT destructive and allows you to do further miniBB upgrades without additional editing of files. Addon allows to upload or to choose ready avatar from list, or both. Look at the images located in /!how_it_looks/ - this is what you should have after successfull installation. Avatar upload/choose operations will be available in user's Preferences.

INSTALLATION INSTRUCTIONS:

***************************************

If you are going to allow users upload their own avatars: 
- Create a folder called 'shared_files' in your forum's root (e.g. /forums/shared_files). 
- Set the folder's permission to 0777. (Windows servers - set permissions so the Web may access and write to this folder.) 
- Create a subfolder named 'avatars' within the 'shared_files' folder (e.g. /forums/shared_files/avatars) 
- Set 'avatars' folder permission to 0777. 

On-the-fly image resizing is not supported. Images uploaded by users must meet the settings defined in step 2. 

If you won't allow users to upload their own files, just set $maxFileSize=0; in addon_avatar.php (read below) and do not create any directories.

***************************************

If you are providing a fixed set of images for users to use: 
- Create a subfolder called 'forum_avatars' within your forum's 'img' folder (e.g. /forums/img/forum_avatars). 
- Put all your avatar images in 'forum_avatars'
- The folder permission for 'forum_avatars' should be set to read-only.
- IMPORTANT: files should have only the 3-letter extensions, which possibly are .gif, .jpg, .png.
- IMPORTANT: for compatibility with all systems, files should have only alphanumerical characters in their names!

If you do not want to provide fixed avatars, do the following:

- remove a link with {$l_chooseAvatar} var from templates/addon_avatar_userform.html
- set $chooseTableCells=0; in addon_avatar_options.php

***************************************

Upload the file from /img/no-avatar.svg to the /img/ folder of your forum. This is an optional picture presenting an "empty" avatar when there's no profile avatar is chosen or uploaded. Will be displayed on the forum's dekstop and mobile version, as well as in Private Messages. It could be replaced to any file up to your choice. Default filename could be changed in addon_avatar_options.php -> $avatarNoImage (see below). To hide an "empty" avatar from displaying, remove or comment this option, or set it to an empty value (='').

***************************************

Open addon_avatar_options.php in a text editor (e.g. Notepad). 
Follow the instructions in the file to edit the settings. 
Save your changes, upload the file to your forum's root (e.g. /forums). 

Our recommendation is to put reasonable value for $avatarMaxFileSize. Usually, this value should not exceed 10-15 Kb, as an Avatar should be an iconic image and it's displayed widely on topic pages, so it's a question of traffic as well. ***Avatars script does not resize the uploaded images automatically***. Avatar should be a carefully taken and prepared image by the user himself, it's a question of its quality, at first. On the web, there are many tools providing auto-resizing of uploaded images, search for "image resize to avatar" or "online image resize" and you'll find a lot of them. You may drop these instructions to your users as well. Additionally to that, on uploads, Avatars script will turn on a scanning function, which tries to determine "hidden" PHP tags in binary images, so called "trojans". As less size image is being scanned, as it's faster.

***************************************

Upload addon_avatar.php to your forum's root (e.g. /forums). 

***************************************

Upload avatars_eng.php to your forum's lang folder (e.g. /forums/lang). 
Optional: edit avatars_eng if you are not happy with the default translations. 
Note: multiple language packs are supported. 

***************************************

Upload the following files to your forum's template folder (e.g /forums/templates): 

addon_avatar_choose.html 
addon_avatar_upload.html 
addon_avatar_userform.html

Optional: modify the templates to suit your taste. 

If you don't want user upload their own avatars, in addon_avatar_userform.html REMOVE the Upload link:

<a href="{$main_url}/{$indexphp}action=avatarupload1">{$l_uploadAvatar}</a><br /> 

***************************************

Open your forum's user_dataform.html (located in /forums/templates) and add this: 

{$avatarForm} 

Explanation: {$avatarForm} is the cell defined in addon_avatar_userform.html. 

***************************************

Edit setup_options.php (located in /forums) 

Locate $userInfoInPosts and set the avatar field. 

Example: if your avatar field is 'user_custom1', you set $userInfoInPosts to 

$userInfoInPosts=array($dbUserSheme['user_custom1'][1]); 

Note: if there are other fields defined in $userInfoInPosts, do not delete them! Combine as described here:
http://www.minibb.com/forums/2-6882-1.html

***************************************

Open bb_plugins.code.txt file in a text editor. 

Copy the code and paste it into your forum's bb_plugins.php (found in /forums). 

Note: if the database field you use for avatar is not 'user_custom1', edit this line in the code block: function parseUserInfo_user_custom1($av) 

Example: function parseUserInfo_youravatarfield($av)

***************************************

Edit /templates/main_posts.html, before closing JavaScript tag like //--></script> paste the following:

{$delAvatarJs}

This will be substituted by JS alerting code when deleting avatars by admin or moderator right from the thread.

***************************************

Edit /templates/main_posts_cell.html

Anywhere paste this: 
{$userInfo_user_custom1[$poster_id]} 

Example: .....{$viewReg}</span>{$userInfo_user_custom1[$poster_id]}.....

If applicable, make $userInfo_user_custom1 match the name of your avatar field.

Beginning from the version 2.2, miniBB offers leading top-to-bottom messages layout, where author's name placed before the message text. This model doesn't allow to create a nice layout with variable size avatars, and most preferrably with this layout you will be forced to place the code mentioned above in a separate table row (between new <td>...</td> tags). Modify this template in other places to fit better layout of your forums with avatars enabled.

***************************************

Optionally, add to your language file the code located in /lang/eng.code.txt (or the code which relates to your language pack). This will enable avatar displaying in user's profile. You may need to fix the index of a variable, if you have a users table structure which differs from default.

***************************************

THAT's ALL!

To uninstall the plugin, just undo changes made from the steps above.

Hope, you'll enjoy. Please, post bugs and suggestions on our forums:
http://www.minibb.com/forums/11_4185_0.html
