本文整理汇总了PHP中UserGroup::update_user_role方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::update_user_role方法的具体用法?PHP UserGroup::update_user_role怎么用?PHP UserGroup::update_user_role使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::update_user_role方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
if (empty($group_info)) {
api_not_allowed();
}
$user_role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
if (!in_array($user_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR, GROUP_USER_PERMISSION_READER))) {
api_not_allowed();
}
}
$show_message = '';
//if i'm a moderator
if (isset($_GET['action']) && $_GET['action'] == 'add') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if ($usergroup->is_group_moderator($group_id)) {
$usergroup->update_user_role($user_join, $group_id);
$show_message = get_lang('UserAdded');
}
}
if (isset($_GET['action']) && $_GET['action'] == 'delete') {
// we add a user only if is a open group
$user_join = intval($_GET['u']);
//if i'm a moderator
if ($usergroup->is_group_moderator($group_id)) {
$usergroup->delete_user_rel_group($user_join, $group_id);
$show_message = Display::return_message(get_lang('UserDeleted'));
}
}
if (isset($_GET['action']) && $_GET['action'] == 'set_moderator') {
// we add a user only if is a open group
$user_moderator = intval($_GET['u']);
示例2: WSUpdateUserRoleInGroup
function WSUpdateUserRoleInGroup($params)
{
if (!WSHelperVerifyKey($params['secret_key'])) {
return return_error(WS_ERROR_SECRET_KEY);
}
$userGroup = new UserGroup();
return $userGroup->update_user_role($params['user_id'], $params['group_id'], $params['relation_type']);
}
示例3: foreach
}
});
}
}
</script>';
$show_message = null;
$content = null;
// easy links
if (is_array($_GET) && count($_GET) > 0) {
foreach ($_GET as $key => $value) {
switch ($key) {
case 'accept':
$user_role = $usergroup->get_user_group_role(api_get_user_id(), $value);
if (in_array($user_role, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER, GROUP_USER_PERMISSION_PENDING_INVITATION))) {
$usergroup->update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
$show_message = Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'success');
} elseif (in_array($user_role, array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
$show_message = Display::return_message(get_lang('UserIsAlreadySubscribedToThisGroup'), 'warning');
} else {
$show_message = Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'warning');
}
break 2;
case 'deny':
// delete invitation
$usergroup->delete_user_rel_group(api_get_user_id(), $value);
$show_message = Display::return_message(get_lang('GroupInvitationWasDeny'));
break 2;
}
}
}