function restrict_by_ip_user_profile_submit in Restrict Login or Role Access by IP Address 7.3
Same name and namespace in other branches
- 8.4 restrict_by_ip.module \restrict_by_ip_user_profile_submit()
- 6.3 restrict_by_ip.module \restrict_by_ip_user_profile_submit()
Custom submit function for the user_profile_form page.
1 string reference to 'restrict_by_ip_user_profile_submit'
- restrict_by_ip_form_alter in ./
restrict_by_ip.module - Implmentation of hook_form_alter().
File
- ./
restrict_by_ip.module, line 379 - 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_profile_submit($form, &$form_state) {
// Remove any existing restrictions
db_query("DELETE FROM {restrict_by_ip} WHERE uid = :uid", array(
':uid' => $form['#user']->uid,
));
if (strlen($form_state['values']['restrict_by_ip_address']) > 0) {
// Add new restrictions
db_query("INSERT INTO {restrict_by_ip} (uid, restrict_by_ip_address) VALUES (:uid, :ip)", array(
':uid' => $form['#user']->uid,
':ip' => $form_state['values']['restrict_by_ip_address'],
));
}
}