Esempio n. 1
0
 /**
  * This function will not change user's profiletype
  * It only updates user's data, do not add profiletypes
  * @param $userid
  * @param $oldData
  * @param $newData
  * @return unknown_type
  */
 function updateUserProfiletypeFilteredData($userid, $filter, $oldData, $newData)
 {
     XiptError::assert($userid, XiptText::_("USERID {$userid} IS_NOT_VALID"), XiptError::ERROR);
     $uModel = XiptFactory::getInstance('Users', 'model');
     foreach ($filter as $feature) {
         switch ($feature) {
             case 'template':
                 $template = $newData['template'];
                 $ptype = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE');
                 $uModel->save(array('userid' => $userid, 'profiletype' => $ptype, 'template' => $template), $userid);
                 XiptLibJomsocial::updateCommunityCustomField($userid, $template, TEMPLATE_CUSTOM_FIELD_CODE);
                 break;
             case 'jusertype':
                 $newJUtype = $newData['jusertype'];
                 XiptLibJomsocial::updateJoomlaUserType($userid, $newJUtype);
                 break;
             case 'avatar':
                 $newAvatar = $newData['avatar'];
                 XiptLibJomsocial::updateCommunityUserDefaultAvatar($userid, $newAvatar);
                 break;
             case 'watermark':
                 $newWatermark = $newData['watermark'];
                 XiptLibJomsocial::updateCommunityUserWatermark($userid, $newWatermark);
                 break;
             case 'group':
                 $newGroup = $newData['group'];
                 $oldGroup = $oldData['group'];
                 XiptLibJomsocial::updateCommunityUserGroup($userid, $oldGroup, $newGroup);
                 break;
             case 'privacy':
                 $newPrivacy = $newData['privacy'];
                 XiptError::assert($newPrivacy);
                 $newPrivacy = $newPrivacy->toArray();
                 XiptLibJomsocial::updateCommunityUserPrivacy($userid, $newPrivacy);
                 break;
             default:
                 XiptError::assert(0, XiptText::_("NOT_A_VALID_OPTION_TO_FILTER"), XiptError::ERROR);
                 break;
         }
     }
     //IMP : Reseting user already loaded information
     XiptLibJomsocial::reloadCUser($userid);
 }