diff --git a/README.txt b/README.txt
index 61c9c3a..1a92c53 100644
--- a/README.txt
+++ b/README.txt
@@ -1,109 +1,36 @@
-IP Login
-========
-  Log in automatically via their IP (v4) address ranges or wildcards instead of
-  having to enter a username and password - plus many other features.
+IP Login - Login to Drupal automatically via your IP address
+By David Thomas - davidwhthomas@gmail.com
+and Jim Kirkpatrick - bad.octopus@gmail.com
+April 2011
 
+*** ABOUT ***
+This module allows users to login first automatically via their IP address, wildcard or range, instead of using a username / password.
+The module uses the core 'Profile' module to lookup a user's IP address - FOR NOW!
 
-Authors & main contributors
-===========================
-  Originally By David Thomas - davidwhthomas@gmail.com
-  Now maintained by Jim Kirkpatrick - jim@i-jk.co.uk
-  And with help from JohnV and others - Thanks!
+*** NOTE April 2011 ***
+This version is an early preview of the 2.x-DEV branch and will soon loose the reliance on the core Profile module and gain
+better integration with other modules and Drupal 7.
 
+All information below is out of date but still relevant.
 
-Features
-========
-  * IP address matching works on:
-    * Normal single IPs, comma separated: 123.4.5.6 or 123.4.5.6, 234.5.6.7
-    * IP ranges: 123.4.5.6-10 or 123.4-111.5.6
-    * Wildcards: 123.4.5.* or 123.*.*.*
-    * Any combination: 127.0.0.1, 123.4.5-66.*, 234.4-5.6-77.*
-    * Coming soon: IPv6 and Subnet matching via CIDR notation.
-  * Integration with User Login page & block, with customisable text and labels
-  * 'Log in by IP' block with simple auto-login link for those who don't want
-    to use the modified User Login block.
-  * Users with permission can log out and and back into another account.
-  * Can be set to auto-login (or not) only on certain pages, or when custom PHP
-    returns TRUE.
-  * Optional destination address can be set when logged in by IP.
-  * Lists IP-enabled users on the admin page at 'Site configuration' -> 'IP
-    Login'.
-  * Will work with external caches like Varnish when IP Login is set to
-    auto-login only on specific paths.
 
 
-How it works
-============
-  When a user visits any Drupal page (or admin-chosen page), IP Login will:
-  
-  1. Check if the user is not logged in and that IP login hasn't run yet for
-    this session.
-  2. If so, it compare the IP address (using Drupal's ip_address() function) to
-    IP ranges stored in its own private table in the database.
-  3. If a match is found, IP Login logs the user in programmatically as the
-    account matching the IP address.
-  4. If a matching IP is not found, the user can log in via normal Drupal
-    accounts if they choose to.
-  5. If the user has permission to log out, they can and will be given the
-    option to login back in normally as another user. Users without this
-    permission are auto-logged back in IP Login. This way you can force an IP
-    address to stay associated and logged into an account.
+*** HOW IT WORKS ***
+When a user visits any Drupal page, IP Login checks that they're not logged in and that IP login hasn't run yet for this session.
+If they are a new anon user, the module checks if a record exists for the user's IP address by looking up the profile_values field for the IP Address in $_SERVER['REMOTE_HOST']
+If a matching IP address is found in profile_values, it logs them in as that user.
+If not, normal username / password authentication is still always available as a second step.
 
+*** HOW TO INSTALL ****
 
-Installation
-============
+1. Create a user profile textfield to store the user's IP address. e.g: profile_ip. I recommend making it a private field, only available to admins.
+2. Copy the module folder 'ip_login' to your module folder (e.g sites/all/modules/ )
+3. Enable the module from Drupal admin -> modules
+4. Go to the site config settings at admin/settings/iplogin and select the profile field that contains a user's IP address.
+5. Done.
 
-  From scratch
-  ------------
-  1. Enable the module from Drupal admin -> modules
-  2. Edit user accounts you want to add IP Login to.
-  3. Optional: Go to the IP Login settings page to tweak and administer.
-  4. Optional: Add the simple 'Log in by IP' link block to a region.
+*** HOW TO TEST ***
 
-  Upgrading from 6.x-1.x branch
-  -----------------------------
-  NOTE: The 6.x-1.x branch is now deprecated.
-  
-  1. REMOVE the old IP Login folder in sites/all/module or
-    sites/[yoursite]/modules
-  2. Upload/add the 2.x branch
-  3. Run update.php
+You can test it by entering your IP address in your user profile. If you need to find your external IP address, try http://whatismyip.com
+If it's working, you should be able to close the browser, open it, go to your site and see the 'Welcome %name, you're now logged into %sitename' message after IP Login has logged you in.
 
-  When you upgrade to 7.x-2.x the IP field you added to users via core the
-  Profile module will be auto-imported into the new ip_login_users table.
-
-
-How to test
-===========
-  You can test it by entering your IP address in the IP login field when
-  editing your user profile, then:
-
-  1. If the site is running on your computer you can probably use the localhost
-    loopback IP address of 127.0.0.1 for testing, otherwise you will need to
-    find your external IP address. IP Login shows your IP address according to
-    Drupal on its admin page, but you could also use at http://whatismyip.com.
-  2. You can tell it's working when you click the logout button and are either
-    logged back in by IP Login or, if you have permission or are user 1, have
-    the 'Log in automatically' option in the login form.
-  3. IP Login displays a welcome message: "Welcome %name. You have been
-    automatically logged into %sitename".
-  4. You can also open the site in your browser when set to 'Private Browsing'
-    mode (also called InPrivate, Incognito etc.) and see the welcome message
-    indicating IP Login has logged you in.
-
-
-Notes & possible incompatibilities
-==================================
-* This module may be suitable for users with dynamic IP addresses, like those
-  assigned by DHCP or from an ISP's IP blocks etc. provided that:
-    a) your're ok that anyone using these IP ranges is allowed to log in with a
-    given account; and
-    b) the range of possible IPs for the user is known.
-  If not then IP Login will not be able to work effectively in your case.
-
-* IP Login used to be incompatible with the following modules. It had changed
-  slightly since these issues were reported so it might well work now. You
-  should note that any module that wipes and/or recreates the session will
-  possibly have compatibility issues with IP Login:
-  * Legal
-  * Secure Pages Hijack Prevention
\ No newline at end of file
diff --git a/ip_login.admin.inc b/ip_login.admin.inc
index 315bbc7..1c9ce84 100644
--- a/ip_login.admin.inc
+++ b/ip_login.admin.inc
@@ -1,45 +1,72 @@
 <?php
-/**
- * @file
- * Sets up the IP Login admin page settings.
- */
+// $Id: ip_login.admin.inc $
 
 /**
- * Returns the settings form
+ * Sets up the IP Login admin page settings
+ * 
+ * @return $form
+ *    A normal Drupal FormAPI form
  */
 function ip_login_admin_settings() {
-  $form['ip_address'] = array(
-    '#prefix' => '<div class="messages status">',
-    '#description' => t('Users for which IP Login is enabled are listed below.'),
-    '#markup' => t('According to Drupal\'s <code>ip_address()</code> function <strong>your IP address is <code>@ip_address</code></strong>.', array('@ip_address' => ip_address())),
-    '#suffix' => ' ' . t('Tip: You can find your computer\'s external IP address at <a href="http://www.whatsmyip.org/">www.whatsmyip.org</a>.') . '</div>'
-  );
-  $form['ip_login_users'] = array(
-    '#markup' => t(
-      '<p><strong>Note:</strong> To manage users, please see the <a href="!link">list of users with IP Login enabled</a>.</p>',
-      array('!link' => '/admin/people/ip_login')
-    )
-  );
+  // IP Login depends on core Profile module...
+  $result = db_query("SELECT DISTINCT name FROM {profile_fields}");
+  while ($field = db_fetch_object($result)) {
+    $fields[$field->name] = $field->name;
+  }
+  if (!$fields || !variable_get('ip_login_profile_ip_field', '')) {
+    drupal_set_message(
+      t("You can use the !profile_module to add a text field to the user profile to store the user's ip address.",
+        array('!profile_module' => l('profile module admin', 'admin/user/profile/add/textfield')))
+      ); 
+  }
+  // show a warning if field is not hidden
+  if (strlen(variable_get('ip_login_profile_ip_field', ''))) {
+    $result = db_query("SELECT * FROM {profile_fields} WHERE name = '%s'", variable_get('ip_login_profile_ip_field', ''));
+    $field = db_fetch_object($result);
+    $secure = TRUE;
+    if ($field->visibility != PROFILE_HIDDEN) { // Hidden profile field, only accessible by administrators, modules and themes
+      drupal_set_message(
+        t("The field %profile_field you have chosen to store IP matches is accessible by non-administators. It is strongly recommended this field's visibility is kept 'Hidden'.",
+          array('%profile_field' => $field->name),
+          'warning'
+        )
+      );
+      $secure = FALSE;
+    }
+  }
+  
   $form['ip_login_enabled'] = array(
     '#type' => 'checkbox',
     '#title' => t('IP Login enabled'),
     '#description' => t('Check to enable IP Login, uncheck to disable. If unchecked no user will be able to login via IP address.'),
     '#default_value' => variable_get('ip_login_enabled', 1)
   );
-  $form['ip_login_suppress_messages'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Suppress IP Login messages'),
-    '#description' => t('Check to prevent IP Login showing any login-related messages.'),
-    '#default_value' => variable_get('ip_login_suppress_messages', 0)
-  );
-
+  $form['ip_login_profile_ip_field'] = array(
+    '#type' => 'select',
+    '#title' => t('Profile module IP address field'),
+    '#description' => t('Select the profile field containing the user IP address.'),
+    '#options' => $fields,
+    '#default_value' => variable_get('ip_login_profile_ip_field', 'profile_ip')
+  );
+  // show extra warning if not profile field visibliliy not hidden
+  if (!$secure) {
+    $form['profile_field_security_warning'] = array(
+      '#type' => 'markup',
+      '#value' => '<div class="error">' . t("This profile field's visiblity should ideally be set to 'Hidden' for best security") . '</div>'
+    );
+  }
   $form['ip_login_destination'] = array(
     '#type' => 'textfield',
     '#title' => t('Destination after successful login by IP'),
     '#description' => t('<strong>Leave blank to send user back to their originally requested page</strong>, or enter the Drupal path users should be redirected to when automatically logged in. For example "user" or "&lt;front&gt;" etc.'),
     '#default_value' => variable_get('ip_login_destination', '')
   );
-
+  $form['ip_login_suppress_messages'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Suppress IP Login messages'),
+    '#description' => t('Check to prevent IP Login showing any login-related messages.'),
+    '#default_value' => variable_get('ip_login_suppress_messages', 0)
+  );
   $form['login_page'] = array(
     '#type' => 'fieldset',
     '#title' => t('Login page link'),
@@ -62,9 +89,9 @@ function ip_login_admin_settings() {
     '#title' => t('Weight'),
     '#delta' => 20,
     '#default_value' => variable_get('ip_login_link_login_page_weight', -10),
-    '#description' => t('Optional. The position within the login page form for this link.'),
+    '#description' => t('Optional. The position withn the login page form for this link.'),
   );
-
+  
   $form['login_block'] = array(
     '#type' => 'fieldset',
     '#title' => t('Login block link'),
@@ -72,8 +99,8 @@ function ip_login_admin_settings() {
   );
   $form['login_block']['ip_login_link_login_block'] = array(
     '#type' => 'textfield',
-    '#title' => t('Login blocks link text'),
-    '#description' => t('Text for link on "User login" and "Log in by IP link" blocks. Use blank to remove link, defaults to "Log in automatically"'),
+    '#title' => t('Login block link text'),
+    '#description' => t('Text for link on login page. Use blank to remove link, defaults to "Log in automatically"'),
     '#default_value' => t(variable_get('ip_login_link_login_block', 'Log in automatically')),
     '#required' => FALSE,
   );
@@ -82,146 +109,15 @@ function ip_login_admin_settings() {
     '#title' => t('Weight'),
     '#delta' => 20,
     '#default_value' => variable_get('ip_login_link_login_block_weight', -10),
-    '#description' => t('Optional. The position within the login block form for this link.'),
-  );
-
-  // Make auto-login message editable.
-  $form['other_messages'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Messages'),
-    '#description' => t('You can alter other messages here and include tokens listed below.'),
-  );
-  $message_default = 'Account [user:name] does not have permission to log out once automatically logged in. You have been logged back in.';
-  $form['other_messages']['ip_login_logged_back_in'] = array(
-    '#type' => 'textarea',
-    '#title' => t('User automatically logged back after attempting logout without permission'),
-    '#description' => t('Text for the message "' . $message_default . '"'),
-    '#default_value' => t(variable_get('ip_login_logged_back_in', $message_default)),
-    '#cols' => 100,
-    '#rows' => 5,
-    '#required' => FALSE,
-  );
-  $form['other_messages']['tokens'] = array(
-    '#theme' => 'token_tree',
-    '#token_types' => array('user'),
-    '#global_types' => TRUE,
-    '#click_insert' => TRUE
+    '#description' => t('Optional. The position withn the login block form for this link.'),
   );
-  // allows ip check on certain pages only
-  $form['active_pages'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Path specific IP logins'),
-    '#description' => t('<p>You can choose specific paths that IP Login will or will not try to log in a user. <strong>Please note:</strong></p><ul><li>No alias or system path lookup is performed, so you will need to have both paths listed if you want IP logins to happen on both paths  - e.g. alias "about/this-site" and system path "node/123" would both need to be added.</li><li>This will not affect users with <code>can log in as another user</code> permission who have already logged out and have a cookie.</li></ul>'),
-    '#collapsible' => FALSE,
-  );
-  $access = user_access('use PHP for block visibility');
-  $pages = variable_get('ip_login_active_pages', '');
-  if ($pages) {
-    $check_mode = substr($pages, 0, 1);
-    $pages = substr($pages, 1);
-  }
-  else {
-    $check_mode = '';
-  }
-  if ($check_mode == 2 && !$access) {
-    $form['active_pages'] = array();
-    $form['active_pages']['check_mode'] = array('#type' => 'value', '#value' => 2);
-    $form['active_pages']['check_pages'] = array('#type' => 'value', '#value' => $pages);
-  }
-  else {
-    $options = array(t('Login by IP on every page except the listed <strong>paths</strong>.'), t('Login by IP only on the listed <strong>paths</strong>.'));
-    $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page. Note you must also enter system paths (e.g. 'node/123') for aliases if you want IP logins to happen there too.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
-
-    if ($access) {
-      $options[] = t('login by IP if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
-      $description .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code can break your Drupal site.', array('%php' => '<?php ?>'));
-    }
-    $form['active_pages']['check_mode'] = array(
-      '#type' => 'radios',
-      '#title' => t('Login by IP on specific paths'),
-      '#options' => $options,
-      '#default_value' => $check_mode,
-    );
-    $form['active_pages']['check_pages'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Pages'),
-      '#default_value' => $pages,
-      '#description' => $description,
-    );
-  }
-  $form['#submit'][] = 'ip_login_admin_settings_submit';
+  /* @ todo implement hook_menu_alter to add this functionality?
+  $form['link_options']['ip_login_link_navigation_menu'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Navigation menu item text'),
+    '#description' => t('Text for navigation menu link. Blank to remove link, defaults to "Log in automatically"'),
+    '#default_value' => variable_get('ip_login_link_navigation_menu', t('Log in automatically')),
+  ); */
   return system_settings_form($form);
 }
 
-
-/**
- * Returns a list of IP login-enabled users
- */
-function ip_login_user_list() {
-  // add handy header
-  $output = '<div class="messages status">';
-  $output .= t('According to Drupal\'s <code>ip_address()</code> function <strong>your IP address is <code>@ip_address</code></strong>. ', array('@ip_address' => ip_address()));
-  $output .= t('Tip: You can find your computer\'s external IP address at <a href="http://www.whatsmyip.org/">www.whatsmyip.org</a>.') . '</div>';
-  // add table of IP-enabled users
-  $output .= t(
-    '<p>Users for which IP Login is enabled are listed below. Login behaviour is controlled <a href="!link">IP Login settings</a>.</p>',
-    array('!link' => '/admin/config/people/ip_login')
-  );
-  $output .= _ip_login_user_list_table();
-  return $output;
-}
-
-/**
- * Submit handler for admin settings form
- */
-function ip_login_admin_settings_submit($form, &$form_state) {
-  if ($form_state['values']['check_pages']) {
-    variable_set('ip_login_active_pages', $form_state['values']['check_mode'] . $form_state['values']['check_pages']);
-  }
-  else {
-    variable_set('ip_login_active_pages', '');
-  }
-}
-
-/**
- * Generates a table of IP-enabled users
- */
-function _ip_login_user_list_table() {
-  // get all IP-login enabled users and display in a table on the admin page
-  $rows = array();
-  $result = db_query(
-    "SELECT u.name, u.uid, ip.ip_match
-     FROM {users} u
-     INNER JOIN {ip_login_user} ip ON ip.uid = u.uid
-     ORDER BY ip.ip_match");
-  foreach ($result as $row) {
-    $rows[] = array(
-      $row->name,
-      $row->ip_match,
-      l(
-        t('edit'),
-        'user/' . $row->uid . '/edit',
-        array(
-          'query' => array('destination' => 'admin/people/ip_login'),
-          'fragment' => 'ip_login'
-        )
-      )
-    );
-  }
-  $header = array('Username', 'IP ranges', 'Operations');
-  if (isset($rows[0])) {
-    $table = theme('table', array('header' => $header, 'rows' => $rows));
-    $table .= l(
-      t('Edit a user account to add more IP addresses.'),
-      'admin/people/people'
-      );
-    return $table;
-  }
-  else {
-    return t('There are presently no users with IP login ranges set.') . ' ' .
-      l(
-        t('Edit a user account to add some IP addresses'),
-        'admin/people/people'
-      );
-  }
-}
diff --git a/ip_login.fr_.po b/ip_login.fr_.po
new file mode 100644
index 0000000..d1f9a80
--- /dev/null
+++ b/ip_login.fr_.po
@@ -0,0 +1,197 @@
+# $Id$
+#
+# French translation of Drupal (general)
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+# Generated from files:
+#  ip_login.admin.inc: n/a
+#  ip_login.module, v1.1.4.4 2008/11/15 02:51:43 davidwhthomas
+#  ip_login.info,v 1.1.4.2 2008/11/14 23:56:39 davidwhthomas
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2010-06-18 09:11-0400\n"
+"PO-Revision-Date: 2010-06-18 09:37-0500\n"
+"Last-Translator: Sébastien Nadeau <sebastien.nadeau@bibl.ulaval.ca>\n"
+"Language-Team: French <EMAIL@ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n!=1);\n"
+
+#: ip_login.admin.inc:18
+msgid "You can use the !profile_module to add a text field to the user profile to store the user's ip address."
+msgstr "Vous pouvez utiliser le module !profile_module afin d'ajouter un champ de saisie pour les adresses IP dans le profil de l'utilisateur."
+
+#: ip_login.admin.inc:29
+msgid "The field %profile_field you have chosen to store IP matches is accessible by non-administators. It is strongly recommended this field's visibility is kept 'Hidden'."
+msgstr "Le champ %profile_field sélectionné pour contenir les adresses IP est accessible par des non-administrateurs. Il est recommandé de garder ce champ masqué et accessible seulement aux administrateurs."
+
+#: ip_login.admin.inc:40
+msgid "IP Login enabled"
+msgstr "Activer IP Login"
+
+#: ip_login.admin.inc:41
+msgid "Check to enable IP Login, uncheck to disable. If unchecked no user will be able to login via IP address."
+msgstr "Cocher pour activer IP Login, décocher pour le désactiver. Si décoché, il y'aura pas de connexion automatique d'utilisateurs par adresse IP."
+
+#: ip_login.admin.inc:46
+msgid "Profile module IP address field"
+msgstr "Champ du profil qui contient les adresses IP"
+
+#: ip_login.admin.inc:47
+msgid "Select the profile field containing the user IP address."
+msgstr "Sélectionner le champ du profile qui contient les adresses IP."
+
+#: ip_login.admin.inc:55
+msgid "This profile field's visiblity should ideally be set to 'Hidden' for best security"
+msgstr "La visibilité de ce champ du profil devrait "
+
+#: ip_login.admin.inc:60
+msgid "Destination after successful login by IP"
+msgstr "Redirection après connection par adresse IP"
+
+#: ip_login.admin.inc:61
+msgid "<strong>Leave blank to send user back to their originally requested page</strong>, or enter the Drupal path users should be redirected to when automatically logged in. For example \"user\" or \"&lt;front&gt;\" etc."
+msgstr "<strong>Laisser vide pour rediriger l'utilisateur vers la page qu'il a demandée</strong>, ou saisir le chemin Drupal vers lequel l'utilisateur sera redirigé une fois connecté. Par exemple: \"user\" ou \"&lt;front&gt;\", etc."
+
+#: ip_login.admin.inc:67
+msgid "Login page link"
+msgstr "Lien pour la page de connexion utilisateur"
+
+#: ip_login.admin.inc:68;93
+msgid "A link with text from the <em>Login page link text</em> to log the user in automatically will be added to the login page unless it is blank."
+msgstr "Un lien sera ajouté à la page de connexion utilisateur, à moins que le champ <em>texte du lien pour la page de connexion utilisateur</em> ne soit laissé vide."
+
+#: ip_login.admin.inc:72
+msgid "Login page link text"
+msgstr "Texte du lien sur la page de connexion utilisateur"
+
+#: ip_login.admin.inc:73
+msgid "Text for link on login page. Blank to remove link, defaults to \"Log in automatically\""
+msgstr "Texte du lien sur la page de connexion utilisateur. Laisser vide pour ne rien afficher. Valeur par défaut: \"Log in automatically\"."
+
+#: ip_login.admin.inc:74;99
+msgid "Log in automatically"
+msgstr "Me connecter automatiquement"
+
+#: ip_login.admin.inc:78
+msgid "Login page help text"
+msgstr "Texte de l'aide sur la page de connexion utilisateur"
+
+#: ip_login.admin.inc:79
+msgid "Help text under IP Login link on login page. Defaults to 'Your computer's IP address has been matched and validated.' and will not appear if <em>Login page link text</em> is blank."
+msgstr "Texte explicatif sous le lien sur la page de connexion utilisateur. La valeur par défaut est: \"Your computer's IP address has been matched and validated.\" et n'apparaitra pas si le <em>lien sur la page de connexion utilisateur</em> est laissé vide."
+
+#: ip_login.admin.inc:80
+msgid "Your computer's IP address has been matched and validated."
+msgstr "L'adresse IP do votre poste de travail a été reconnue et validée."
+
+#: ip_login.admin.inc:84;104
+msgid "Weight"
+msgstr "Poids"
+
+#: ip_login.admin.inc:87
+msgid "Optional. The position withn the login page form for this link."
+msgstr "Optionnel. L'ordre d'affichage dans la page de connexion utilisateur pour ce lien."
+
+#: ip_login.admin.inc:92
+msgid "Login block link"
+msgstr "Lien dans le bloc de connexion utilisateur"
+
+#: ip_login.admin.inc:97
+msgid "Login block link text"
+msgstr "Texte du lien dans le bloc de connexion utilisateur"
+
+#: ip_login.admin.inc:98
+msgid "Text for link on login page. Use blank to remove link, defaults to \"Log in automatically\""
+msgstr "Lien sur la page de connexion utilisateur. Laisser vide pour ne rien afficher. Valeur par défaut: \"Log in automatically\"."
+
+#: ip_login.admin.inc:107
+msgid "Optional. The position withn the login block form for this link."
+msgstr "Optionnel. L'ordre d'affichage dans le bloc de connexion utilisateur pour ce lien."
+
+#: ip_login.module:64
+msgid "This module allows this site to automatically authenticate and login users arriving with a chosen IP address."
+msgstr "Ce module permet d'authentifier et de connecter un compte utilisateur d'après son adresse IP."
+
+#: ip_login.module:65
+msgid "IP values can be stored in a user's profile (using the core <em>Profile</em> module) in the field selected by the <em>Profile module IP address</em> field, below."
+msgstr "Les adresses ou plages d'adresses IP sont stockées dans le profil de l'utilisateur (il faut activer le module <em>Profil</em> fournit avec le core de Drupal). Il faut saisir le nom du champ du module profil qui contient les adresses IP à utiliser ci-bas."
+
+#: ip_login.module:66
+msgid "It also allows users with the <code>administer ip login</code> and <code>can log in as another user</code> <a href=\"@permissions-link\">permissions</a> to log out and log in as another user, with other users being forced to stay logged in."
+msgstr "Il permet également aux comptes utilisateurs avec les <a href=\"@permissions-link\">permissions</a> <code>administrer IP Login</code> et <code>peut se connecter avec un autre compte</code> de se déconnecter et de se reconnecter en utilisant un autre compte, alors que les utilisateurs n'ayant pas ces droits ne peuvent pas se déconnecter."
+
+#: ip_login.module:70
+msgid "Accepted profile field IP values are:"
+msgstr "Les formes d'adresses IP acceptées sont:"
+
+#: ip_login.module:72
+msgid "Single IP matches like <code>123.123.123.123</code>"
+msgstr "Adresse IP unique comme <code>123.123.123.123</code>"
+
+#: ip_login.module:74
+msgid "Wildcards using an asterisk (<code>*</code>) in any quadrant except the first one, for example <code>123.123.123.*</code> or <code>100.*.*.*</code> etc."
+msgstr "En utilisant l'astérisque (<code>*</code>) remplaçant n'importe quel entier de 0 à 255, dans n'importe quel octet, excepté le premier, par exemple: <code>123.123.123.*</code> ou <code>100.*.*.*</code>, etc."
+
+#: ip_login.module:76
+msgid "Ranges using a hyphen (<code>-</code>) in any quadrant except the first one, for example <code>123.123.123.100-200</code> etc."
+msgstr "Plages d'adresse utilisant le trait d'union (<code>-</code>) dans nimporte quel octet, excepté le premier, par exemple: <code>123.123.123.100-200</code>."
+
+#: ip_login.module:78
+msgid "Any number of comma-separated IP addresses or ranges like <code>10.11.12.13, 123.123.123.100-200, 123.123.124-125.*</code> etc."
+msgstr "Toute combinaison d'adresses ou de plages dans une liste séparée par des virgules, par exemple: <code>10.11.12.13, 123.123.123.100-200, 123.123.124-125.*</code>."
+
+#: ip_login.module:250
+msgid "Welcome %name. You have been automatically logged into %sitename."
+msgstr "Bienvenue %name, vous avez été connecté automatiquement au site %sitename."
+
+#: ip_login.module:259
+msgid "You may also <a href=\"@other_user_link\">log in as another user</a> if required."
+msgstr "Vous pouvez <a href=\"@other_user_link\">vous connecter avec un autre compte</a> au besoin."
+
+#: ip_login.module:328
+msgid "This account does not have permission to log out once logged in automatically. You have been logged back in."
+msgstr "Ce compte n'a pas l'autorisation de se déconnecter une fois connecté par adresse IP. Vous avez été reconnecté automatiquement."
+
+#: ip_login.module:265;306
+msgid "user"
+msgstr "utilisateur"
+
+#: ip_login.module:265
+msgid "Session opened for %name by IP Login."
+msgstr "Ouverture de session par adresse IP pour %name"
+
+#: ip_login.module:306
+msgid "Session closed for %name."
+msgstr "Session terminée pour %name."
+
+#: ip_login.module:148
+msgid "administer ip login"
+msgstr "administrer IP Login"
+
+#: ip_login.module:148
+msgid "can log in as another user"
+msgstr "peut se connecter avec un autre compte"
+
+#: ip_login.module:102
+msgid "Automatically log me in by IP"
+msgstr "Me connecter automatiquement par adresse IP"
+
+#: ip_login.module:108
+msgid "IP Login settings"
+msgstr "Configurer IP Login"
+
+#: ip_login.module:109
+msgid "Configure IP Login settings"
+msgstr "Modifier la configuration de IP Login"
+
+#: ip_login.info:0
+msgid "IP Login"
+msgstr "IP Login"
+
+#: ip_login.info:0
+msgid "Allows users to login automatically by an IP address, range or wildcards specified in a profile field"
+msgstr "Permet de connecter des comptes par adresse ou plage d'adresses IP spécifiées dans un champ du profil utilisateur"
+
diff --git a/ip_login.info b/ip_login.info
index 2996843..bedb621 100644
--- a/ip_login.info
+++ b/ip_login.info
@@ -1,7 +1,7 @@
+; $Id: ip_login.info,v 1.1.4.2 2008/11/14 23:56:39 davidwhthomas Exp $
 name = IP Login
-description = Allows users to be automatically login in by matching IP address, range or wildcards.
-core = 7.x
-version = "7.x-3.x-dev"
-dependencies[] = user
-dependencies[] = field_ipaddress
-configure = admin/config/people/ip_login
+description = Allows users to login automatically by an IP address, range or wildcards specified in a profile field
+core = 6.x
+dependencies[] = profile
+version = "6.x-DEV"
+
diff --git a/ip_login.install b/ip_login.install
deleted file mode 100755
index a23e044..0000000
--- a/ip_login.install
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * @file
- * Install file of the IP Login module.
- */
-
-/**
- * Implementation of hook_install().
- */
-function ip_login_install() {
-  drupal_set_message(
-    st('IP Login settings are available under <a href="@link">Administer > Configuration > People > IP Login settings</a>.',
-    array(
-      '@link' => 'admin/config/people/ip_login'
-    )
-  ));
-  
-  // Install field_ip_login
-  // Check if our field is not already created.
-  if (!field_info_field('field_ip_login')) {
-    $field = array(
-      'field_name' => 'field_ip_login', 
-      'type' => 'field_ipaddress',
-      'cardinality' => FIELD_CARDINALITY_UNLIMITED
-    );
-    field_create_field($field);
-  
-    // Create the instance on the bundle.
-    $instance = array(
-        'field_name' => 'field_ip_login', 
-        'entity_type' => 'user',
-        'bundle' => 'user',
-        'label' => 'IP address',
-        'description' => ip_login_help_ranges(),
-        'required' => FALSE,
-        'settings' => array(
-            'user_register_form' => 0,
-        ),
-        'widget' => array(
-            'type' => 'field_ipaddress_shorthand',
-        ), 
-    );
-    field_create_instance($instance);
-  }
-  
-  variable_set('ip_login_enabled', 1);
-}
-
-/**
- * Create field_ip_login on user entity.
- * Migrate data from ip_login_user to new field
- */
-function ip_login_update_7300(&$sandbox){
- 
-  if (!module_exists('field_ipaddress')){
-    throw new DrupalUpdateException(t('IP Login 7.3.x requires the module field_ipaddress to be enabled.',
-                         array('field_ipaddress' => l('field_ip_address', 'http://drupal.org/project/field_ipaddress', array('external' => TRUE)))));
-    return;
-  }
- 
-  // Create the IP Address field
-  // field_ip_login
-  // on the User entity
-  if(!isset($sandbox['field_created'])){
-    // Check if our field is not already created.
-    if (!field_info_field('field_ip_login')) {
-      $field = array(
-        'field_name' => 'field_ip_login', 
-        'type' => 'field_ipaddress',
-        'cardinality' => FIELD_CARDINALITY_UNLIMITED
-      );
-      field_create_field($field);
-    
-      // Create the instance on the bundle.
-      $instance = array(
-          'field_name' => 'field_ip_login', 
-          'entity_type' => 'user',
-          'bundle' => 'user',
-          'label' => 'IP address',
-          'description' => ip_login_help_ranges(),
-          'required' => FALSE,
-          'settings' => array(
-              'user_register_form' => 0,
-          ),
-          'widget' => array(
-              'type' => 'field_ipaddress_shorthand',
-          ), 
-      );
-      field_create_instance($instance);
-      $sandbox['field_created'] = TRUE;
-    }
-  }
- 
-  // Migrate the data
-  // from ip_login_user
-  // to field_ip_login data tables
-  if (db_table_exists('ip_login_user')) {
-    if (!isset($sandbox['progress'])) {
-      $sandbox['progress'] = 0;
-      $sandbox['current_uid'] = 0;
-      $sandbox['max'] = db_query('SELECT COUNT(DISTINCT uid) FROM {ip_login_user}')->fetchField();
-    }
-    // Select 10 users to process
-     $result = db_select('ip_login_user', 'u')
-      ->fields('u', array('uid', 'ip_match'))
-      ->condition('u.uid', $sandbox['current_uid'], '>')
-      ->range(0, 10)
-      ->orderBy('u.uid', 'ASC')
-      ->execute();
-  
-    foreach ($result as $row) {
-      $sandbox['current_uid'] = $row->uid;
-      $sandbox['progress']++;
-      if(empty($row->ip_match)) continue;
-      // Try shorthand match
-      $value = _field_ipaddress_shorthand2long(trim($row->ip_match));
-      // Try CIDR match
-      if(!$value && strpos($row->ip_match, '/') !== FALSE){
-       $value = _field_ipaddress_cidr2long(trim($row->ip_match));
-      }
-      if ($value) {
-        $account = user_load($row->uid);
-        $language = empty($account->language) ? LANGUAGE_NONE : $account->language;
-        if(empty($account->field_ip_login[$language][0])){
-         $edit = array(
-           'field_ip_login' => array(
-             $language => array(
-               0 => $value,
-             ),
-           ),
-         );
-         user_save($account, $edit);
-        }
-      }else {
-        watchdog('ip_login', 'Invalid IP range or address @range for user id (@uid). IP address match _NOT_ migrated for this user.',
-                             array('@range' => $row->ip_match, '@uid' => $row->uid));
-        $sandbox['errors'] = TRUE;
-      }
-    }
-    $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
-    // Tell user about watchdog log if any errors
-    if($sandbox['#finished'] && !empty($sandbox['#errors'])){
-      drupal_set_message('Some errors were encountered during IP address migration. Check the watchdog log for more details.');
-    }elseif($sandbox['#finished']){
-      return t('IP Login field migration completed successfully.');
-    }
-  }
-
-}
diff --git a/ip_login.module b/ip_login.module
index 68d10ef..9fa6934 100644
--- a/ip_login.module
+++ b/ip_login.module
@@ -1,543 +1,415 @@
-<?php
-/**
- * @file
- * Allow user login by IP addresses, ranges or wildcards.
- *
- * Originally by David W H Thomas
- * Major enhancements and 2.x branch by Jim Kirkpatrick
- * Other big contributions from:
- *  - JohnV: Code tidy/refactor & D7 version - http://drupal.org/node/1151458
- *  - PeterX: Many bug fixes and tweaks
- * Picked up again by David Thomas for 7.3.x
- */
-
-/*
- * @todo for security, IP addresses and ranges should really be checked for collisions between existing accounts users
- */
-
-define('ATTEMPT_IP_LOGIN', 'user/login_by_ip'); // path for ip login
-define('IP_LOGOUT', 'user/logout'); // path for user logout (different between D6/D7)
-define('IP_CHECKED', 'ip_login_checked'); // TRUE when IP check has happened
-define('IP_UID_MATCH', 'ip_login_uid'); // TRUE when a user account matches the request IP
-define('LOGIN_AS_DIFFERENT_USER', 'ip_login_as_different_user'); // TRUE when user wants alternate account
-define('CACHE_DISABLED', 0);  // D7 TODO: this is removed from bootstrap.inc, and now in?? --> avoid double definition
-
-/**
- * Implementation of hook_menu().
- */
-function ip_login_menu() {
-  $items[ATTEMPT_IP_LOGIN] = array(
-    'title' => 'Automatically log me in by IP',
-    'access callback' => 'ip_login_is_possible',
-    'page callback' => 'ip_login_attempt_login',
-    'type' => MENU_CALLBACK,
-  );
-  $items['admin/config/people/ip_login'] = array(
-    'title' => 'IP Login',
-    'description' => 'Configure IP Login settings',
-    'access callback' => 'user_access',
-    'access arguments' => array('administer ip login'),
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('ip_login_admin_settings'),
-    'file' => 'ip_login.admin.inc',
-    'type' => MENU_NORMAL_ITEM,
-  );
-  return $items;
-}
-
-/**
- * Implementation of hook_help().
- */
-function ip_login_help($path, $arg) {
-  switch ($path) {
-    case 'admin/config/people/ip_login':
-      $help = '<p>';
-      $help .= t("This module allows this site to automatically authenticate and login users arriving with a chosen IP address - optionally at certain pages only.") . '</p> <p>';
-      $help .= t(
-        'It also allows users with the <code>administer ip login</code> and <code>can log in as another user</code> <a href="@permissions-link">permissions</a> to log out and log in as another user, with other users being forced to stay logged in.',
-        array('@permissions-link' => '/admin/people/permissions#module-ip_login'));
-      $help .=  '</p>';
-      $help .= ip_login_help_ranges();
-    return $help;
-  }
-}
-
-/**
- * Provides help about accepted values of IP ranges etc.
- */
-function ip_login_help_ranges($intro = '') {
-  $help = '<p id="ip_login">' . $intro . ' ' . t('Accepted IP Login match values are:') . '</p>';
-  $help .= '<ul><li>';
-  $help .= t("Single IP matches like <code>123.123.123.123</code>");
-  $help .= '</li><li>';
-  $help .= t("Wildcards using an asterisk (<code>*</code>) in any quadrant except the first one, for example <code>123.123.123.*</code> or <code>100.*.*.*</code> etc.");
-  $help .= '</li><li>';
-  $help .= t("Ranges using a hyphen (<code>-</code>) in any quadrant except the first one, for example <code>123.123.123.100-200</code> etc.");
-  $help .= '</li><li>';
-  $help .= t("Any number of comma-separated IP addresses or ranges like <code>10.11.12.13, 123.123.123.100-200, 123.123.124-125.*</code> etc.");
-  $help .= '</li></ul>';
-  return $help;
-}
-
-/**
- * Implementation of hook_permission().
- */
-function ip_login_permission() {
-  // @todo add perms checks to correct places in module
-  return array(
-    'administer ip login' => array(
-      'title' => t('Administer IP Login module'),
-      'description' => t('Perform administration tasks for IP Login.'),
-    ),
-    'view any field_ip_login' => array(
-      'title' => t('View any field_ip_login'),
-      'description' => t('View the display output of field_ip_login on any user account.'),
-    ),
-    'view own field_ip_login' => array(
-      'title' => t('View own field_ip_login'),
-      'description' => t('View the display output of field_ip_login on own user account.'),
-    ),
-    'edit any field_ip_login' => array(
-      'title' => t('Edit any field_ip_login'),
-      'description' => t('Edit the value of field_ip_login on any user account.'),
-    ),
-    'edit own field_ip_login' => array(
-      'title' => t('Edit own field_ip_login'),
-      'description' => t('Edit the value of field_ip_login on own user account.'),
-    ),
-    'can log in as another user' => array(
-      'title' => t('Can login as other user'),
-      'description' => t('Allow user to logout and login as another user.'),
-    ),
-  );
-}
-
-/**
- * Implements hook_field_access
- * Restricts view and edit access to field_ip_login
- */
-function ip_login_field_access($op, $field, $entity_type, $entity, $account) {
-
-  if ($field['field_name'] == 'field_ip_login') {
-    global $user;
-    $account = $account ? $account : $user; // Use logged in user if account not passed
-    switch($op){
-      case 'view':
-        // User has admin access?
-        if (user_access('administer ip login', $account) || user_access('administer users', $account)) {
-          return TRUE;
-        // User has access to view any field_ip_login instance?
-        }elseif (user_access('view any field_ip_login', $account)){
-          return TRUE;
-        // User has access to view own field_ip_login instance
-        // and logged in user uid matches entity uid being checked
-        }elseif (user_access('view own field_ip_login', $account) && isset($entity->uid) && $entity->uid == $user->uid){
-          return TRUE;
-        }
-      break;
-      case 'edit':
-        // User has admin access?
-        if (user_access('administer ip login', $account) || user_access('administer users', $account)) {
-          return TRUE;
-        // User has access to edit any field_ip_login instance?
-        }elseif (user_access('edit any field_ip_login', $account)){
-          return TRUE;
-        // User has access to view own field_ip_login instance
-        // and logged in user uid matches entity uid being checked
-        }elseif (user_access('edit own field_ip_login', $account) && isset($entity->uid) && $entity->uid == $user->uid){
-          return TRUE;
-        }
-      break;
-    }
-    return FALSE; // Default access deny
-  }
-  
-}
-
-/**
- * Implementation of hook_boot().
- *
- *   see http://drupal.org/node/509028
- */
-function ip_login_boot() {
-  // skip rest of this if user is logged in
-  global $user;
-  if ($user->uid != 0 || drupal_is_cli()) return;
-
-  // skip rest of this if the admin has disabled IP login
-  if (!variable_get('ip_login_enabled', 1)) return;
-
-  // Avoid settings cookies if not on an IP Login-enabled page to improve
-  // external caching support - http://drupal.org/node/1263234 thanks Vacilando
-  if (ip_login_check_path() === FALSE) return;
-
-  // check the user IP
-  $matched_uid = ip_login_check(ip_login_ip_address());
-  if ($matched_uid > 0) {
-    $can_login_as_another_user = isset($_COOKIE[LOGIN_AS_DIFFERENT_USER]) ? $_COOKIE[LOGIN_AS_DIFFERENT_USER] : NULL;
-
-    // for clarity about every scenario, use extensive logic
-    if (is_null($can_login_as_another_user)) {
-      // first time login for user, so log in automatically.
-      ip_login_login($matched_uid);
-      drupal_goto(ltrim(request_uri(), '/'));
-    }
-    elseif ($can_login_as_another_user == FALSE) {
-      // user logged out, but is not allowed to use another user, so log in again.
-      ip_login_login($matched_uid);
-      drupal_goto(ltrim(request_uri(), '/'));
-    }
-    elseif ($can_login_as_another_user == TRUE) {
-      // user logged out, and is allowed to login as another user,
-      // so do nothing, just stay on this page and wait for user action.
-    }
-    else {
-      // do automatic login.
-      ip_login_login($matched_uid);
-      drupal_goto(ltrim(request_uri(), '/'));
-    }
-  }
-}
-
-/**
- * Implementation of hook_block_info
- *
- * Adds the simple 'Automatic login' link block
- */
-function ip_login_block_info() {
-  $blocks = array();
-  $blocks['ip-login-link'] = array(
-    'info' => t('Log in by IP link'),
-    'cache' => DRUPAL_NO_CACHE,
-  );
-  return $blocks;
-}
-
-/**
- * Implementation of hook_block_view
- *
- * Makes simple a 'Automatic login' link available for those not wanting to use the
- * overridden 'User Login' block.
- */
-function ip_login_block_view($delta = '') {
-  // only show for anonymous users who can log in
-  global $user;
-  if ($user->uid > 0 || !ip_login_is_possible()) return;
-  if ($delta <> 'ip-login-link') return;
-  // build simple block
-  // @todo should be a hook_theme call
-  $link_text = t(variable_get('ip_login_link_login_block', 'Log in automatically'));
-  $markup = '<div class="ip-login-available"><span class="ip-login-link">';
-  $markup .= l($link_text, ATTEMPT_IP_LOGIN, array('query' => array('ip_login_override_pages' => 'yes')));
-  $markup .= '</span></div>';
-  $block = array('subject' => t('Automatic login'), 'content' => $markup);
-  return $block;
-}
-
-/**
- * Implementation of hook_form_alter().
- */
-function ip_login_form_alter(&$form, &$form_state, $form_id) {
-  // @todo should call hook_theme ideally
-  switch ($form_id) {
-    case 'user_login':
-      $matched_uid = ip_login_check(ip_login_ip_address());
-      if ($matched_uid > 0) {
-        $link_text = t(variable_get('ip_login_link_login_page', 'Log in automatically'));
-        if (strlen($link_text)) { // hide if no link text
-          $link_help = t(variable_get('ip_login_link_login_page_help', "Your computer's IP address has been matched and validated."));
-          $markup = '<ul class="item-list">';
-          $markup .= '<li><strong>' . l($link_text, ATTEMPT_IP_LOGIN, array('query' => array('ip_login_override_pages' => 'yes'))) . '</strong>';
-          if (strlen($link_help)) $markup .= '<br/><small>' . filter_xss_admin($link_help) . '</small>';
-          $markup .= '</li></ul>';
-          $form['ip_login'] = array(
-            '#markup' => $markup,
-            '#weight' => variable_get('ip_login_link_login_page_weight', -10),
-          );
-        }
-      }
-      break;
-    case 'user_login_block':
-      $matched_uid = ip_login_check(ip_login_ip_address());
-      if ($matched_uid > 0) {
-        $link_text = t(variable_get('ip_login_link_login_block', 'Log in automatically'));
-        if (strlen($link_text)) { // hide if no link text
-          $markup = '<ul class="item-list">';
-          $markup .= '<li><strong>' . l($link_text, ATTEMPT_IP_LOGIN, array('query' => array('ip_login_override_pages' => 'yes'))) . '</strong>';
-          $markup .= '</li></ul>';
-          $form['ip_login'] = array(
-            '#markup' => $markup,
-            '#weight' => variable_get('ip_login_link_login_page_weight', -10),
-          );
-        }
-      }
-      break;
-  }
-}
-
-/**
- * Helper function to return IP address
- * for easy test/debug
- */
-function ip_login_ip_address(){
-  return ip_address();
-}
-
-/**
- * Callback function for hook_menu (menu access)
- *
- * @return boolean
- *    TRUE if login by IP can happen because a user match has happened
- */
-function ip_login_is_possible() {
-  // Return TRUE if a matching uid is found.
-  return !empty($_SESSION[IP_UID_MATCH]);
-}
-
-/**
- * Checks path of current page matches any set as options on the admin page to
- * see if IP login should occur. Adapted from core Block module's block_list().
- *
- * @return $uid_matched
- *    The uid of the matching user account
- */
-function ip_login_check_path() {
-  if (!isset($_GET['ip_login_override_pages'])) {
-    $pages = variable_get('ip_login_active_pages', '');
-    if ($pages) {
-      $page_match = FALSE;
-      // first char, if variable set, is 'check_mode' - remainder is paths to match or PHP
-      $check_mode = substr($pages, 0, 1);
-      $pages = substr($pages, 1);
-      if ($check_mode < 2) {
-        // Compare with the path with allowed pages.
-        // Since this happens in hook_boot, we cannot call drupal_get_path_alias
-        // so call our own path matcher code and avoid a DB/alias check
-        $path = (isset($_GET['q']) ? $_GET['q'] : '');
-        $page_match = ip_login_match_path($path, $pages);
-        // When $check_mode has a value of 0, the IP check happens on
-        // all pages except those listed in $pages. When set to 1, IPs
-        // are checked only on those pages listed in $pages.
-        $page_match = !($check_mode xor $page_match);
-      }
-      else {
-        // evaluate PHP
-        $page_match = drupal_eval($pages);
-      }
-      // if we don't have a path/PHP match, don't log in
-      if (!$page_match) return FALSE;
-    }
-  }
-  // all is well, continue with login.
-  return TRUE;
-}
-
-/**
- * Check if a path matches any pattern in a set of patterns. This is a clone of
- * drupal_match_path() found in path.inc because the bootstrap hasn't occurred,
- * so path.inc isn't available.
- *
- * See: http://api.drupal.org/api/drupal/includes--path.inc/function/drupal_match_path/6
- */
-function ip_login_match_path($path, $patterns) {
-  static $regexps;
-  if (!isset($regexps[$patterns])) {
-    $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/';
-  }
-  return preg_match($regexps[$patterns], $path);
-}
-
-/**
- * Checks the request IP and logs user in there's a match by calling
- * ip_login_check then ip_login_attempt_login
- *
- * Callback function for hook_menu
- */
-function ip_login_attempt_login() {
-  drupal_page_is_cacheable(FALSE);
-  $matched_uid = ip_login_check(ip_login_ip_address());
-  if ($matched_uid > 0) {
-    ip_login_login($matched_uid);
-  }
-  drupal_goto(variable_get('ip_login_destination', 'user'));
-}
-
-/**
- * Compares the current request's IP address to the ip_login_user table
- * and then does a proper match for each match on exact, ranges and wildcards
- *
- * @param $ip
- *    An ip address string, usually from the current user's request
- * @return $uid_matched
- *    The uid of the matching user account
- */
-function ip_login_check($ip, $diagnostics = FALSE) {
-  // have we checked user IP already this session?
-  if (!empty($_SESSION[IP_CHECKED])) {
-    return $_SESSION[IP_UID_MATCH];
-  }
-
-  $uid_matched = ip_login_match_user($ip, $diagnostics);
-
-  // if not diagnostic test, set processed session flag, store matching user (if there is one)
-  if (!$diagnostics) {
-    $_SESSION[IP_CHECKED] = TRUE;
-    $_SESSION[IP_UID_MATCH] = $uid_matched;
-  }
-  return $uid_matched;
-}
-
-/**
- * Checks for a user with matching IP address
- */
-function ip_login_match_user($ip, $diagnostics = FALSE){
-  // Check for ip address in field_data_field_ip_login data table
-  // We can utilize a range search via
-  // field_ipaddress long numeric range query
-  // Currently IPv4 only
-  $matching_uid = db_select('field_data_field_ip_login', 'ip')
-  ->fields('ip', array('entity_id'))
-  ->condition('entity_type', 'user')
-  ->condition('field_ip_login_start', ip2long($ip), '<=')
-  ->condition('field_ip_login_end', ip2long($ip), '>=')
-  ->execute()->fetchField();
-  return $matching_uid;
-}
-
-/**
- * Performs a login for user with $uid and stores IP Login variables for later
- *
- * @param $uid
- *    The UID of the account to be logged in
- */
-function ip_login_login($uid) {
-  if ($uid) { // if a uid is passed in
-    // check this page's path is ok to login automatically from
-    if (ip_login_check_path() === FALSE) return;
-
-    // get user module and include some handy functions
-    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
-    // get account (reload from db) , bail if no loaded active user
-    $account = user_load($uid, TRUE);
-    if (!$account || $account->status <> 1 ) return;
-
-    // login by assigning account to global $user object
-    global $user;
-    $user = $account;
-    if (!variable_get('ip_login_suppress_messages', 0)) {
-      // notify user - if messages not suppressed
-      $message = t(
-        'Welcome %name. You have been automatically logged into %sitename.',
-        array(
-          '%name' => $user->name,
-          '%sitename' => variable_get('site_name', 'this website'),
-        ));
-      drupal_set_message($message);
-
-      // add handy message for those who can log out and then back in as another user
-      if (_ip_login_can_login_as_another_user($user)) {
-        $message = t(
-          'You may also <a href="@other_user_link">log in as another user</a> if required.',
-          array('@other_user_link' => url(IP_LOGOUT))
-        );
-        drupal_set_message($message);
-      }
-    }
-
-    // following borrowed from user_authenticate_finalize(), but with slightly different message
-    watchdog('user', 'Session opened for %name by IP Login.', array('%name' => $user->name));
-
-    // This is also used to invalidate one-time login links.
-    $user->login = time();
-    db_update('users')
-      ->fields(array('login' => $user->login))
-      ->condition('uid', $user->uid)
-      ->execute();
-
-    // Regenerate the session ID to prevent against session fixation attacks.
-    // This is called before hook_user in case one of those functions fails
-    // or incorrectly does a redirect which would leave the old session in place.
-    $edit = NULL;
-    drupal_session_regenerate();
-    user_module_invoke('login', $edit, $user);
-
-    // following borrowed from ipAuthenticator's login and avoids caching issues
-    if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED && !isset($_GET['ip_login_no_cache'])) {
-      // make a url to reload page, remove newlines from the URL to avoid header injection attacks.
-      // use admin settings for destination if set.
-      $url = variable_get('ip_login_destination', '');
-      if (strlen($url) == 0) $url = str_replace(array("\n", "\r"), '', $_GET["q"]);
-      if ($url == 'logout') $url = '<front>';
-      $url = url($url, array('query' => array('ip_login_no_cache=' . md5(time())), 'absolute' => TRUE));
-      // Before the redirect, allow modules to react to the end of the page request.
-      module_invoke_all('exit', $url);
-
-      // Even though session_write_close() is registered as a shutdown function, we
-      // need all session data written to the database before redirecting.
-      session_write_close();
-
-      header('Location: ' . $url, TRUE, 302);
-      exit();
-    }
-  }
-}
-
-/**
- * Implementation of hook_user_logout
- *
- * Called from hook_user on logout, most of the code taken from user_logout()
- * and _drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION).
- * D7-changes: this is now an implementation of a hook, so:
- *  - Only do a logout, leave the automatic login to ip_login_boot;
- *  - prevent logging out if needed, just by calling drupal_goto()
- *  - N.B. check user_logout() in user.pages.inc; this is the calling function;
- *  - N.B. check devel_switch_user() in devel.module; here users are switched, too;
- */
-function ip_login_user_logout() {
-  // prevent recursive call via user_module_invoke() / module_invoke_all() in user.pages.inc
-  if (!ip_login_is_possible()) {
-    return;
-  }
-  else {
-    $_SESSION[IP_CHECKED] = FALSE;
-    $_SESSION[IP_UID_MATCH] = 0;
-  }
-
-  global $user;
-
-  // store whether this user can log back in automatically
-  $can_login_as_another_user = _ip_login_can_login_as_another_user($user);
-
-  // sets indicator to behaviour in hook_boot().
-  $expire = 0; // Cookie expires at the end of the session (when the browser closes).
-  setcookie(LOGIN_AS_DIFFERENT_USER, $can_login_as_another_user, $expire, '/');
-
-  if (!$can_login_as_another_user) {
-    // @todo: it is possible that some other hook_user_logout() has been called already
-    // does this generate an undetermined state?
-    $message = t(variable_get('ip_login_logged_back_in',
-      'This account does not have permission to log out once logged in automatically. You have been logged back in.')
-    );
-    $message = token_replace($message, array('user' => $user), array('clear' => TRUE));
-    drupal_set_message($message, 'warning');
-    // show the login page
-    drupal_goto(variable_get('ip_login_destination', 'user'));
-  }
-}
-
-/*
- * Returns TRUE if a user has permission to log out and back in as another user
- */
-function _ip_login_can_login_as_another_user($user) {
-  // super user can log in as another user
-  if ($user->uid == 1) return TRUE;
-  // people who can administer this module can
-  if (user_access('administer ip login', $user)) return TRUE;
-  // If the user doesn't have a matching IP, then we let them log in normally
-  if (!ip_login_check(ip_login_ip_address())) {
-    return TRUE;
-  }
-  // all others check correct permission, making sure only TRUE, FALSE is returned
-  return user_access('can log in as another user', $user) ? TRUE : FALSE;
-}
+<?php
+/**
+ * Allow user login by IP Address
+ * by David W Thomas
+ * updated by Jim Kirkpatrick
+ */
+
+/* recently done:
+ *    fixed a few incorrect usages of t()
+ * 
+ * @todo for security, IP addresses and ranges should really be checked for collisions between existing accounts users
+ * @todo Check usage of $GLOBALS['conf']['cache'] in ip_login_attempt_login())
+ * @todo Integrate with Content Profile
+*/
+
+define('ATTEMPT_IP_LOGIN', 'user/login_by_ip'); // path for ip login
+define('IP_CHECKED', 'ip_login_checked'); // true when IP check has happened
+define('IP_UID_MATCH', 'ip_login_uid'); // true when a user profile matches the request IP
+define('LOGIN_BY_IP_COMPLETE', 'ip_login_by_ip_complete'); // true when IP login process has completed
+define('LOGIN_AS_DIFFERENT_USER', 'ip_login_as_different_user'); // true when user wants alternate account
+
+
+/**
+ * Implementation of hook_boot().
+ * 
+ *   see http://drupal.org/node/509028
+ */
+function ip_login_boot() {
+  // skip rest of this if the admin has disabled IP login
+  if (!variable_get('ip_login_enabled', 1)) return;
+
+  // get sanisised session variables
+  $_SESSION[IP_CHECKED] = (isset($_SESSION[IP_CHECKED]) ? $_SESSION[IP_CHECKED] : FALSE);
+  $_SESSION[LOGIN_AS_DIFFERENT_USER] = (isset($_SESSION[LOGIN_AS_DIFFERENT_USER]) ? $_SESSION[LOGIN_AS_DIFFERENT_USER] : FALSE);
+  $_SESSION[LOGIN_BY_IP_COMPLETE] = (isset($_SESSION[LOGIN_BY_IP_COMPLETE]) ? $_SESSION[LOGIN_BY_IP_COMPLETE] : FALSE);
+
+  // have we checked user IP?
+  if (!$_SESSION[IP_CHECKED]) {
+    ip_login_check(ip_address());
+    // $_SESSION[IP_CHECKED] is now true, $_SESSION[IP_UID_MATCH] now contains uid matched or 0 if no match;
+  }
+
+  // get user and check make sure they want to be auto-logged in
+  global $user; 
+  if (!$_SESSION[LOGIN_BY_IP_COMPLETE] && $user->uid == 0 && !$_SESSION[LOGIN_AS_DIFFERENT_USER]) {
+    // not ip logged in, or wanting another account
+    if ($_SESSION[IP_UID_MATCH] > 0) {
+      // we have a matching uid so log in
+      ip_login_login($_SESSION[IP_UID_MATCH]);
+    }
+  }
+}
+
+
+/**
+ * Implementation of hook_help().
+ */
+function ip_login_help($path, $arg) {
+  // @todo use t()
+  switch ($path) {
+    case 'admin/settings/iplogin':
+      $help =  '<p>';
+      $help .= t("This module allows this site to automatically authenticate and login users arriving with a chosen IP address.") . ' ';
+      $help .= t("IP values can be stored in a user's profile (using the core <em>Profile</em> module) in the field selected by the <em>Profile module IP address</em> field, below.") . ' ';
+      $help .= t(
+        'It also allows users with the <code>administer ip login</code> and <code>can log in as another user</code> <a href="@permissions-link">permissions</a> to log out and log in as another user, with other users being forced to stay logged in.',
+        array('@permissions-link' => '/admin/user/permissions#module-ip_login'));
+      $help .=  '</p><p>';
+      $help .= t('Accepted profile field IP values are:');
+      $help .= '</p><ul><li>';
+      $help .= t("Single IP matches like <code>123.123.123.123</code>");
+      $help .= '</li><li>';
+      $help .= t("Wildcards using an asterisk (<code>*</code>) in any quadrant except the first one, for example <code>123.123.123.*</code> or <code>100.*.*.*</code> etc.");
+      $help .= '</li><li>';
+      $help .= t("Ranges using a hyphen (<code>-</code>) in any quadrant except the first one, for example <code>123.123.123.100-200</code> etc.");
+      $help .= '</li><li>';
+      $help .= t("Any number of comma-separated IP addresses or ranges like <code>10.11.12.13, 123.123.123.100-200, 123.123.124-125.*</code> etc.");
+      $help .= '</li></ul>';
+      return $help;
+  }
+}
+
+
+/**
+ * Implementation of hook_user().
+ * 
+ * Allows users to log out without immediately logging them back in.
+ * NOTE: this module may stop other modules hook_user(logout) code firing as it
+ * destroys the session
+ */
+function ip_login_user($op, &$edit, &$account, $category = NULL) {
+  // if logging out and we're currently logged in by IP...
+  if ($op == "logout" && $_SESSION[IP_UID_MATCH] >0) ip_login_as_different_user();
+}
+
+
+/**
+ * Implementation of hook_menu().
+ */
+function ip_login_menu() {
+  $items[ATTEMPT_IP_LOGIN] = array(
+    'title' => 'Automatically log me in by IP',
+    'access callback' => 'ip_login_is_possible',
+    'page callback' => 'ip_login_attempt_login',
+    'type' => MENU_CALLBACK,
+  );
+  $items['admin/settings/iplogin'] = array(
+    'title' => 'IP Login settings',
+    'description' => 'Configure IP Login settings',
+    'access callback' => 'user_access',
+    'access arguments' => array('administer ip login'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('ip_login_admin_settings'),
+    'file' => 'ip_login.admin.inc',
+    'type' => MENU_NORMAL_ITEM,
+    );
+  return $items;
+}
+
+
+/**
+ * Returns TRUE if login by IP can happen
+ * 
+ * Used for menu access
+ */
+function ip_login_is_possible() {
+  return ($_SESSION[IP_UID_MATCH] > 0);
+}
+
+
+/**
+ * Checks the request IP and logs user in there's a match by calling
+ * ip_login_check then ip_login_attempt_login
+ */
+function ip_login_attempt_login() {
+  $GLOBALS['conf']['cache'] = false; // don't cache - not sure if this is correct usage
+  $uid_matched = ip_login_check(ip_address());
+  if ($uid_matched) ip_login_login($uid_matched);
+  drupal_goto(variable_get('ip_login_destination', 'user'));
+}
+
+
+/**
+ * Implementation of hook_perm().
+ */
+function ip_login_perm() {
+  // @todo add perms checks to correct places in module
+  return array('administer ip login', 'can log in as another user');
+}
+
+/**
+ * Implementation of hook_form_alter().
+ */
+function ip_login_form_alter(&$form, &$form_state, $form_id) {
+  if (!ip_login_is_possible()) return;
+  
+  if ($form_id == 'user_login') {
+    $link_text = t(variable_get('ip_login_link_login_page', 'Log in automatically'));
+    if (strlen($link_text)) { // hide if no link text
+      $link_help = t(variable_get('ip_login_link_login_page_help', "Your computer's IP address has been matched and validated."));
+      $markup .= '<br/>';
+      $markup .= '<ul class="item-list">';
+      $markup .= '<li><strong>' . l($link_text, ATTEMPT_IP_LOGIN) . '</strong>';
+      if (strlen($link_help)) $markup .= '<br/><small>' . filter_xss_admin($link_help) . '</small>';
+      $markup .= '</li></ul>';
+      $form['ip_login'] = array(
+        '#value' => $markup,
+        '#weight' => variable_get('ip_login_link_login_page_weight', -10),
+      );
+    }
+  }
+  elseif ($form_id == 'user_login_block') {
+    $link_text = t(variable_get('ip_login_link_login_block', 'Log in automatically'));
+    if (strlen($link_text)) { // hide if no link text
+      $markup .= '<ul class="item-list">';
+      $markup .= '<li><strong>' . l($link_text, ATTEMPT_IP_LOGIN) . '</strong>';
+      $markup .= '</li></ul>';
+      $form['ip_login'] = array(
+        '#value' => $markup,
+        '#weight' => variable_get('ip_login_link_login_block_weight', -10),
+      );
+    }
+  }
+}
+
+
+/**
+ * Compares the current request's IP address to the user profile IP range field
+ * and then does a proper match for each match on exact, ranges and wildcards
+ * @param $ip
+ *    An ip address string, usually from the current user's request
+ * @return $uid_matched
+ *    The uid of the matching user account
+ */
+function ip_login_check($ip, $diagnostics = FALSE) {
+  // break up IP, get profile field for ip address
+  $addr = explode(".", check_plain($ip));
+  $profile_field = variable_get('ip_login_profile_ip_field', 'profile_ip');
+  $matches = FALSE;
+
+  // Find user profile ip values that matches the first part of the user's IP
+  // ANYWHERE except the end - not desparetly efficient but works consistently
+  // with comma separated IP ranges and spaces in the profile field.
+  $partial_matches = db_query("SELECT pv.uid, pv.value FROM {profile_values} pv
+             INNER JOIN {profile_fields} pf ON pv.fid = pf.fid
+             WHERE pf.name = '%s' AND (pv.value) LIKE ('%s')", $profile_field, '%' . $addr[0] . '.%');
+
+  $uid_matched = 0;
+  while (($partial_match = db_fetch_object($partial_matches)) && !$uid_matched) {
+
+    // multiple values are separated with commas so try each in turn
+    $profile_ip_ranges = explode(",", $partial_match->value);
+    foreach ($profile_ip_ranges as $ip_range) {
+
+      // clear any whitespace, break into quads, then compare
+      $ip_range = explode('.', trim($ip_range));
+      foreach ($ip_range as $index => $quad) {
+        $matches = ip_login_match_quad($addr[$index], $quad);
+        if (!$matches) break; // no match, escape this foreach and move on to next IP range
+      }
+      // if it matches, stop here and do login
+      if ($matches) {
+        $uid_matched = $partial_match->uid;
+        break 2; // escape the foreach and while
+      }
+    }
+  }
+  
+  // if not diagnostic test, set processed session flag, store matching user (if there is one)
+  if (!$diagnostics) {
+    $_SESSION[IP_CHECKED] = TRUE;
+    $_SESSION[IP_UID_MATCH] = $uid_matched;
+  }
+  return $uid_matched;
+}
+
+/**
+ * Log user with $uid in ip address and profile_ip profile field
+ * 
+ * @param $ip
+ *    An ip address string
+ */
+function ip_login_login($uid) {
+  if ($uid) { // if a uid is passed in
+    // get user module and include some handy functions
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+
+    if ($account = user_load(array('uid' => $uid, 'status' => 1))) { // if loaded active user
+      // login by assigning account to global $user object
+      global $user;
+      $user = $account;
+
+      // notify user - if messages not suppressed
+      if (!variable_get('ip_login_suppress_messages', 0)) {
+        $message = t(
+          'Welcome %name. You have been automatically logged into %sitename.',
+          array(
+            '%name' => $user->name,
+            '%sitename' => variable_get('site_name', 'this website'),
+          ));
+        drupal_set_message($message);
+
+        // add handy message for those who can log out and then back in as another user
+        if (_ip_login_can_use_alternate_account($user)) {
+          $message = t(
+            'You may also <a href="@other_user_link">log in as another user</a> if required.',
+            array('@other_user_link' => url('logout'))
+          );
+          drupal_set_message($message);
+        }
+      }
+      watchdog('user', 'Session opened for %name by IP Login.', array('%name' => $user->name));
+      $_SESSION[LOGIN_BY_IP_COMPLETE] = TRUE;
+      $_SESSION[LOGIN_AS_DIFFERENT_USER] = FALSE;
+      
+      // Update the user table timestamp noting user has logged in.
+      db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
+      // IMPORTANT: drupal call to regenerate session data for anon user to authenticated user
+      sess_regenerate();
+
+      // invoke hook_user in other modules
+      $null = NULL;
+      user_module_invoke('login', $null, $user);
+
+
+      // following borrowed from ipAuthenticator's login and avoids caching issues
+      if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED && !isset($_GET['ip_login_no_cache'])) {
+        // make a url to reload page, remove newlines from the URL to avoid header injection attacks.
+        // use admin settings for destination if set.
+        $url = variable_get('ip_login_destination', '');
+        if (strlen($url) == 0) $url = str_replace(array("\n", "\r"), '', $_GET["q"]);
+        if ($url == 'logout') $url = '<front>';
+        $url = url($url, array('query' => array('ip_login_no_cache' => md5(time())), 'absolute' => TRUE));
+        // Before the redirect, allow modules to react to the end of the page request.
+        module_invoke_all('exit', $url);
+
+        // Even though session_write_close() is registered as a shutdown function, we
+        // need all session data written to the database before redirecting.
+        session_write_close();
+
+        header('Location: '. $url, TRUE, 302);
+        exit();
+      }
+    }
+  }
+}
+
+
+/**
+ * Logs the current user out.
+ * 
+ * Called from hook_user on logout, most of the code taken from user_logout()
+ * and _drupal_bootstrap().
+ */
+function ip_login_as_different_user() {
+
+  global $user;
+  watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
+
+  // store whether this user can log back in automatically
+  $can_login_as_another_user = _ip_login_can_use_alternate_account($user);
+
+  // Destroy the current session, if we have one; wipe the IP Login UID to ensure no loops on call to hook_user(logout)
+  if (session_name() <> '') session_destroy();
+  $_SESSION[IP_UID_MATCH] = 0; 
+
+  // Call other module's hook_user logout functions
+  $null = NULL; //Only variables can be passed by reference workaround.
+  user_module_invoke('logout', $null, $user);
+
+  // Load the anonymous user
+  $user = drupal_anonymous_user();
+
+  require_once variable_get('session_inc', './includes/session.inc');
+  session_set_save_handler('sess_open', 'sess_close', 'sess_read', 'sess_write', 'sess_destroy_sid', 'sess_gc');
+  session_start();
+
+  $_SESSION[LOGIN_AS_DIFFERENT_USER] = $can_login_as_another_user;
+  $_SESSION[LOGIN_BY_IP_COMPLETE] = FALSE;
+
+  if (!$_SESSION[LOGIN_AS_DIFFERENT_USER]) {
+    $message = t('This account does not have permission to log out once logged in automatically. You have been logged back in.');
+    drupal_set_message($message, 'warning');
+  }
+  // show the login page
+  drupal_goto(variable_get('ip_login_destination', 'user'));
+}
+
+
+/**
+ * Compares a single IP quadrant to a matching quadrant
+ *
+ * The matching quad can contain wildcards (*), ranges (10-12) or exact numbers
+ * @param $find_value
+ *    A string containing the quadrant value being looked for
+ * @param $in_range
+ *    String with a quadrant value, range or wildcard to compare to
+ * @return TRUE
+ *    If $find_value matches an IP address $in_range
+ *
+ */
+function ip_login_match_quad($find_value, $in_range) {
+  // if we've got a wildcard just return TRUE
+  if ($in_range == '*') return TRUE; 
+
+  // check if this quad contains the range character '-'
+  $range = explode('-', $in_range);
+  if (isset($range[1])) {
+    // we've got a range, test upper and lower bounds
+    if (($find_value >= $range[0]) && ($find_value <= $range[1])) return TRUE;
+  }
+  else {
+    // no range, just do normal match
+    return ($range[0] == $find_value);
+  }
+  return FALSE;
+}
+
+/*
+ * Returns TRUE if a user has permission to log out and back in as another user
+ */
+function _ip_login_can_use_alternate_account($user) {
+  return false;
+  // only allow users with correct permission to log in as another user,
+  // this presently enforced by an immediate re-login by IP
+  if ($user->uid == 1) return TRUE; // super user can
+  // people who can administer this module can
+  if (user_access('administer ip login', $user)) return TRUE;
+  // people running from their own machines can
+  //if (ip_address() == '127.0.0.1') return TRUE;
+
+  // If the user doesn't have a matching IP, then we let them log in normally
+  if (!ip_login_check(ip_address()))
+    return true;
+
+  // all others check correct permission
+  return user_access('can log in as another user', $user);
+}
+
+
+
+/*
+ * Implementation of hook_uninstall
+ */
+function hook_uninstall() {
+  variable_del('ip_login_enabled');
+  variable_del('ip_login_destination');
+  variable_del('ip_login_profile_ip_field');
+  variable_del('ip_login_link_login_block_weight');
+  variable_del('ip_login_link_login_block');
+  variable_del('ip_login_link_login_page_weight');
+  variable_del('ip_login_link_login_page_help');
+  variable_del('ip_login_link_login_page');
+  variable_del('ip_login_suppress_messages');
+}
diff --git a/views/ip_login.views_default.inc b/views/ip_login.views_default.inc
deleted file mode 100644
index 33f92ce..0000000
--- a/views/ip_login.views_default.inc
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-
-/**
- * @file
- * Default view at Admin > People > IP Login.
- */
-
-/**
- * Implements hook_views_default_views().
- */
-function ip_login_views_default_views() {
-  $views = array();
-
-  $view = new view;
-  $view->name = 'ip_login';
-  $view->description = '';
-  $view->tag = 'default';
-  $view->base_table = 'users';
-  $view->human_name = 'IP Login';
-  $view->core = 7;
-  $view->api_version = '3.0';
-  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-  
-  /* Display: Master */
-  $handler = $view->new_display('default', 'Master', 'default');
-  $handler->display->display_options['title'] = 'IP Login';
-  $handler->display->display_options['access']['type'] = 'perm';
-  $handler->display->display_options['access']['perm'] = 'administer users';
-  $handler->display->display_options['cache']['type'] = 'none';
-  $handler->display->display_options['query']['type'] = 'views_query';
-  $handler->display->display_options['query']['options']['query_comment'] = FALSE;
-  $handler->display->display_options['exposed_form']['type'] = 'basic';
-  $handler->display->display_options['exposed_form']['options']['reset_button'] = TRUE;
-  $handler->display->display_options['exposed_form']['options']['autosubmit'] = 0;
-  $handler->display->display_options['exposed_form']['options']['autosubmit_hide'] = 1;
-  $handler->display->display_options['pager']['type'] = 'full';
-  $handler->display->display_options['pager']['options']['items_per_page'] = '20';
-  $handler->display->display_options['pager']['options']['offset'] = '0';
-  $handler->display->display_options['pager']['options']['id'] = '0';
-  $handler->display->display_options['pager']['options']['expose']['items_per_page'] = TRUE;
-  $handler->display->display_options['pager']['options']['expose']['items_per_page_options'] = '5, 10, 20, 40, 60, 100';
-  $handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 1;
-  $handler->display->display_options['style_plugin'] = 'table';
-  /* Field: User: Name */
-  $handler->display->display_options['fields']['name']['id'] = 'name';
-  $handler->display->display_options['fields']['name']['table'] = 'users';
-  $handler->display->display_options['fields']['name']['field'] = 'name';
-  $handler->display->display_options['fields']['name']['label'] = 'Username';
-  $handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['external'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['word_boundary'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['ellipsis'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['more_link'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['trim'] = 0;
-  $handler->display->display_options['fields']['name']['alter']['html'] = 0;
-  $handler->display->display_options['fields']['name']['element_label_colon'] = 1;
-  $handler->display->display_options['fields']['name']['element_default_classes'] = 1;
-  $handler->display->display_options['fields']['name']['hide_empty'] = 0;
-  $handler->display->display_options['fields']['name']['empty_zero'] = 0;
-  $handler->display->display_options['fields']['name']['hide_alter_empty'] = 1;
-  $handler->display->display_options['fields']['name']['link_to_user'] = 1;
-  $handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
-  $handler->display->display_options['fields']['name']['format_username'] = 1;
-  /* Field: User: IP Login */
-  $handler->display->display_options['fields']['field_ip_login']['id'] = 'field_ip_login';
-  $handler->display->display_options['fields']['field_ip_login']['table'] = 'field_data_field_ip_login';
-  $handler->display->display_options['fields']['field_ip_login']['field'] = 'field_ip_login';
-  $handler->display->display_options['fields']['field_ip_login']['label'] = 'IP Address';
-  $handler->display->display_options['fields']['field_ip_login']['alter']['alter_text'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['make_link'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['absolute'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['external'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['replace_spaces'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['trim_whitespace'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['nl2br'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['word_boundary'] = 1;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['ellipsis'] = 1;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['more_link'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['strip_tags'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['trim'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['alter']['html'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['element_label_colon'] = 1;
-  $handler->display->display_options['fields']['field_ip_login']['element_default_classes'] = 1;
-  $handler->display->display_options['fields']['field_ip_login']['hide_empty'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['empty_zero'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['hide_alter_empty'] = 1;
-  $handler->display->display_options['fields']['field_ip_login']['click_sort_column'] = 'start';
-  $handler->display->display_options['fields']['field_ip_login']['type'] = 'field_ipaddress_shorthand';
-  $handler->display->display_options['fields']['field_ip_login']['group_rows'] = 1;
-  $handler->display->display_options['fields']['field_ip_login']['delta_offset'] = '0';
-  $handler->display->display_options['fields']['field_ip_login']['delta_reversed'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['delta_first_last'] = 0;
-  $handler->display->display_options['fields']['field_ip_login']['field_api_classes'] = 0;
-  /* Field: User: Roles */
-  $handler->display->display_options['fields']['rid']['id'] = 'rid';
-  $handler->display->display_options['fields']['rid']['table'] = 'users_roles';
-  $handler->display->display_options['fields']['rid']['field'] = 'rid';
-  $handler->display->display_options['fields']['rid']['alter']['alter_text'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['make_link'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['absolute'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['external'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['replace_spaces'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['trim_whitespace'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['nl2br'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['word_boundary'] = 1;
-  $handler->display->display_options['fields']['rid']['alter']['ellipsis'] = 1;
-  $handler->display->display_options['fields']['rid']['alter']['more_link'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['strip_tags'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['trim'] = 0;
-  $handler->display->display_options['fields']['rid']['alter']['html'] = 0;
-  $handler->display->display_options['fields']['rid']['element_label_colon'] = 1;
-  $handler->display->display_options['fields']['rid']['element_default_classes'] = 1;
-  $handler->display->display_options['fields']['rid']['hide_empty'] = 0;
-  $handler->display->display_options['fields']['rid']['empty_zero'] = 0;
-  $handler->display->display_options['fields']['rid']['hide_alter_empty'] = 1;
-  /* Field: User: Last access */
-  $handler->display->display_options['fields']['access']['id'] = 'access';
-  $handler->display->display_options['fields']['access']['table'] = 'users';
-  $handler->display->display_options['fields']['access']['field'] = 'access';
-  $handler->display->display_options['fields']['access']['alter']['alter_text'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['make_link'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['absolute'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['external'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['replace_spaces'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['trim_whitespace'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['nl2br'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['word_boundary'] = 1;
-  $handler->display->display_options['fields']['access']['alter']['ellipsis'] = 1;
-  $handler->display->display_options['fields']['access']['alter']['more_link'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['strip_tags'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['trim'] = 0;
-  $handler->display->display_options['fields']['access']['alter']['html'] = 0;
-  $handler->display->display_options['fields']['access']['element_label_colon'] = 1;
-  $handler->display->display_options['fields']['access']['element_default_classes'] = 1;
-  $handler->display->display_options['fields']['access']['hide_empty'] = 0;
-  $handler->display->display_options['fields']['access']['empty_zero'] = 0;
-  $handler->display->display_options['fields']['access']['hide_alter_empty'] = 1;
-  $handler->display->display_options['fields']['access']['date_format'] = 'time ago';
-  /* Field: User: Edit link */
-  $handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
-  $handler->display->display_options['fields']['edit_node']['table'] = 'users';
-  $handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
-  $handler->display->display_options['fields']['edit_node']['label'] = 'Edit';
-  $handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['make_link'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['absolute'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['external'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['replace_spaces'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['trim_whitespace'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['nl2br'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['word_boundary'] = 1;
-  $handler->display->display_options['fields']['edit_node']['alter']['ellipsis'] = 1;
-  $handler->display->display_options['fields']['edit_node']['alter']['more_link'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['strip_tags'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['trim'] = 0;
-  $handler->display->display_options['fields']['edit_node']['alter']['html'] = 0;
-  $handler->display->display_options['fields']['edit_node']['element_label_colon'] = 1;
-  $handler->display->display_options['fields']['edit_node']['element_default_classes'] = 1;
-  $handler->display->display_options['fields']['edit_node']['hide_empty'] = 0;
-  $handler->display->display_options['fields']['edit_node']['empty_zero'] = 0;
-  $handler->display->display_options['fields']['edit_node']['hide_alter_empty'] = 1;
-  $handler->display->display_options['fields']['edit_node']['text'] = 'edit';
-  /* Sort criterion: User: Last access */
-  $handler->display->display_options['sorts']['access']['id'] = 'access';
-  $handler->display->display_options['sorts']['access']['table'] = 'users';
-  $handler->display->display_options['sorts']['access']['field'] = 'access';
-  $handler->display->display_options['sorts']['access']['order'] = 'DESC';
-  /* Filter criterion: User: IP Login (field_ip_login:start) */
-  $handler->display->display_options['filters']['field_ip_login_start']['id'] = 'field_ip_login_start';
-  $handler->display->display_options['filters']['field_ip_login_start']['table'] = 'field_data_field_ip_login';
-  $handler->display->display_options['filters']['field_ip_login_start']['field'] = 'field_ip_login_start';
-  $handler->display->display_options['filters']['field_ip_login_start']['operator'] = 'not empty';
-  $handler->display->display_options['filters']['field_ip_login_start']['group'] = 1;
-  /* Filter criterion: User: Name */
-  $handler->display->display_options['filters']['uid']['id'] = 'uid';
-  $handler->display->display_options['filters']['uid']['table'] = 'users';
-  $handler->display->display_options['filters']['uid']['field'] = 'uid';
-  $handler->display->display_options['filters']['uid']['value'] = '';
-  $handler->display->display_options['filters']['uid']['exposed'] = TRUE;
-  $handler->display->display_options['filters']['uid']['expose']['operator_id'] = 'uid_op';
-  $handler->display->display_options['filters']['uid']['expose']['label'] = 'Username';
-  $handler->display->display_options['filters']['uid']['expose']['operator'] = 'uid_op';
-  $handler->display->display_options['filters']['uid']['expose']['identifier'] = 'uid';
-  $handler->display->display_options['filters']['uid']['expose']['multiple'] = FALSE;
-  $handler->display->display_options['filters']['uid']['expose']['reduce'] = 0;
-  
-  /* Display: Page */
-  $handler = $view->new_display('page', 'Page', 'page');
-  $handler->display->display_options['path'] = 'admin/people/ip-login';
-  $handler->display->display_options['menu']['type'] = 'tab';
-  $handler->display->display_options['menu']['title'] = 'IP Login';
-  $handler->display->display_options['menu']['weight'] = '10';
-  $handler->display->display_options['menu']['name'] = 'management';
-  $handler->display->display_options['menu']['context'] = 0;
-
-
-  $views['ip_login'] = $view;
-
-  return $views;
-}
