You are here

function og_role_delete in Organic groups 7

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

Delete a user role from database.

Parameters

$role: An integer with the role ID.

2 calls to og_role_delete()
og_delete_user_roles_by_group in ./og.module
Delete all roles belonging to a group.
og_ui_user_admin_roles_submit in og_ui/og_ui.admin.inc

File

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

Code

function og_role_delete($rid) {
  $role = og_role_load($rid);
  db_delete('og_role')
    ->condition('rid', $rid)
    ->execute();
  db_delete('og_role_permission')
    ->condition('rid', $rid)
    ->execute();

  // Update the users who have this role set.
  db_delete('og_users_roles')
    ->condition('rid', $rid)
    ->execute();
  module_invoke_all('og_role_delete', $role);
  og_invalidate_cache();
}