function getReturnURL() { $regType = XiptFactory::getSettings('user_reg'); if ($regType === 'jomsocial') { return XiPTRoute::_('index.php?option=com_community&view=register', false); } if (!XIPT_JOOMLA_15) { return XiPTRoute::_('index.php?option=com_users&view=registration', false); } return XiPTRoute::_('index.php?option=com_user&view=register', false); }
//show user reseted //can show 'reseting next 500 user' echo "Reset Page : DO NOT CLOSE THIS WINDOW WHILE RESETTING USERS"; ?> </h3> <?php echo "<br />Total Users " . $this->total; echo "<br />Profile-type id " . $this->id; echo "<br />Syncing-Up " . ($this->start - 1) * $this->limit . " To " . $this->start * $this->limit . " "; $remain = $this->total - $this->start * $this->limit; if ($remain <= 0) { echo "<br />Remaining 0 Users"; } else { echo "<br />Remaining " . $remain . " Users"; } ?> <script> window.onload = function() { setTimeout("xiredirect()", 3000); } function xiredirect(){ window.location = "<?php echo XiPTRoute::_("index.php?option=com_xipt&view=profiletypes&task=resetall&start={$this->start}&id={$this->id}"); ?> " } </script> </div>
function _processSave($post = null, $id = 0) { if ($post === null) { $post = JRequest::get('post'); } $id = JRequest::getVar('id', $id, 'post'); //We only need few data as special case $data = $post; $data['tip'] = JRequest::getVar('tip', $post['tip'], 'post', 'string', JREQUEST_ALLOWRAW); $data['group'] = implode(',', $post['group']); // These data will be seperately stored, we dont want to update these unset($data['watermarkparams']); unset($data['config']); unset($data['privacy']); $model = $this->getModel(); //for Reset we will save old Data // give 0 in loadRecords so that all records will be loaded $allData = $model->loadRecords(0); if (isset($allData[$id])) { $oldData = $allData[$id]; } // set ordering if (end($allData)) { if ($allData[$id]->id == 0) { $data['ordering'] = end($allData)->ordering + 1; } } else { $data['ordering'] = 1; } // now save model $id = $model->save($data, $id); XiptError::assert($id, XiptText::_("{$id} NOT_EXISTS"), XiptError::ERROR); // Now store other data // Handle Avatar : call uploadImage function if post(image) data is set $fileAvatar = JRequest::getVar('FileAvatar', '', 'FILES', 'array'); if (isset($fileAvatar['tmp_name']) && !empty($fileAvatar['tmp_name'])) { XiptHelperProfiletypes::uploadAndSetImage($fileAvatar, $id, 'avatar'); } //display demo on watermark profile according ProfileType if ($post['watermarkparams']['enableWaterMark']) { $post['watermarkparams']['demo'] = $id; } // if jsPrivacyController = 0 then Old privacy set in profile-type table if (is_array($post['privacy']) && $post['privacy']['jsPrivacyController'] == 0) { $oldPrivacy = $model->loadParams($id, 'privacy')->toArray(); $oldPrivacy['jsPrivacyController'] = $post['privacy']['jsPrivacyController']; $post['privacy'] = $oldPrivacy; } // Handle Params : watermarkparams, privacy, config $model->saveParams($post['watermarkparams'], $id, 'watermarkparams'); $model->saveParams($post['config'], $id, 'config'); $model->saveParams($post['privacy'], $id, 'privacy'); // now generate watermark, and update watermark field $image = $this->_saveWatermark($id); //XITODO : Ensure data is reloaded, not cached $newData = $model->loadRecords(0); $newData = $newData[$id]; //to reset privacy of users need to load from loadParams $newData->privacy = $model->loadParams($id, 'privacy'); // Reset existing user's if ($post['resetAll'] && isset($oldData)) { $newData = serialize($newData); //new method $preTask = JRequest::getVar('task', 'save'); $session = JFactory::getSession(); $session->set('oldPtData', $oldData, 'jspt'); $session->set('newPtData', $newData, 'jspt'); $session->set('preTask', $preTask, 'jspt'); if (!XIPT_TEST_MODE) { JFactory::getApplication()->redirect(XiPTRoute::_("index.php?option=com_xipt&view=profiletypes&task=resetall&id={$id}", false)); } $this->resetall($id, 25000); //old method //XiptHelperProfiletypes::resetAllUsers($id, $oldData, $newData); } $info['id'] = $id; $info['msg'] = XiptText::_('PROFILETYPE_SAVED'); return $info; }