当前位置: 首页>>代码示例>>PHP>>正文


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怎么用?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;未经允许,请勿转载。