You are here

function ip_posts_insert in IP address manager 7.2

Same name and namespace in other branches
  1. 6 ip.module \ip_posts_insert()
  2. 7 ip.module \ip_posts_insert()

Insert a record into the ip_posts table.

5 calls to ip_posts_insert()
ip_backlog_comments in ./ip.module
Handle backlog of comments.
ip_comment_insert in ./ip.module
Implements hook_comment_insert().
ip_node_insert in ./ip.module
Implements hook_node_insert().
_drush_ip_backlog_comments_process_batch_task in ./ip.drush.inc
Batch process task: backlog comments.
_drush_ip_backlog_nodes_process_batch_task in ./ip.drush.inc
Batch process task: backlog nodes.

File

./ip.module, line 150
IP address manager module.

Code

function ip_posts_insert($type, $id, $ip_address = NULL) {
  $ip_address = is_null($ip_address) ? ip_address() : $ip_address;
  $iplong = ip2long($ip_address);
  if (!empty($iplong)) {
    return db_insert('ip_posts')
      ->fields(array(
      'type' => $type,
      'id' => $id,
      'ip' => $iplong,
    ))
      ->execute();
  }
}