You are here

public function GroupType::removeRoles in Group 7

Delete all possible roles for a group type.

Does not delete global or special (outsider or member) roles.

See also

group_roles()

File

classes/group_type.inc, line 117
Defines the Entity API class for group types.

Class

GroupType
Main class for group type entities.

Code

public function removeRoles() {
  $roles = array();
  foreach ($this
    ->getRoles(FALSE) as $name => $group_role) {
    if (empty($group_role->global)) {
      $roles[] = $name;
    }
  }

  // Delete all roles specific to this group type.
  group_role_delete_multiple($roles);

  // Remove all deleted roles from the internal cache.
  $this
    ->resetCache($roles);
}