function onBeforeRegister(&$post, &$default_usergroup) { $plugin = JComponentHelper::getParams('com_users')->get('captcha', JFactory::getConfig()->get('captcha')); if ($plugin === 0 || $plugin === '0' || $plugin === '' || $plugin === null) { return; } $jshopConfig = JSFactory::getConfig(); $app = JFactory::getApplication(); $language = JFactory::getLanguage(); $language->load('plg_captcha_' . $plugin); $captcha = new JCaptcha($plugin, array()); if (!$captcha->checkAnswer($plugin)) { $error = $captcha->getError(); if ($error instanceof Exception) { JError::raiseWarning('', $error); } else { JError::raiseWarning('', new JException($error)); } $app->redirect(SEFLink("index.php?option=com_jshopping&controller=user&task=register", 1, 1, $jshopConfig->use_ssl)); } }