You are here

function og_get_default_roles in Organic groups 7

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

Get arary of default roles, keyed by their declaring module.

2 calls to og_get_default_roles()
OgUiUserPermissionsTestCase::testOgUiUserPermissionChanges in og_ui/og_ui.test
Change user permissions and check og_user_access().
og_set_global_access_module in ./og.module
Add default roles and permissions of a module to the global permissions.

File

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

Code

function og_get_default_roles($include = TRUE) {
  $roles = array();
  foreach (module_implements('og_default_roles') as $module) {
    $roles[$module] = module_invoke($module, 'og_default_roles');
  }

  // Allow other modules to alter the defult roles, excpet of the anonymous and
  // authenticated.
  drupal_alter('og_default_roles', $roles);
  if ($include) {
    $roles += array(
      'og' => array(),
    );
    array_unshift($roles['og'], OG_ANONYMOUS_ROLE, OG_AUTHENTICATED_ROLE);
  }
  return $roles;
}