本文整理汇总了PHP中CB\Database\Table\UserTable::getUserIdFromActivationCode方法的典型用法代码示例。如果您正苦于以下问题:PHP UserTable::getUserIdFromActivationCode方法的具体用法?PHP UserTable::getUserIdFromActivationCode怎么用?PHP UserTable::getUserIdFromActivationCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CB\Database\Table\UserTable
的用法示例。
在下文中一共展示了UserTable::getUserIdFromActivationCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: confirm
function confirm($confirmcode)
{
global $_CB_framework, $_PLUGINS;
$_PLUGINS->loadPluginGroup('user');
$_PLUGINS->trigger('onBeforeUserConfirmationRequest', array());
if ($_CB_framework->myId() < 1) {
$unscrambledId = UserTable::getUserIdFromActivationCode($confirmcode);
if ($unscrambledId) {
$cbUser = CBuser::getInstance((int) $unscrambledId);
if ($cbUser) {
$user = $cbUser->getUserData();
if ($user && $user->id) {
if ($user->confirmed == 0) {
if ($user->checkActivationCode($confirmcode)) {
// THIS is the normal case: user exists, is not yet confirmed, and confirmation code does match:
$messagesToUser = null;
$confirmed = $user->confirmUser(1, $messagesToUser);
} else {
// confirmation code does not match:
$messagesToUser = array(CBTxt::Th('UE_WRONG_CONFIRMATION_CODE', 'Wrong confirmation code. Please check your Email and spambox.'));
$confirmed = false;
}
} else {
// User has already confirmed: show friendly activation messages depending on his state:
$messagesToUser = getActivationMessage($user, 'UserConfirmation');
$confirmed = true;
}
if ($confirmed) {
// THIS is the normal case: user exists, is not yet confirmed, and confirmation code does match:
$class = 'info';
} else {
$class = 'error';
}
$_PLUGINS->trigger('onAfterUserConfirmation', array(&$user, $confirmcode, $confirmed, &$class, &$messagesToUser));
$return = '<div class="cbUserConfirmation cb_template cb_template_' . selectTemplate('dir') . '">' . '<div class="' . htmlspecialchars($class) . '">' . implode('</div><div class="' . htmlspecialchars($class) . '">', $messagesToUser) . '</div>' . '</div>';
echo $return;
return;
}
}
}
// this is the error case where the URL is simply not right:
cbNotAuth(true);
return;
} else {
$_CB_framework->enqueueMessage(CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!') . ' ' . CBTxt::Th('UE_DO_LOGOUT', 'You need to logout.'), 'error');
}
}