You are here

function _auto_nodetitle_save_title in Automatic Nodetitles 7

Helper function to save node title.

1 string reference to '_auto_nodetitle_save_title'
auto_nodetitle_node_submit in ./auto_nodetitle.module
Implements hook_node_submit().

File

./auto_nodetitle.module, line 98
Allows hiding of the node title field and automatic title creation.

Code

function _auto_nodetitle_save_title() {
  $nodes = node_get_recent(1);
  foreach ($nodes as $node) {
    auto_nodetitle_set_title($node);
    db_update('node')
      ->fields(array(
      'title' => $node->title,
      'changed' => REQUEST_TIME,
    ))
      ->condition('nid', $node->nid)
      ->execute();
    db_update('node_revision')
      ->fields(array(
      'title' => $node->title,
      'timestamp' => REQUEST_TIME,
    ))
      ->condition('nid', $node->nid)
      ->execute();
  }
}