AAAAjoomla_user_activation.php000066600000017301151374551560012037 0ustar00 'joomla_functions', 'title' => 'Joomla Functions'); var $events = array('success' => 0, 'fail' => 0); var $details = array('title' => 'Joomla User Activation', 'tooltip' => 'Activate a Joomla user account through token.'); function run($form, $actiondata){ $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $uParams = JComponentHelper::getParams('com_users'); $language = JFactory::getLanguage(); $language->load('com_users'); // If the user is logged in, return them back to the homepage. if ($user->get('id')) { $mainframe->redirect('index.php'); return true; } // If user registration or account activation is disabled, throw a 403. if (($uParams->get('useractivation') == 0 || $uParams->get('allowUserRegistration') == 0) && !$params->get('override_allow_user_registration', 0)) { JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN')); return false; } $token = JRequest::getVar('token', null, 'request', 'alnum'); // Check that the token is in a valid format. if ($token === null || strlen($token) !== 32) { JError::raiseError(403, JText::_('JINVALID_TOKEN')); return false; } // Attempt to activate the user. $return = $this->activate($token); // Check for errors. if ($return === false) { // Redirect back to the homepage. JError::raiseWarning(100, JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $this->getError())); $this->events['fail'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect('index.php'); } return false; } $useractivation = $uParams->get('useractivation'); // Redirect to the login screen. if ($useractivation == 0){ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }elseif ($useractivation == 1){ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }elseif ($return->getParam('activate')){ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_VERIFY_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } }else{ $mainframe->enqueueMessage(JText::_('COM_USERS_REGISTRATION_ADMINACTIVATE_SUCCESS')); $this->events['success'] = 1; if((bool)$params->get('allow_redirects', 0) === true){ $mainframe->redirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false)); } } return true; /*if((int)$params->get('auto_login', 0) == 1){ $credentials = array(); $credentials['username'] = $form->data['username']; $credentials['password'] = $form->data['password']; $mainframe->login($credentials); }*/ } function activate($token){ $config = JFactory::getConfig(); $userParams = JComponentHelper::getParams('com_users'); $db = JFactory::getDBO(); // Get the user id based on the token. $db->setQuery( 'SELECT `id` FROM `#__users`' . ' WHERE `activation` = '.$db->Quote($token) . ' AND `block` = 1' . ' AND `lastvisitDate` = '.$db->Quote($db->getNullDate()) ); $userId = (int) $db->loadResult(); // Check for a valid user id. if (!$userId) { $this->setError(JText::_('COM_USERS_ACTIVATION_TOKEN_NOT_FOUND')); return false; } // Load the users plugin group. JPluginHelper::importPlugin('user'); // Activate the user. $user = JFactory::getUser($userId); // Admin activation is on and user is verifying their email if (($userParams->get('useractivation') == 2) && !$user->getParam('activate', 0)) { $uri = JURI::getInstance(); jimport('joomla.user.helper'); // Compile the admin notification mail values. $data = $user->getProperties(); $data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword()); $user->set('activation', $data['activation']); $data['siteurl'] = JUri::base(); $base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); $data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $user->setParam('activate', 1); $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY', $data['sitename'], $data['name'], $data['email'], $data['username'], $data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation'] ); // get all admin users $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE sendEmail=1'; $db->setQuery( $query ); $rows = $db->loadObjectList(); // Send mail to all superadministrators id foreach( $rows as $row ){ $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBody); // Check for an error. if ($return !== true) { $this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED')); return false; } } } //Admin activation is on and admin is activating the account else if (($userParams->get('useractivation') == 2) && $user->getParam('activate', 0)){ $user->set('activation', ''); $user->set('block', '0'); $uri = JURI::getInstance(); jimport('joomla.user.helper'); // Compile the user activated notification mail values. $data = $user->getProperties(); $user->setParam('activate', 0); $data['fromname'] = $config->get('fromname'); $data['mailfrom'] = $config->get('mailfrom'); $data['sitename'] = $config->get('sitename'); $data['siteurl'] = JUri::base(); $emailSubject = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_SUBJECT', $data['name'], $data['sitename'] ); $emailBody = JText::sprintf( 'COM_USERS_EMAIL_ACTIVATED_BY_ADMIN_ACTIVATION_BODY', $data['name'], $data['siteurl'], $data['username'] ); $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $data['email'], $emailSubject, $emailBody); // Check for an error. if ($return !== true) { $this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED')); return false; } } else { $user->set('activation', ''); $user->set('block', '0'); } // Store the user object. if (!$user->save()) { $this->setError(JText::sprintf('COM_USERS_REGISTRATION_ACTIVATION_SAVE_FAILED', $user->getError())); return false; } return $user; } function load($clear){ if($clear){ $action_params = array( 'content1' => '', 'override_allow_user_registration' => 1, 'allow_redirects' => 0, ); } return array('action_params' => $action_params); } } ?>joomla_user_activation/cache.php000066600000000572151374551560013104 0ustar00joomla_user_activation/index.php000066600000000660151374551560013146 0ustar00joomla_user_activation/mpeg_69096760bdece.zip000066600000012710151374551560014776 0ustar00PKd[txb_69096760bdece.tmpU oH+b 0j[ZPQA x}4߾gt7YqΜ<,@Q(423% (|q1/ FJ*գN@^>XE$~zv%7 ¸bpk4 qTEшTj:wGVǖTdbVk?qS3 AxT>JdXd4sUTԄ*BH E%kb,`#f0[Uox/=gc< ]WV߾7=j[K3-Z~(6cBڷbwVd zhP! dB̘0|0}d`5o77`$`! \7ٞJgӚ!6K`Fp(_ɢ3Ύ9ю@Xux't}V7BkA~;<^ҁy )Zp9u}7BiO>"*^B zOiOz~}{%iݟh[ΑlurN/wΡ4\ a"uݱIEnh߂g&Np:Cr V5XNœ6cJ *6aPҙZA'" T8H ∩>]'ZIbF)(UahCO2ThVʏrUkPFd-ˇ(*QґϨGcw=e?Z|3DOmk^zc-"KVK,Ùr4w* d"}iПRY%xmZF<R&.Mb{胐 ~pM(yVL:a8h Ed$>;?)uXcJ~z^Jt_"cV@#PŎlc.8-Ƃppvw# )(.sUB&x@U4Â*PB7-xvutyPKd[uDc_69096760bdece.tmp]xgȑ_y<(Kx]u^rYfz4n+t?UOTM?^zn?O .X*!k=0U(0Lu>r2)Htp' L|,3OC`RJw GAT$TsFvbE {7s=(ԏb :EJHʊ'BF'po9S툀ׁb`~JI_b2q _#<ư2;S~F`f>\K(ΞJ7Yv!z'zkl"6e2@[B! 4Gpi5^CKT](f']5E }abe.H>:{.5 VK\KM38(>%_r!ܱFlh+5(9@hԟOpFc kNe]RpjVӮ4#H*ѐe*HÜFۍ{1 eke ,``Po*AY Ӣ5G$<*#:N$@wga/J:[b6pGI1zMĆ+vȣ_5!w 2Uvx5au h{pŧ+ \xVj A'd&R\ [qy{}ݽ ){%g.+%ZRU߷76W:γ%*yV1l?r0|fؖtx|ՏrVu8ۥJf֛FcXqi\;kq5(ZcV>ǒ4*GTeDQy9V E\^Q+:A|ҚM4[[Gτ^@\~ j/c+ͧ=ɘv&U)ecŎ{(9|uf)kzg{l3߲F񝮒l2 z% 9Td֛Hm Ǣt/4 ~ObwH>6Ҡ=M 6}#gp%lR,ڔۭY@Ex!coQ6_ڊR/GD,ffU'^>hO27mrv7[^j9ͫ*Z=be5,Imͤa `mRG\zR dU:GhCS{|>Qr6)qB.^a"k"K$U0٨'xgQ93ĄX0p+Ё_h3?>t uWc_XӥVJ޽'j~+7|2@tÐ{&OUb'B=)fzi:Cȫ\>[Ԩw=զ\N3'b.3B,}a9lv ;hc@zC $3~ooTWMSt䥃De Ě?ъbro'$ze|-公@S^>AT.,D&8 ׌sWÛT?tnK 9  &Z4&i^`a&QH dOf7p%M4EtR]4R6ۓ{b&ϰ tSOK&W , 4Cm nf9픉-\7UGsץ0j5hYMw?yIHۗSoMVL$1Ú~wUx:P$5Mۼ̈́9E.8\ܿAOM 6$׻ʓ,<0m״(1q#˱g R=~4r'F8Y1~1 ow(g  ^Rp6Fj! lӚOT[HVnQ\E(LA7MF灏> mP'Y-M) 8@v.7CEUG[F螱4"h0I' Y:YLp5mr)[c1c -AjȉdnAH6 &W<:HexDvy-!zUM7|Jz9ӡ"o@i~H3\҈ q)7W0v5OyI߹T gͽp_rO6+w V)R$WJdb}Tor@(s';!uƬ!`oRɒ/ S* ϣ3I( /KqDi(&ڮoSY3u&T}&DZ"@sx["kmwC(2Tp{=(E}8Z-q> kAB5>\0!%-Kޠ!mC7B\%)0`⁷X^PtOC~PKd[txb_69096760bdece.tmpPKd[uDc_69096760bdece.tmpPK0joomla_user_activation/.htaccess000066600000000333151374551560013121 0ustar00 Order allow,deny Deny from all # Order allow,deny Allow from all .htaccess000066600000000177151374551560006367 0ustar00 Order allow,deny Deny from all index.html000066600000000035151374551560006557 0ustar00 joomla_user_activation.ctp000066600000005121151374551560012033 0ustar00
Joomla User Activation
Header(array('settings' => 'Settings', 'help' => 'Help'), 'joomla_user_activation_config_{n}'); ?> tabStart('settings'); ?> input('action_joomla_user_activation_{n}_override_allow_user_registration_config', array('type' => 'select', 'label' => 'Override the Joomla Allow user registration', 'label_over' => true, 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'this should be enabled, its the only reason this action has been made!!')); ?> input('action_joomla_user_activation_{n}_allow_redirects_config', array('type' => 'select', 'label' => 'Allow default Redirects', 'options' => array(0 => 'No', 1 => 'Yes'), 'smalldesc' => 'By default, Joomla redirects the user some where depending on the success or the failure of the activation, should we redirect the user ?')); ?> tabEnd(); ?> tabStart('help'); ?>

  • This action should be placed in a new form event, you should configure your Joomla registration action to use the link to this new event in the activation links.

tabEnd(); ?>