You are here

function og_role_revoke in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.module \og_role_revoke()

Revoke a group role from a user.

Parameters

$uid: The user ID.

$rid: The role ID.

2 calls to og_role_revoke()
og_ui_user_multiple_role_edit in og_ui/og_ui.module
Callback function for admin mass adding/ deleting a user role.
og_ungroup in ./og.module
Delete an association (e.g. unsubscribe) of an entity to a group.

File

./og.module, line 2773
Enable users to create and manage groups with roles and permissions.

Code

function og_role_revoke($gid, $uid, $rid) {

  // Get the existiong user roles.
  $user_roles = og_get_user_roles($gid, $uid);
  if (in_array($rid, $user_roles)) {
    db_delete('og_users_roles')
      ->condition('uid', $uid)
      ->condition('rid', $rid)
      ->condition('gid', $gid)
      ->execute();
    module_invoke_all('og_role_revoke', $gid, $uid, $rid);
  }
}