You are here

function restrict_by_ip_user_insert in Restrict Login or Role Access by IP Address 7.3

Implementation of hook_user_insert().

File

./restrict_by_ip.module, line 119
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_insert(&$edit, $account, $category) {
  if (isset($edit['restrict_by_ip_address']) && strlen($edit['restrict_by_ip_address']) > 0) {

    // If an IP restriction is set, add it to database
    db_query("INSERT INTO {restrict_by_ip} (uid, restrict_by_ip_address) VALUES (:uid, :ip)", array(
      ':uid' => $edit['uid'],
      ':ip' => $edit['restrict_by_ip_address'],
    ));
  }
}