/** * Method to register a user. * * @return boolean True on success, false on failure. * @since 1.6 */ public function register() { // Check for request forgeries. //JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // If registration is disabled - Redirect to login page. if (JComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) { $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); return false; } // Initialise variables. $app = JFactory::getApplication(); $model = $this->getModel('Registration', 'UsersModel'); // Get the user data. $requestData = JRequest::getVar('jform', array(), 'post', 'array'); // Validate the posted data. $form = $model->getForm(); if (!$form) { JError::raiseError(500, $model->getError()); return false; } $data = $model->validate($form, $requestData); // Check for validation errors. if ($data === false) { // Get the validation messages. $errors = $model->getErrors(); // Push up to three validation messages out to the user. for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) { if ($errors[$i] instanceof Exception) { $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); } else { $app->enqueueMessage($errors[$i], 'warning'); } } // Save the data in the session. $app->setUserState('com_users.registration.data', $requestData); foreach ($errors as $error) { if (strstr($error, 'The email address you entered is already in use') !== false) { $app->setUserState('users.registration.errorregis_email', 1); } else { $app->setUserState('users.registration.errorregis_email', 0); } } // Redirect back to the registration screen. //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false)); //REA CHANGE REDIRECT TO URL 03062013 $app->setUserState('users.registration.errorregis', true); $app->setUserState('users.registration.errorregiscount', 0); header("Location: http://" . $_POST["return"]); //$this->setRedirect($_POST["return"]); return false; } // Attempt to save the data. $return = $model->register($data); // Check for errors. if ($return === false) { // Save the data in the session. $app->setUserState('com_users.registration.data', $data); // Redirect back to the edit screen. $this->setMessage(JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError()), 'warning'); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration', false)); $return = ideary::registerDoppler($data); //register doppler //REA CHANGE REDIRECT TO URL 03062013 $this->setRedirect('index.php?codesuccess=110'); return false; } // Flush the data from the session. $app->setUserState('com_users.registration.data', null); $app->setUserState('users.registration.errorregis', false); $app->setUserState('users.registration.errorregiscount', 5); // Redirect to the profile screen. if ($return === 'adminactivate') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY')); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); } elseif ($return === 'useractivate') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE')); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); } elseif ($return === 'register') { $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE')); //$this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); } else { $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS')); //REA 03062013 $this->setRedirect('index.php?codesuccess=110'); // $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false)); } return true; }