You are here

function user_role_features_rebuild in Features 7

Same name and namespace in other branches
  1. 6 includes/features.user.inc \user_role_features_rebuild()
  2. 7.2 includes/features.user.inc \user_role_features_rebuild()

Implements hook_features_rebuild().

1 call to user_role_features_rebuild()
user_role_features_revert in includes/features.user.inc
Implements hook_features_revert().

File

includes/features.user.inc, line 207

Code

function user_role_features_rebuild($module) {
  if ($defaults = features_get_default('user_role', $module)) {
    foreach ($defaults as $role) {
      $role = (object) $role;
      if ($existing = user_role_load_by_name($role->name)) {
        $role->rid = $existing->rid;
      }
      user_role_save($role);
    }
  }
}