1
DeZ125
System Avatars
  • 2005/11/29 13:31

  • DeZ125

  • Just popping in

  • Posts: 26

  • Since: 2005/3/29


Hope someone can help me with this. We're currently running XOOPS 2.2.3 and are having problems selecting system avatars, but uploading our own works perfectly. When I go into extended profiles and try to select a system avatar, I can list them fine and select one ok click submit and everything looks fine, but when redirected back to the profile page the original avatar is still showing, it just won't change the avatar at all if it's a system one.

I've been through the database ( tried anyway ) and can't see anything that might cause a problem, and i also deleted the xoops_avatar table (following Benders tutorial) and I still cannot select a system avatar :(

Any help would be greatly appreciated.

DeZ

2
DeZ125
Re: System Avatars
  • 2006/1/4 15:42

  • DeZ125

  • Just popping in

  • Posts: 26

  • Since: 2005/3/29


bump

3
DeZ125
Re: System Avatars
  • 2006/11/9 15:20

  • DeZ125

  • Just popping in

  • Posts: 26

  • Since: 2005/3/29


Still having problems with avatars. XOOPS will allow the upload of custom avatars, but when redirected to the profile page the old avatar still shows. Also, we STILL cannot change avatars using the system one's.

Please help,

DeZ

Xoops 2.2.4 is now being used.

4
hkats
Re: System Avatars
  • 2006/12/2 7:44

  • hkats

  • Just popping in

  • Posts: 5

  • Since: 2005/12/10


this is also a problem on our site which is also using 2.24
users cannot change thier avatars though the process seems to go through when you select a system avatar.

i have gone over the edituser.php and the change avatar php looks ok to me but maybe there is something i am missing?
if ($op == 'avatarform') {
    include 
XOOPS_ROOT_PATH.'/header.php';
    echo 
'.$xoopsUser->getVar('uid').'">'_PROFILE_MA_PROFILE .»» '_PROFILE_MA_UPLOADMYAVATAR .'';
    
$oldavatar $xoopsUser->getVar('user_avatar');
    if (!empty(
$oldavatar) && $oldavatar != 'blank.gif') {
        echo 
''._PROFILE_MA_OLDDELETED.'';
        echo 
'.XOOPS_UPLOAD_URL.'/'.$oldavatar.'" alt="" />
';
    }
    if (
$xoopsModuleConfig['avatar_allow_upload'] == && $xoopsUser->getVar('posts') >= $xoopsModuleConfig['avatar_minposts']) {
        include_once 
XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
        
$form = new XoopsThemeForm(_PROFILE_MA_UPLOADMYAVATAR'uploadavatar''edituser.php''post'true);
        
$form->setExtra('enctype="multipart/form-data"');
        
$form->addElement(new XoopsFormLabel(_PROFILE_MA_MAXPIXEL$xoopsModuleConfig['avatar_width'].' x '.$xoopsModuleConfig['avatar_height']));
        
$form->addElement(new XoopsFormLabel(_PROFILE_MA_MAXIMGSZ$xoopsModuleConfig['avatar_maxsize']));
        
$form->addElement(new XoopsFormFile(_PROFILE_MA_SELFILE'avatarfile'$xoopsModuleConfig['avatar_maxsize']), true);
        
$form->addElement(new XoopsFormHidden('op''avatarupload'));
        
$form->addElement(new XoopsFormHidden('uid'$xoopsUser->getVar('uid')));
        
$form->addElement(new XoopsFormButton('''submit'_SUBMIT'submit'));
            
$form->display();
    }
    
$avatar_handler =& xoops_gethandler('avatar');
    
$form2 = new XoopsThemeForm(_PROFILE_MA_CHOOSEAVT'uploadavatar''edituser.php''post'true);
    
$avatar_select = new XoopsFormSelect('''user_avatar'$xoopsUser->getVar('user_avatar'));
    
$avatar_select->addOptionArray($avatar_handler->getList('S'));
    
$avatar_select->setExtra("onchange='showImgSelected("avatar", "user_avatar", "uploads", "", "".XOOPS_URL."")'");
    
$avatar_tray = new XoopsFormElementTray(_PROFILE_MA_AVATAR' ');
    
$avatar_tray->addElement($avatar_select);
    
$avatar_tray->addElement(new XoopsFormLabel(''".XOOPS_UPLOAD_URL."/".$xoopsUser->getVar("user_avatar""E")."' name='avatar' id='avatar' alt='' /> javascript:openWithSelfMain('".XOOPS_URL."/misc.php?action=showpopups&type=avatars','avatars',600,400);">"._LIST.""));
    
$form2->addElement($avatar_tray);
    
$form2->addElement(new XoopsFormHidden('uid'$xoopsUser->getVar('uid')));
    
$form2->addElement(new XoopsFormHidden('op''avatarchoose'));
    
$form2->addElement(new XoopsFormButton('''submit2'_SUBMIT'submit'));
    
$form2->display();
}

if (
$op == 'avatarupload') {
    if (!
$GLOBALS['xoopsSecurity']->check()) {
        
redirect_header('index.php',3,_PROFILE_MA_NOEDITRIGHT."".implode(''$GLOBALS['xoopsSecurity']->getErrors()));
        exit;
    }
    
$xoops_upload_file = array();
    
$uid 0;
    if (!empty(
$_POST['xoops_upload_file']) && is_array($_POST['xoops_upload_file'])){
        
$xoops_upload_file $_POST['xoops_upload_file'];
    }
    if (!empty(
$_POST['uid'])) {
        
$uid intval($_POST['uid']);
    }
    if (empty(
$uid) || $xoopsUser->getVar('uid') != $uid ) {
        
redirect_header('index.php',3,_PROFILE_MA_NOEDITRIGHT);
        exit();
    }
    if (
$xoopsModuleConfig['avatar_allow_upload'] == && $xoopsUser->getVar('posts') >= $xoopsModuleConfig['avatar_minposts']) {
        include_once 
XOOPS_ROOT_PATH.'/class/uploader.php';
        
$uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif''image/jpeg''image/pjpeg''image/x-png''image/png'), $xoopsModuleConfig['avatar_maxsize'], $xoopsModuleConfig['avatar_width'], $xoopsModuleConfig['avatar_height']);
        if (
$uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
            
$uploader->setPrefix('cavt');
            if (
$uploader->upload()) {
                
$avt_handler =& xoops_gethandler('avatar');
                
$avatar =& $avt_handler->create();
                
$avatar->setVar('avatar_file'$uploader->getSavedFileName());
                
$avatar->setVar('avatar_name'$xoopsUser->getVar('uname'));
                
$avatar->setVar('avatar_mimetype'$uploader->getMediaType());
                
$avatar->setVar('avatar_display'1);
                
$avatar->setVar('avatar_type''C');
                if (!
$avt_handler->insert($avatar)) {
                    @
unlink($uploader->getSavedDestination());
                } else {
                    
$oldavatar $xoopsUser->getVar('user_avatar');
                    if (!empty(
$oldavatar) && $oldavatar != 'blank.gif' && !preg_match("/^savt/"strtolower($oldavatar))) {
                        
$avatars =& $avt_handler->getObjects(new Criteria('avatar_file'$oldavatar));
                        
$avt_handler->delete($avatars[0]);
                        
$oldavatar_path str_replace("\""/"realpath(XOOPS_UPLOAD_PATH.'/'.$oldavatar));
                        if (
=== strpos($oldavatar_pathXOOPS_UPLOAD_PATH) && is_file($oldavatar_path)) {
                            
unlink($oldavatar_path);
                        }
                    }
                    
$sql sprintf("UPDATE %s SET user_avatar = %s WHERE uid = %u"$xoopsDB->prefix('users'), $xoopsDB->quoteString($uploader->getSavedFileName()), $xoopsUser->getVar('uid'));
                    
$xoopsDB->query($sql);
                    
$avt_handler->addUser($avatar->getVar('avatar_id'), $xoopsUser->getVar('uid'));

5
robyduck
Re: System Avatars
  • 2008/8/7 13:54

  • robyduck

  • Just popping in

  • Posts: 16

  • Since: 2005/2/3 2


I've the same problem, using 2.0.x
Usersare not able to change the system avatar. They can select the avatar and click on OK, but the avatar won't be written in the database.
Could it be a problem with the permissions on some files?
Bye

Login

Who's Online

294 user(s) are online (149 user(s) are browsing Support Forums)


Members: 0


Guests: 294


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits