You are here

function og_get_default_roles in Organic groups 7.2

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

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

Parameters

$include: (optional) If TRUE also anonymous and authenticated roles will be returned. Defaults to TRUE.

Return value

Array of default roles, grouped by module name.

5 calls to og_get_default_roles()
OgMigrateRoles::preImport in includes/migrate/7200/og_roles.migrate.inc
Copy all existing global roles to bundle-specific versions. Although similar processing is available through the og_roles_override() function, special handling is necessary to ensure that custom global roles are copied as well as default global roles.
og_features_role_features_export in includes/og_features_role.features.inc
Implements hook_features_export().
og_features_role_features_export_options in includes/og_features_role.features.inc
Implements hook_features_export_options().
og_get_default_permissions in ./og.module
Get default permissions.
og_roles_override in ./og.module
Create new roles, based on the default roles and permissions.

File

./og.module, line 2738
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 = array_merge($roles, 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) {
    array_unshift($roles, OG_AUTHENTICATED_ROLE);
    array_unshift($roles, OG_ANONYMOUS_ROLE);
  }
  return $roles;
}