Module setting title in hook_nodeapi(op=validate) so if we wanna use NID as pattern we cant...
Solution is add hook_nodeapi(op=insert) same as validate but direct update node tables

  if ($op == 'insert') {
    if ((auto_nodetitle_get_setting($node->type) == AUTO_NODETITLE_ENABLED) || ((auto_nodetitle_get_setting($node->type) == AUTO_NODETITLE_OPTIONAL) && empty($node->title))) {
      /*
       * Sets the node title.
       * We need to do this on validation because of two points: 
       *     It's early engouh to have node previews working and 
       *     it's late enough as CCK has already gone through the 'process form values' step 
       * 
       * As changes to $node are not persistent during validation, we use form_set_value()!
       */
      auto_nodetitle_set_title($node);
      db_query("UPDATE {node} SET title = '%s' WHERE vid = %d", $node->title, $node->vid);
      db_query("UPDATE {node_revisions} SET title = '%s' WHERE vid = %d", $node->title, $node->vid);
    }
  }

Comments

fago’s picture

Status: Active » Closed (works as designed)

it's no solution, as it won't work for the preview.

andypost’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

It's solution for insert but for preview suppose to assume that nid is 0 and use

  if ($op == 'preview') {
    if ((auto_nodetitle_get_setting($node->type) == AUTO_NODETITLE_ENABLED) || ((auto_nodetitle_get_setting($node->type) == AUTO_NODETITLE_OPTIONAL) && empty($node->title))) {
      //assume node nid is 0 if there's not
      if (empty($node->nid)) $node->nid = 0;

      auto_nodetitle_set_title($node);
    }
  }
  if ($op == 'insert') {
    if ((auto_nodetitle_get_setting($node->type) == AUTO_NODETITLE_ENABLED) || ((auto_nodetitle_get_setting($node->type) == AUTO_NODETITLE_OPTIONAL) && empty($node->title))) {
      /*
       * Sets the node title.
       * We need to do this on validation because of two points:
       *     It's early engouh to have node previews working and
       *     it's late enough as CCK has already gone through the 'process form values' step
       *
       * As changes to $node are not persistent during validation, we use form_set_value()!
       */
      auto_nodetitle_set_title($node);
      db_query("UPDATE {node} SET title = '%s' WHERE vid = %d", $node->title, $node->vid);
      db_query("UPDATE {node_revisions} SET title = '%s' WHERE vid = %d", $node->title, $node->vid);
    }
  }
fago’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

But it'll set another value as it was previewed - this will just confuse users. So I won't add something like that.

If users *really* need to set the title with fields like the nid, I'd suggest using worklfow-ng. E.g. look at this: http://drupal.org/node/198398