本文整理汇总了PHP中JUserHelper::activateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP JUserHelper::activateUser方法的具体用法?PHP JUserHelper::activateUser怎么用?PHP JUserHelper::activateUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUserHelper
的用法示例。
在下文中一共展示了JUserHelper::activateUser方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate
function activate()
{
$mainframe = JFactory::getApplication();
// Initialize some variables
$db = JFactory::getDBO();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$pathway =& $mainframe->getPathWay();
$usersConfig = JComponentHelper::getParams('com_users');
$userActivation = $usersConfig->get('useractivation');
$allowUserRegistration = $usersConfig->get('allowUserRegistration');
// Check to see if they're logged in, because they don't need activating!
if ($user->get('id')) {
// They're already logged in, so redirect them to the home page
$mainframe->redirect('index.php');
}
if ($allowUserRegistration == '0' || $userActivation == '0') {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
// create the view
require_once JPATH_COMPONENT . DS . 'views' . DS . 'register' . DS . 'view.html.php';
$view = new UserViewRegister();
$message = new stdClass();
// Do we even have an activation string?
$activation = JRequest::getVar('activation', '', '', 'alnum');
$activation = $db->getEscaped($activation);
if (empty($activation)) {
// Page Title
$document->setTitle(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
// Breadcrumb
$pathway->addItem(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
$message->title = JText::_('REG_ACTIVATE_NOT_FOUND_TITLE');
$message->text = JText::_('REG_ACTIVATE_NOT_FOUND');
$view->assign('message', $message);
$view->display('message');
return;
}
// Lets activate this user
jimport('joomla.user.helper');
if (JUserHelper::activateUser($activation)) {
// Page Title
$document->setTitle(JText::_('REG_ACTIVATE_COMPLETE_TITLE'));
// Breadcrumb
$pathway->addItem(JText::_('REG_ACTIVATE_COMPLETE_TITLE'));
$message->title = JText::_('REG_ACTIVATE_COMPLETE_TITLE');
$message->text = JText::_('REG_ACTIVATE_COMPLETE');
} else {
// Page Title
$document->setTitle(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
// Breadcrumb
$pathway->addItem(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
$message->title = JText::_('REG_ACTIVATE_NOT_FOUND_TITLE');
$message->text = JText::_('REG_ACTIVATE_NOT_FOUND');
}
$view->assign('message', $message);
$view->display('message');
}
示例2: testActivateUser
/**
* Testing activateUser().
*
* @param string $activation Activation string
* @param boolean $expected Expected params
*
* @dataProvider casesActivateUser
* @covers JUserHelper::activateUser
* @return void
*
* @since 12.3
*/
public function testActivateUser($activation, $expected)
{
$this->markTestSkipped('Unexpected test failure in CMS environment');
$this->assertThat(JUserHelper::activateUser($activation), $this->equalTo($expected));
}
示例3: testActivateUser
/**
* Testing activateUser().
*
* @param string $activation Activation string
* @param boolean $expected Expected params
*
* @dataProvider casesActivateUser
* @covers JUserHelper::activateUser
* @return void
*
* @since 12.3
*/
public function testActivateUser($activation, $expected)
{
$this->assertEquals(JUserHelper::activateUser($activation), $expected);
}
示例4: testActivateUser
/**
* Testing activateUser().
*
* @param string $activation Activation string
* @param boolean $expected Expected params
*
* @dataProvider casesActivateUser
* @covers JUserHelper::activateUser
* @return void
*
* @since 12.3
*/
public function testActivateUser($activation, $expected)
{
$this->assertThat(
JUserHelper::activateUser($activation),
$this->equalTo($expected)
);
}
示例5: activateUser
/**
* Helper wrapper method for activateUser
*
* @param string $activation Activation string
*
* @return boolean True on success
*
* @see JUserHelper::activateUser()
* @since 3.4
*/
public function activateUser($activation)
{
return JUserHelper::activateUser($activation);
}
示例6: activateuser
function activateuser()
{
global $mainframe;
// Initialize some variables
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
$pathway =& $mainframe->getPathWay();
$usersConfig =& JComponentHelper::getParams('com_users');
$userActivation = $usersConfig->get('useractivation');
$allowUserRegistration = $usersConfig->get('allowUserRegistration');
// Check to see if they're logged in, because they don't need activating!
if ($user->get('id')) {
// They're already logged in, so redirect them to the home page
$mainframe->redirect('index.php');
}
if ($allowUserRegistration == '0' || $userActivation == '0') {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
// create the view
require_once JPATH_COMPONENT . DS . 'views' . DS . 'register' . DS . 'view.html.php';
$view = new UserViewRegister();
$message = new stdClass();
// Do we even have an activation string?
$activation = JRequest::getVar('activation', '', '', 'alnum');
$activation = $db->getEscaped($activation);
if (empty($activation)) {
// Page Title
$document->setTitle(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
// Breadcrumb
$pathway->addItem(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
$message->title = JText::_('REG_ACTIVATE_NOT_FOUND_TITLE');
$message->text = JText::_('REG_ACTIVATE_NOT_FOUND');
$view->assign('message', $message);
$view->display('message');
return;
}
$query = 'SELECT id' . ' FROM #__users' . ' WHERE activation = ' . $db->Quote($activation) . ' AND block = 1' . ' AND lastvisitDate = ' . $db->Quote('0000-00-00 00:00:00');
$db->setQuery($query);
$userid = intval($db->loadResult());
// Lets activate this user
jimport('joomla.user.helper');
if (JUserHelper::activateUser($activation)) {
// Page Title
$document->setTitle(JText::_('REG_ACTIVATE_COMPLETE_TITLE'));
// Breadcrumb
$pathway->addItem(JText::_('REG_ACTIVATE_COMPLETE_TITLE'));
$message->title = JText::_('REG_ACTIVATE_COMPLETE_TITLE');
$message->text = JText::_('REG_ACTIVATE_COMPLETE');
if ($userid != 0) {
$query = "select profile_id from #__community_users where userid={$userid}";
$db->setQuery($query);
$profileInfo = $db->loadObject();
//If profile exists
if ($profileInfo !== false) {
/* HOOKED - no profile ID
//If user is a contractor
if($profileInfo->profile_id == 2) // Contractor Profile ID is 2
{
*/
//Forward user to Saasy
$this->setRedirect("http://sites.fastspring.com/{$this->company}/product/{$this->product}");
/* } */
}
}
} else {
// Page Title
$document->setTitle(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
// Breadcrumb
$pathway->addItem(JText::_('REG_ACTIVATE_NOT_FOUND_TITLE'));
$message->title = JText::_('REG_ACTIVATE_NOT_FOUND_TITLE');
$message->text = JText::_('REG_ACTIVATE_NOT_FOUND');
}
$view->assign('message', $message);
$view->display('message');
}
示例7: testActivateUser
/**
* Testing activateUser().
*
* @param string $activation Activation string
* @param boolean $expected Expected params
*
* @dataProvider casesActivateUser
* @covers JUserHelper::activateUser
* @return void
*
* @since 12.3
*/
public function testActivateUser($activation, $expected)
{
// Configure the container
$container = (new \Joomla\DI\Container())->set('dispatcher', $this->getMockDispatcher())->set('db', static::$driver);
JFactory::$container = $container;
$this->assertEquals(JUserHelper::activateUser($activation), $expected);
}
示例8: activate
function activate()
{
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$usersConfig = JComponentHelper::getParams('com_users');
$userActivation = $usersConfig->get('useractivation');
$allowUserRegistration = $usersConfig->get('allowUserRegistration');
if ($user->get('id')) {
$app->redirect(hikashop_completeLink('checkout', false, true));
}
if ($allowUserRegistration == '0' || $userActivation == '0') {
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
$lang = JFactory::getLanguage();
$lang->load('com_user', JPATH_SITE);
jimport('joomla.user.helper');
$activation = hikashop_getEscaped(JRequest::getVar('activation', '', '', 'alnum'));
if (empty($activation)) {
$app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_NOT_FOUND'));
return;
}
if (version_compare(JVERSION, '1.6', '<')) {
$result = JUserHelper::activateUser($activation);
} else {
if (HIKASHOP_J30) {
JModelLegacy::addIncludePath(HIKASHOP_ROOT . DS . 'components' . DS . 'com_users' . DS . 'models');
} else {
JModel::addIncludePath(HIKASHOP_ROOT . DS . 'components' . DS . 'com_users' . DS . 'models');
}
$model = $this->getModel('Registration', 'UsersModel', array(), true);
$language = JFactory::getLanguage();
$language->load('com_users', JPATH_SITE, $language->getTag(), true);
if ($model) {
$result = $model->activate($activation);
}
}
if (!$result) {
$app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_NOT_FOUND'));
return;
} else {
$app->enqueueMessage(JText::_('HIKA_REG_ACTIVATE_COMPLETE'));
$id = JRequest::getInt('id', 0);
$class = hikashop_get('class.user');
$user = $class->get($id);
if ($id && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_comprofiler' . DS . 'comprofiler.php') && $userActivation < 2) {
$class->addAndConfirmUserInCB($user);
}
$infos = JRequest::getVar('infos', '');
global $Itemid;
$url = '';
if (!empty($Itemid)) {
$url = '&Itemid=' . $Itemid;
}
if (!empty($infos) && function_exists('json_decode')) {
$infos = json_decode(base64_decode($infos), true);
JPluginHelper::importPlugin('user');
if ($userActivation < 2 && !empty($infos['passwd']) && !empty($infos['username']) && $this->_doLogin($infos['username'], $infos['passwd'], false)) {
$page = JRequest::getString('page', 'checkout');
if ($page == 'checkout') {
$this->before_address();
$app->redirect(hikashop_completeLink('checkout' . $url, false, true));
} else {
JRequest::setVar('layout', 'activate');
return parent::display();
}
} elseif ($userActivation >= 2) {
$app->enqueueMessage(JText::_('HIKA_ADMIN_CONFIRM_ACTIVATION'));
}
}
if (version_compare(JVERSION, '1.6', '<')) {
$url = 'index.php?option=com_user&view=login' . $url;
} else {
$url = 'index.php?option=com_users&view=login' . $url;
}
$app->redirect(JRoute::_($url, false));
}
}