You are here

function action_node_touch_created in Voting API 5

Touches the creation date of a node. Useful for moderated nodes that should appear 'fresh' as soon as they're promoted.

File

./votingapi_actions.inc, line 327

Code

function action_node_touch_created($op, $edit = array(), &$node) {
  switch ($op) {
    case 'do':
      $node->created = time();
      if (!$edit['defer']) {
        node_save($node);
      }
      watchdog('action', t('Touched creation date of node id %id', array(
        '%id' => intval($node->nid),
      )));
      break;
    case 'metadata':
      return array(
        'description' => t('Touch node creation date'),
        'type' => t('Node'),
        'batchable' => true,
        'configurable' => false,
      );

    // return an HTML config form for the action
    case 'form':
      return '';

    // validate the HTML form
    case 'validate':
      return TRUE;

    // process the HTML form to store configuration
    case 'submit':
      return '';
  }
}