hello, this is a simple trick to force  pligg avatar system to use user id instead of username.  the problem of pligg avatar system arise with non english letter. it happens when pligg try to write the avatar image file using the username_30.jpg which gives a wrong filename so pligg can not reuse the image file again.

this problem was solved in pligg 1.0.1.  I am writing this post to whom using an older version of pligg and do not want to upgrade to the newer version.

all required steps are written in this file: pligg avatar based on userId


#######################################
lines to modify per file
#######################################
----------------------
/profile.php:
----------------------
change line 78
$imagename = $current_user->user_login . "_original.jpg";
to
$imagename = $current_user->user_id . "_original.jpg";
 
change line 93
$img->pSave($user_image_path . $current_user->user_login . "_".Avatar_Large.".jpg");
to
$img->pSave($user_image_path . $current_user->user_id . "_".Avatar_Large.".jpg");
 
change line 101
$img->pSave($user_image_path . $current_user->user_login . "_".Avatar_Small.".jpg");
to
$img->pSave($user_image_path . $current_user->user_id . "_".Avatar_Small.".jpg");
 
change lines 133 & 134
$main_smarty->assign('Avatar_ImgLarge', get_avatar('large', $user->avatar_source, $user->username, $user->email));
$main_smarty->assign('Avatar_ImgSmall', get_avatar('small', $user->avatar_source, $user->username, $user->email));
to
$main_smarty->assign('Avatar_ImgLarge', get_avatar('large', $user->avatar, "", $user->email,$user->id));
$main_smarty->assign('Avatar_ImgSmall', get_avatar('small', $user->avatar, "", $user->email,$user->id));
 
----------------------
/libs/html1.php:
----------------------
change line 49
$voters[$key]['Avatar_ImgSrc'] = get_avatar($avatar_size, "", $val['user_login'], $val['user_email']);
to
$voters[$key]['Avatar_ImgSrc'] = get_avatar($avatar_size, "", $val['user_login'], $val['user_email'], $val['user_id']);
 
change line 177
$imgsrc = my_pligg_base . User_Upload_Avatar_Folder . "/" . $user_name . "_" . $imgsize . ".jpg";
to
$imgsrc = my_pligg_base . User_Upload_Avatar_Folder . "/" . $user_id . "_" . $imgsize . ".jpg";
 
----------------------
/user.php:
----------------------
change line 72
$last_viewers_avatar[] = get_avatar('small', "", $viewers->username, $viewers->email);
to
$last_viewers_avatar[] = get_avatar('small', "", $viewers->username, $viewers->email,$viewers->id);
 
change line 91
$main_smarty->assign('Avatar_ImgSrc', get_avatar('large', '', $user->username, $user->email));
to
$main_smarty->assign('Avatar_ImgSrc', get_avatar('large', '', $user->username, $user->email,$user->id));
 
change line 296
$results[$key]['Avatar'] = get_avatar('large', "", $val['user_login'], $val['user_email']);
to
$results[$key]['Avatar'] = get_avatar('large', "", $val['user_login'], $val['user_email'], $val['user_id']);
 
----------------------
/topusers.php:
----------------------
change line 98
$main_smarty->assign('user_avatar', get_avatar('large', "", $user->username, $user->email));
to
$main_smarty->assign('user_avatar', get_avatar('large', "", $user->username, $user->email,$user->id));