You are here

function user_permissions_uninstall in User Permissions 6

Same name and namespace in other branches
  1. 8 user_permissions.install \user_permissions_uninstall()
  2. 5 user_permissions.install \user_permissions_uninstall()
  3. 7 user_permissions.install \user_permissions_uninstall()

Remove any roles created by this module.

File

./user_permissions.install, line 6

Code

function user_permissions_uninstall() {
  $roles = user_roles();
  foreach ($roles as $rid => $name) {
    if (strpos($name, '_user_role_') !== FALSE) {
      db_query("DELETE FROM {permission} WHERE rid = %d", $rid);
      db_query("DELETE FROM {users_roles} WHERE rid = %d", $rid);
      db_query("DELETE FROM {role} WHERE rid = %d", $rid);
    }
  }
}