diff --git a/auto_nodetitle.module b/auto_nodetitle.module index c35a271..a5cdc50 100644 --- a/auto_nodetitle.module +++ b/auto_nodetitle.module @@ -132,7 +132,11 @@ function auto_nodetitle_operations_update($nodes) { */ function _auto_nodetitle_patternprocessor($output, $node) { if (module_exists('token')) { - $output = token_replace($output, 'node', $node); + // If bulk processing many new nodes, they all have nid=0. + // This means we have to flush the token cache or _token_get_id() will + // think all nodes get the same values. Which is unlikely to be what we want. + $flush = empty($node->nid) ? TRUE : FALSE; + $output = token_replace($output, 'node', $node, TOKEN_PREFIX, TOKEN_SUFFIX, array(), $flush); } if (variable_get('ant_php_'. $node->type, 0)) { $output = auto_nodetitle_eval($output, $node);