• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_delete_project_specific_access_levels函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_delete_project_specific_access_levels函数的典型用法代码示例。如果您正苦于以下问题:PHP user_delete_project_specific_access_levels函数的具体用法?PHP user_delete_project_specific_access_levels怎么用?PHP user_delete_project_specific_access_levels使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了user_delete_project_specific_access_levels函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: user_delete

function user_delete($p_user_id)
{
    $c_user_id = db_prepare_int($p_user_id);
    $t_user_table = config_get('mantis_user_table');
    user_ensure_unprotected($p_user_id);
    # Remove associated profiles
    user_delete_profiles($p_user_id);
    # Remove associated preferences
    user_pref_delete_all($p_user_id);
    # Remove project specific access levels
    user_delete_project_specific_access_levels($p_user_id);
    #unset non-unique realname flags if necessary
    if (config_get('differentiate_duplicates')) {
        $c_realname = db_prepare_string(user_get_field($p_user_id, 'realname'));
        $query = "SELECT id\n\t\t\t\t\tFROM {$t_user_table}\n\t\t\t\t\tWHERE realname='{$c_realname}'";
        $result = db_query($query);
        $t_count = db_num_rows($result);
        if ($t_count == 2) {
            # unset flags if there are now only 2 unique names
            for ($i = 0; $i < $t_count; $i++) {
                $t_user_id = db_result($result, $i);
                user_set_field($t_user_id, 'duplicate_realname', OFF);
            }
        }
    }
    user_clear_cache($p_user_id);
    # Remove account
    $query = "DELETE FROM {$t_user_table}\n\t\t\t\t  WHERE id='{$c_user_id}'";
    db_query($query);
    return true;
}
开发者ID:renemilk,项目名称:spring-website,代码行数:31,代码来源:user_api.php


示例2: user_delete

/**
 * delete a user account (account, profiles, preferences, project-specific access levels)
 * returns true when the account was successfully deleted
 *
 * @param integer $p_user_id A valid user identifier.
 * @return boolean Always true
 */
function user_delete($p_user_id)
{
    $c_user_id = (int) $p_user_id;
    user_ensure_unprotected($p_user_id);
    # Remove associated profiles
    user_delete_profiles($p_user_id);
    # Remove associated preferences
    user_pref_delete_all($p_user_id);
    # Remove project specific access levels
    user_delete_project_specific_access_levels($p_user_id);
    # unset non-unique realname flags if necessary
    if (config_get('differentiate_duplicates')) {
        $c_realname = user_get_field($p_user_id, 'realname');
        $t_query = 'SELECT id FROM {user} WHERE realname=' . db_param();
        $t_result = db_query($t_query, array($c_realname));
        $t_users = array();
        while ($t_row = db_fetch_array($t_result)) {
            $t_users[] = $t_row;
        }
        $t_user_count = count($t_users);
        if ($t_user_count == 2) {
            # unset flags if there are now only 2 unique names
            for ($i = 0; $i < $t_user_count; $i++) {
                $t_user_id = $t_users[$i]['id'];
                user_set_field($t_user_id, 'duplicate_realname', OFF);
            }
        }
    }
    user_clear_cache($p_user_id);
    # Remove account
    $t_query = 'DELETE FROM {user} WHERE id=' . db_param();
    db_query($t_query, array($c_user_id));
    return true;
}
开发者ID:pkdevboxy,项目名称:mantisbt,代码行数:41,代码来源:user_api.php


示例3: db_prepare_string

$c_realname = db_prepare_string($f_realname);
$c_protected = db_prepare_bool($f_protected);
$c_enabled = db_prepare_bool($f_enabled);
$c_user_id = db_prepare_int($f_user_id);
$c_access_level = db_prepare_int($f_access_level);
$t_user_table = config_get('mantis_user_table');
$t_old_protected = user_get_field($f_user_id, 'protected');
# check that we are not downgrading the last administrator
$t_old_access = user_get_field($f_user_id, 'access_level');
if (ADMINISTRATOR == $t_old_access && $t_old_access != $f_access_level && 1 >= user_count_level(ADMINISTRATOR)) {
    trigger_error(ERROR_USER_CHANGE_LAST_ADMIN, ERROR);
}
# Project specific access rights override global levels, hence, for users who are changed
# to be administrators, we have to remove project specific rights.
if ($c_access_level >= ADMINISTRATOR && !user_is_administrator($c_user_id)) {
    user_delete_project_specific_access_levels($c_user_id);
}
# if the user is already protected and the admin is not removing the
#  protected flag then don't update the access level and enabled flag.
#  If the user was unprotected or the protected flag is being turned off
#  then proceed with a full update.
if ($f_protected && $t_old_protected) {
    $query = "UPDATE {$t_user_table}\n\t    \t\tSET username='{$c_username}', email='{$c_email}',\n\t    \t\t\tprotected='{$c_protected}', realname='{$c_realname}'\n\t    \t\tWHERE id='{$c_user_id}'";
} else {
    $query = "UPDATE {$t_user_table}\n\t    \t\tSET username='{$c_username}', email='{$c_email}',\n\t    \t\t\taccess_level='{$c_access_level}', enabled='{$c_enabled}',\n\t    \t\t\tprotected='{$c_protected}', realname='{$c_realname}'\n\t    \t\tWHERE id='{$c_user_id}'";
}
$result = db_query($query);
$t_redirect_url = 'manage_user_page.php';
html_page_top1();
if ($result) {
    html_meta_redirect($t_redirect_url);
开发者ID:centaurustech,项目名称:BenFund,代码行数:31,代码来源:manage_user_update.php



注:本文中的user_delete_project_specific_access_levels函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_delete_user函数代码示例发布时间:2022-05-23
下一篇:
PHP user_delete函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap