Project:Automatic Nodetitles
Version:6.x-1.2
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I'm having the same bug as described here http://drupal.org/node/413678.

With the PHP stated below, the title (both when previewed and saved) only returns "ant". Here's my php code:

<?php

 
if (empty($node->nid)) {
   
// When the profile gets first created,
    // use the username of the currently logged-in user
   
global $user;
    return
$user->name;
  } else {
   
// When the profile gets edited,
    // either by the user itself or
    // an admin, use the existing title.
   
return $node->title;
  }

?>

Doing a clean uninstall of version 1.2 and installing 1.0 fixes the problem.

Comments

#1

Title:'ant' bug happening in 1.2» Allow reading old title value
Category:bug report» task

Due to the way ant works, it sets "ant" as title before it autogenerates it later on. Thus it your snippet will read out "ant". What you want is to allow reading the old title value. Perhaps this would help you?

Index: auto_nodetitle.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/auto_nodetitle/Attic/auto_nodetitle.module,v
retrieving revision 1.20.2.6
diff -u -r1.20.2.6 auto_nodetitle.module
--- auto_nodetitle.module 12 Jan 2010 12:39:32 -0000 1.20.2.6
+++ auto_nodetitle.module 12 Jan 2010 13:29:40 -0000
@@ -28,8 +28,8 @@
   else if (isset($form['#node']) && isset($form['#method']) && $form['#node']->type .'_node_form' == $form_id) {
     //this is a node form
     if (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_ENABLED) {
-      // we will autogenerate the title later, just hide the title field in the meanwhile
-      $form['title']['#value'] = 'ant';
+      // We will autogenerate the title later, just hide the title field in the meanwhile
+      $form['title']['#value'] = isset($form['title']['#default_value']) ? $form['title']['#default_value'] : 'ant';
       $form['title']['#type'] = 'value';
       $form['title']['#required'] = FALSE;
       $form['#submit'][] = 'auto_nodetitle_node_form_submit';

Please report whether it worked.