public function register($data = null) { //require_once (JPATH_COMPONENT.'/libraries/profile.php'); $mainframe = JFactory::getApplication(); $my = CFactory::getUser(); $config = CFactory::getConfig(); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_REGISTER_NEW')); // Hide this form for logged in user if ($my->id) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_REGISTER_ALREADY_USER'), 'warning'); return; } // If user registration is not allowed, show 403 not authorized. $usersConfig = JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { //show warning message $this->addWarning(JText::_('COM_COMMUNITY_REGISTRATION_DISABLED')); return; } $fields = array(); $post = JRequest::get('post'); $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $data = array(); $data['fields'] = $fields; $data['html_field']['jsname'] = empty($post['jsname']) ? '' : $post['jsname']; $data['html_field']['jsusername'] = empty($post['jsusername']) ? '' : $post['jsusername']; $data['html_field']['jsemail'] = empty($post['jsemail']) ? '' : $post['jsemail']; $data['html_field']['jsfirstname'] = empty($post['jsfirstname']) ? '' : $post['jsfirstname']; $data['html_field']['jslastname'] = empty($post['jslastname']) ? '' : $post['jslastname']; // $js = 'assets/validate-1.5.min.js'; // CFactory::attach($js, 'js'); $recaptcha = new CRecaptchaHelper(); $recaptchaHTML = $recaptcha->html(); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) { //CFactory::load( 'libraries' , 'facebook' ); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } if ($config->get('usejfbc')) { if (class_exists('JFBCFactory')) { $providers = JFBCFactory::getAllProviders(); foreach ($providers as $p) { $fbHtml .= $p->loginButton(); } } } $tmpl = new CTemplate(); $content = $tmpl->set('data', $data)->set('recaptchaHTML', $recaptchaHTML)->set('config', $config)->set('isUseFirstLastName', $isUseFirstLastName)->set('fbHtml', $fbHtml)->fetch('register/base'); $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $args = array(&$content); $appsLib->triggerEvent('onUserRegisterFormDisplay', $args); echo $this->_getProgressBar(1); echo $content; }