function restrict_by_ip_user_role_presave in Restrict Login or Role Access by IP Address 7.3
Statically save role name before it's updated. Implements hook_user_role_presave().
See also
restrict_by_ip_user_role_update().
1 string reference to 'restrict_by_ip_user_role_presave'
- restrict_by_ip_user_role_update in ./
restrict_by_ip.module - Update role IP restrictions when a role name changes. Implements hook_user_role_update().
File
- ./
restrict_by_ip.module, line 401 - 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_presave($role) {
if (!empty($role->rid) && $role->name) {
// Load the role as it exists in the database to get what the original
// role name was.
$old_role = user_role_load($role->rid);
// Save the old name statically so that restrict_by_ip_user_role_update()
// can know what it is.
$role_old_names =& drupal_static(__FUNCTION__);
$role_old_names[$old_role->rid] = $old_role->name;
}
}