function _restrict_by_ip_validate in Restrict Login or Role Access by IP Address 6.2
Validate function Validate the restrict by ip form data
1 call to _restrict_by_ip_validate()
- restrict_by_ip_user in ./
restrict_by_ip.module - Implementation of hook_user()
File
- ./
restrict_by_ip.module, line 334 - 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_validate(&$edit, $call) {
$ret = TRUE;
// Set up error messages for new user and edit user
$sms = "Retrict by IP Address setting not updated to user";
if ($call == 2) {
$sms = "User not added";
}
// Only validate is 'yes' is selected for restrict by ip
if ($edit['restrict_by_ip_type']) {
// Seperate the ip address by semi-colon delimiter
$ret = _restrict_by_ip_validate_ip($edit['restrict_by_ip_address'], $sms);
}
if (!$ret) {
unset($edit['restrict_by_ip_type']);
unset($edit['restrict_by_ip_address']);
}
return $ret;
}