Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). node_revision_delete 2.1.1 Minor update available for module node_revision_delete (2.1.1). commerce_paypal 2.1.2 Minor update available for module commerce_paypal (2.1.2). ckeditor5_premium_features 1.8.1 Minor update available for module ckeditor5_premium_features (1.8.1). ckeditor5_plugin_pack 1.5.2 Minor update available for module ckeditor5_plugin_pack (1.5.2). node_revision_delete 2.1.0 Minor update available for module node_revision_delete (2.1.0). scheduler_content_moderation_integration 3.0.5 Minor update available for module scheduler_content_moderation_integration (3.0.... commerce 3.3.5 Minor update available for module commerce (3.3.5). geocoder 8.x-4.34 Minor update available for module geocoder (8.x-4.34).

This provides a field for storing an IP address or range.

The shorthand widget allows a user to enter the values in any of the following formats:

  • example.com
  • 10.10.10.10
  • 10.10.10.*
  • 10.10.10.0 - 10.10.12.255
  • 10.10.10.10-20

The CIDR widget allows CIDR inputs only:

  • 10.10.10.10/32

Drupal 7 version
The addresses are stored internally as a long, this allows you to do network computations quickly (e.g. is 10.10.10.10 within the range 10.10.10.0 - 10.10.10.50).

This code will find any user entities that have an IP range which includes the visitors current IP address.

$visitor_addr = ip2long($user->hostname);
$query = new EntityFieldQuery();
$result = $query
    ->entityCondition('entity_type', 'user')
    ->propertyCondition('status', 1)
    ->fieldCondition('field_yourfieldname', 'start', $visitor_addr, '<=', 0)
    ->fieldCondition('field_yourfieldname', 'end', $visitor_addr, '>=', 0)
    ->execute();

Activity

Total releases
3
First release
Apr 2026
Latest release
11 hours ago
Release cadence
0 days
Stability
67% stable

Release Timeline

Releases

Version Type Release date
2.1.x-dev Dev Apr 24, 2026
2.1.1 Stable Apr 24, 2026
2.1.0 Stable Apr 24, 2026