function password_policy_features_rebuild in Password Policy 7
Implements hook_features_rebuild().
1 call to password_policy_features_rebuild()
- password_policy_features_revert in ./
password_policy.features.inc - Implements hook_features_revert().
File
- ./
password_policy.features.inc, line 72 - Integrates Features for Password Policy.
Code
function password_policy_features_rebuild($module_name) {
$saved_policies = module_invoke($module_name, 'password_policy_features_default_policies');
foreach ($saved_policies as $policy) {
$roles = array();
foreach ($policy['roles'] as $name) {
$role = user_role_load_by_name($name);
$roles[$role->rid] = $role->rid;
}
$policy['roles'] = $roles;
$exists = password_policy_load_policy_by_name($policy['name']);
if ($exists) {
$policy['pid'] = $exists['pid'];
}
password_policy_save_policy($policy);
}
}