Information sur les auteurs & la licence

Retour à la page principale des auteurs

Aide pour pnavatar version 1.0

pnavatar 1.0
PostNuke avatars management and customization

To install the module, upload the pnavatar directory to the modules directory of your server, go to Administration -> Modules, initialize then activate. Go to the module administration control panel to change configuration.

For people upgrading from EnvoAvatar, first visit EnvoAvatar administration and write down your settings. Then deactivate, Remove EnvoAvatar and delete the modules/EnvoAvatar subdirectory. Once You install pnavatar and redo the configuration, all your users will retreive their customized avatars.

Module's configuration

My best advice is not to change the default avatar's directory path (images/avatar) because if you change it, there will be no problem for pnavatar to find avatars but the images/avatar path is hardcoded in a lot of places in PostNuke (bad, bad :( ) so a lot of modules will have trouble finding your avatars !

PHPBB avatar Directory is for people wanting that avatars uploaded by users are also copied in a separate directory (for instance in the PNphpBB2's avatar directory) if you don't run PNphpBB2 leave this field blanck.

Maximum avatar's Filesize, Maximum Avatar's height and Maximum Avatar's width permit you to control that your users don't upload too big avatars, note that filesize is in bytes.

Authorized extensions control filetypes that will be allowed. For each user only 1 file of each allowed type will be authorized (for instance if jpg and gif are allowed, user 12 can only use pers_12.gif and pers_12.jpg, if he re-upload another jpg file it will overwrite the previous pers_12.jpg)

Number of columns in extended mode : there are 3 different modes for the avatar selction screen :
- reduced mode (a drop-down menu)
- reduced mode with a link to extended
- extended mode ( a page with all available avatars)
This setting control the number of columns in extended mode

Visual mode : this is the choice of the display for avatar selection (see previous item)

Number of items per page in Administration: number of items per page in pnavatar's administration when you view/edit group prefixes.

Management of group's avatars

pn avatar allow 3 kind of avatars:
- public avatars : all avatars with no underscore in their name are public avatars. Public avatars are available to all registered users

- personal avatars
For the users allowed to upload avatars, they can upload 1 avatar of each of the authorized types. Personnal avatar will have names like pers_xxx.ext where xxx is user id and ext an authorized extenstion.

To be authorized to upload avatars an user must have at least Add permission for the pnavatar module. Users with overview, read, comment, moderate or edit permission can't upload avatars.

- group avatars
Group avatar are available to groups of users. Group avatars have a name like prefix_name.ext
prefix is anything you want not containing an underscore
name is anything you want not containing an underscore
ext is an authorized extension.
For the moment there is no function in pnavatar to upload group avatars so you will need to use your usual way of uploading files to your server to put public and group avatars in your avatar directory.
Once a prefix_name.ext group avatar is uploaded on your server, you need to go to Administation -> pnavavar to tell pnavatar for what group(s) this avatar is available.
Click on the "New group prefix" link.
With the group dropdown menu choose the group you want.
In the "Group prefix" textfield type the prefix (you need to type exactly the same letters that are before the underscore in the avatar's name, don't type the underscore)
Click on the "Save button"
If you want to allow the same group avatars to several groups you need to create as many group prefix as the number of groups with the same prefix string
If you create a group prefix with * as prefix strng this group will see (and be able to choose) all group avatars.
If you create a group prefix with pers as prefix string, this group will see (and be able to choose) all users personal avatars !!

Integration of pnavatar into PostNuke
If you choose not to change the images/avatar directory path, you should have no problem to display personal and group avatars anywhere in PostNuke.
But there is one remaining problem: when users go to My Account -> Change your info, they are presented with a dropdown menu to choose their avatar and as PostNuke doesn't know anything about pnavatar, they are presented with all avaatars, including all personal avatars and all group avatars. Obviously this is not what you want !!
Solution #1
Go to Administration -> Users administration -> Dynamic user data (last line of the screen) and deactivate the _YOURAVATAR line (will change from green to red).
The avatar selection will disappear from the change your info screen. Your users will still be able to change their avatar using the "Change avatar" link in the "my account page" or the youravatar pnavatar block if you use it.

Solution #2
a) If you are running Postnuke .750
Edit the modules/NS-Your_Account/user/modules/changeinfo.php file, replace the lines:
case "_YOURAVATAR":
$user_avatar = pnUserGetVar('user_avatar');
echo "<select name=\"user_avatar\" onChange=\"showimage()\" class=\"pn-normal\">";
$handle = opendir('images/avatar');
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
while (list ($key, $file) = each ($filelist)) {
ereg(".gif|.jpg", $file);
if ($file != "." && $file != ".." && $file != "index.html" && $file != "CVS") {
echo "<option value=\"$file\"";
if ($file == $user_avatar) {
echo " selected";
}
echo ">$file</option>";
}
}
echo "</select>&nbsp;&nbsp;<img src=\"images/avatar/" . pnVarPrepForDisplay(pnUserGetVar('user_avatar')) . "\" name=\"avatar\" width=\"32\" height=\"32\" alt=\"\" align=\"top\">" . "</td>";
break;
with the lines:
case '_YOURAVATAR':
$user_avatar = pnUserGetVar('user_avatar');
$uid = pnUserGetVar('uid');
pnModLoad('pnavatar', 'user')
echo pnModFunc('pnavatar',
'user',
'selector',
array('avatar' => $user_avatar,
'uid' => $uid,
'showlink' => true));
echo '</td>';
break;

b) If you are running PostNuke .760 or .761, edit the modules/Your_Account/user/modules/changeinfo.php file, replace the lines:
case '_YOURAVATAR':
$user_avatar = pnUserGetVar('user_avatar');
echo '<select name="user_avatar" onchange="showimage()">';
$handle = opendir('images/avatar');
while ($file = readdir($handle)) {
$filelist[] = $file;
}
asort($filelist);
while (list ($key, $file) = each ($filelist)) {
ereg('.gif|.jpg', $file);
if ($file != '.' && $file != '..' && $file != 'index.html' && $file != 'CVS') {
echo '<option value="'.pnVarPrepForDisplay($file).'"';
if ($file == $user_avatar) {
echo ' selected="selected"';
}
echo '>'.pnVarPrepForDisplay($file).'</option>';
}
}
echo '</select>&nbsp;&nbsp;<img src="images/avatar/' . pnVarPrepForDisplay(pnUserGetVar('user_avatar')) . '" name="avatar" width="32" height="32" alt="" /></td>';
break;
with the lines:
case '_YOURAVATAR':
$user_avatar = pnUserGetVar('user_avatar');
$uid = pnUserGetVar('uid');
echo pnModFunc('pnavatar',
'user',
'selector',
array('avatar' => $user_avatar,
'uid' => $uid,
'showlink' => true));
echo '</td>';
break;
Doing this, only the avatar the user is allowed to choose will be displayed in the menu.

Using pnavatar pnRender plugin

If you copy the modules/pnavatar/pntemplates/plugin/function.pnavatar.php file in your modules/pnRender/plugins directory, you will be able to add pnavatars in any of your pnRendered templates
examples:
<!--[pnavatar]--> will display the current user's avatar with standard (32x32) dimensions
<!--[pnavatar uid=$uid width=50 height=50]--> will display user with uid=50 avatar with a 50x50 pixels size.