function restrict_by_ip_user_role_update in Restrict Login or Role Access by IP Address 7.3
Update role IP restrictions when a role name changes. Implements hook_user_role_update().
See also
restrict_by_ip_user_role_presave().
File
- ./
restrict_by_ip.module, line 419 - Allows the admin to select which ip addresses role or a user can login from for this site Some of the code below is taken from the cck_ipaddress_module
Code
function restrict_by_ip_user_role_update($role) {
// Get any old role names saved by restrict_by_ip_user_role_presave().
$role_old_names =& drupal_static('restrict_by_ip_user_role_presave');
$old_name = _restrict_by_ip_hash_role_name($role_old_names[$role->rid]);
$new_name = _restrict_by_ip_hash_role_name($role->name);
if ($old_name !== $new_name) {
$old_restrictions = variable_get('restrict_by_ip_role_' . $old_name, '');
variable_set('restrict_by_ip_role_' . $new_name, $old_restrictions);
variable_del('restrict_by_ip_role_' . $old_name);
}
}