本文整理汇总了PHP中Roles::delete_user_roles方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::delete_user_roles方法的具体用法?PHP Roles::delete_user_roles怎么用?PHP Roles::delete_user_roles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::delete_user_roles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
}
$extra['groups'] = $_groups;
}
}
$user_roles = array();
$role = new Roles();
$_extra = serialize(array('user' => true, 'network' => true, 'groups' => array()));
if (!empty($role_extra[$role_id])) {
$_extra = serialize($role_extra[$role_id]);
} else {
if ($group_id) {
$_extra = array('user' => false, 'network' => false, 'groups' => array($group_id));
$_extra = serialize($_extra);
}
}
$user_roles[] = array('role_id' => $role_id, 'extra' => $_extra);
if ($_POST['roles_action'] == 'delete') {
$role->delete_user_roles($uid, $user_roles, $group_id);
} else {
$role->assign_role_to_user($user_roles, $uid);
}
$names = array();
$r_params = $group_id ? array('type' => 'group', 'gid' => $group_id) : null;
$saved_roles = Roles::get_user_roles($uid, DB_FETCHMODE_OBJECT, $r_params);
foreach ($saved_roles as $s_role) {
$names[] = Roles::get_role_name($s_role->role_id);
}
$msg = implode("<br />", $names);
echo $msg;
}
示例2: leave
/**
* let the user leave network
* @access public
* @param id of the network,uid of user
* @return flag for joining request moderated or success message
*/
static function leave($network_id, $uid)
{
Logger::log("Enter: static function Network leave");
// if (Network::is_mother_network($network_id)) {
// throw new PAException(OPERATION_NOT_PERMITTED, "You cant delete mother network.");
// }
if (!Network::member_exists($network_id, $uid)) {
throw new PAException(OPERATION_NOT_PERMITTED, "You are not member of this network.");
}
$user_type = Network::get_user_type($network_id, $uid);
if ($user_type == NETWORK_OWNER) {
throw new PAException(OPERATION_NOT_PERMITTED, "You cant leave your own network!!.");
}
$res = Dal::query("DELETE FROM {networks_users} WHERE network_id = ? AND user_id = ? ", array($network_id, $uid));
// delete all user roles for this network
Roles::delete_user_roles($uid, -1);
// -1 means: all user roles will be deleted
// Update cached member count
Network::update_network_member_count($network_id);
Logger::log("Exit: static function Network leave");
return TRUE;
}
示例3: leave_all_groups
public static function leave_all_groups($user_id)
{
Logger::log("Enter: Group::leave_all_groups() | Args: \$user_id = {$user_id}");
$res = Dal::query("DELETE FROM {groups_users} WHERE user_id = ?", array($user_id));
$role_info = array(array('role_id' => null));
// this means - delete all roles for this group
$user_groups = Group::get_user_groups($user_id);
foreach ($user_groups as $grp) {
Roles::delete_user_roles($user_id, $role_info, $grp['gid']);
}
Logger::log("Exit: Group::leave_all_groups()");
return TRUE;
}