本文整理汇总了PHP中UserAuth::updatePermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAuth::updatePermissions方法的具体用法?PHP UserAuth::updatePermissions怎么用?PHP UserAuth::updatePermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserAuth
的用法示例。
在下文中一共展示了UserAuth::updatePermissions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEmailConfirmation
/**
* Check email confirmation code
*
* @return true;
*/
public function checkEmailConfirmation($h)
{
$user_id = $h->cage->get->getInt('id');
$conf = $h->cage->get->getAlnum('conf');
$user = new UserAuth();
$user->getUserBasic($h, $user_id);
if (!$user_id || !$conf) {
$h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red';
}
$sql = "SELECT user_email_conf FROM " . TABLE_USERS . " WHERE user_id = %d";
$user_email_conf = $h->db->get_var($h->db->prepare($sql, $user_id));
if ($conf === $user_email_conf) {
// update role:
$user->role = $h->vars['regStatus'];
$h->pluginHook('user_signin_email_conf_post_role');
// update user with new permissions:
$new_perms = $user->getDefaultPermissions($h, $user->role);
unset($new_perms['options']);
// don't need this for individual users
$user->setAllPermissions($new_perms);
$user->updatePermissions($h);
$user->updateUserBasic($h);
// set email valid to 1:
$sql = "UPDATE " . TABLE_USERS . " SET user_email_valid = %d WHERE user_id = %d";
$h->db->query($h->db->prepare($sql, 1, $user->id));
// notify chosen mods of new user by email:
if ($h->vars['useEmailNotify'] == 'checked' && file_exists(PLUGINS . 'users/libs/UserFunctions.php')) {
require_once PLUGINS . 'users/libs/UserFunctions.php';
$uf = new UserFunctions();
$uf->notifyMods($h, 'user', $user->role, $user->id);
}
$success_message = $h->lang['user_signin_register_emailconf_success'] . " <br /><b><a href='" . $h->url(array('page' => 'login')) . "'>" . $h->lang['user_signin_register_emailconf_success_login'] . "</a></b>";
$h->messages[$success_message] = 'green';
} else {
$h->messages[$h->lang['user_signin_register_emailconf_fail']] = 'red';
}
return true;
}