You are here

function _auto_expire_update_date in Auto Expire 7

Helper function creates date-stamp for expiration.

Parameters

node info $node:

current time $nowtime:

offset in days $days:

2 calls to _auto_expire_update_date()
auto_expire_node_insert in ./auto_expire.module
Implements hook_node_insert().
auto_expire_node_update in ./auto_expire.module
Implements hook_node_update().

File

./auto_expire.module, line 502

Code

function _auto_expire_update_date($node, $nowtime, $days) {

  // Insert updates because nid is primary key.
  $id = db_merge('auto_expire')
    ->key(array(
    'nid' => $node->nid,
  ))
    ->fields(array(
    'nid' => $node->nid,
    'expire' => $nowtime + $days * 24 * 60 * 60,
  ))
    ->execute();
  drupal_set_message(t('This %type will autoexpire in %days days.', array(
    '%type' => node_type_get_name($node),
    '%days' => $days,
  )));
}