Example #1
0
 /**
  * 
  * @param unknown_type $properties : Holds the new user data.
  * @param unknown_type $isNew: True if a new user is stored.
  * @param unknown_type $result: True if user was succesfully stored in the database.
  * @param unknown_type $error : Error Message
  */
 function onUserAfterSave($properties, $isNew, $result, $error)
 {
     // we only store new users
     if ($isNew == false || $result == false || $error == true) {
         $this->_pluginHandler->cleanRegistrationSession();
         return true;
     }
     $subscription = XiptFactory::getSettings('subscription_integrate', 0);
     if ($subscription) {
         $profiletypeID = XiptFactory::getSettings('defaultProfiletypeID', 0);
     } else {
         $profiletypeID = $this->_pluginHandler->getRegistrationPType();
     }
     // need to set everything
     XiptLibProfiletypes::updateUserProfiletypeData($properties['id'], $profiletypeID, '', 'ALL');
     //clean the session
     $this->_pluginHandler->cleanRegistrationSession();
     return true;
 }
Example #2
0
 /**
  * The user data have been saved.
  * We will save user's data (profiletype and template) into Xipt tables
  * @param $userId
  * @param $saveSuccess
  * @return unknown_type
  */
 function onAfterProfileUpdate($userId, $saveSuccess)
 {
     // data was not saved, do nothing
     if (false == $saveSuccess) {
         return true;
     }
     // the JomSocial already store values in field tables
     // now we need to apply that information to our tables
     //	    $cuser        = CFactory::getUser($userId);
     //	    $profiletype  = $cuser->getInfo(PROFILETYPE_CUSTOM_FIELD_CODE);
     //	    $template     = $cuser->getInfo(TEMPLATE_CUSTOM_FIELD_CODE);
     $profiletype = XiptHelperUtils::getInfo($userId, PROFILETYPE_CUSTOM_FIELD_CODE);
     $template = XiptHelperUtils::getInfo($userId, TEMPLATE_CUSTOM_FIELD_CODE);
     // Changing Profile From Front End If The Template allow is None then Set Profiletype template.
     // If Template is Allowed on Profile Type Then Take User Define Template From Front End.
     $oldPtype = XiptLibProfiletypes::getUserData($userId, 'PROFILETYPE');
     $OldallowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData($oldPtype, 'allowt');
     $NewallowToChangeTemplate = XiptHelperProfiletypes::getProfileTypeData($profiletype, 'allowt');
     //update profiletype only
     XiptLibProfiletypes::updateUserProfiletypeData($userId, $profiletype, $template, 'ALL');
     //update template seperately
     $filter[] = 'template';
     $allowToChangeTemplate = XiptFactory::getSettings('allow_templatechange', 0);
     if (($NewallowToChangeTemplate == 0 || $OldallowToChangeTemplate == 0) && $allowToChangeTemplate == 0) {
         $newData['template'] = XiptLibProfiletypes::getProfiletypeData($profiletype, 'template');
     } else {
         $newData['template'] = $template;
     }
     XiptLibProfiletypes::updateUserProfiletypeFilteredData($userId, $filter, null, $newData);
     $this->showActivity($userId, $profiletype, $oldPtype);
     return true;
 }
Example #3
0
 /**
  * Use this function to update user's profiletype
  * @param $userId			: Which user's profiletype should be updated
  * @param $profiletypeId	: New Profiletype ID
  * @param $reset			: Which attributes should be reset, default is ALL
  * 							  or you can use (profiletype, jusertype, avatar, group, privacy etc.)
  * @return unknown_type
  */
 function setUserProfiletype($userId, $profiletypeId, $reset = 'ALL')
 {
     return XiptLibProfiletypes::updateUserProfiletypeData($userId, $profiletypeId, null, $reset);
 }