'ant' bug strikes again : title gets set correctly then reverts to 'ant'
| Project: | Automatic Nodetitles |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
I spent the entire day trying to understand why my install of auto_nodetitle would return the famous 'ant' no matter what I do when set to 'Automatically generate the title and hide the title field'
I used several snippets, specially the one described here : http://drupal.org/node/283830 (which works great normally and on on my local install)
and the one included int the readme : ?php return "Author: $node->name"; ?
What's more bugging is that I put some debug markers 'print_r($node->title);' in the following module functions :
- auto_nodetitle_set_title : print_r($node->title) shows it sets the title correctly when the if (trim($pattern)) condition is accepted
- auto_nodetitle_nodeapi : print_r($node) also shows the title is set correctly
Then, for some reason, the title gets changed back to 'ant'
if anyone has any idea why the title would get set back to 'ant' after being set correctly, I would greatly appreciate the help.
Thanks
(note : I did a local install, and it works perfectly, I tried to make both dev and online versions as similar as possible)

#1
a few more specific that could help debug :
in function 'auto_nodetitle_set_title' I get a correct title after the call to '_auto_nodetitle_patternprocessor'
a print_r of $node in the hook_nodeapi function 'auto_nodetitle_nodeapi' gives me also a correct title. It returns this :
stdClass Object ( [nid] => [vid] => [uid] => 1 [created] => 1238160953 [type] => story [language] => [changed] => 1238160953 [title] => this is a test body content for the ant bug... [teaser_js] => [teaser_include] => 1 [body] => this is a test body content for the ant bug i'm getting and that should be enough. [format] => 1 [revision] => 0 [log] => [name] => secret [date] => [status] => 1 [promote] => 1 [sticky] => 0 [op] => Save [submit] => Save [preview] => Preview [form_build_id] => form-2f0d73da0cd334b5e39329cf2f6764bf [form_token] => 36b74d66ef29e1c577408952e31af63d [form_id] => story_node_form [comment] => 2 [menu] => Array ( [mlid] => 0 [module] => menu [hidden] => 0 [has_children] => 0 [customized] => 0 [options] => Array ( ) [expanded] => 0 [parent_depth_limit] => 8 [link_title] => [parent] => primary-links:0 [weight] => 0 [plid] => 0 [menu_name] => primary-links ) [path] => [pathauto_perform_alias] => 1 [nodesubscribe] => 0 [teaser] => this is a test body content for the ant bug i'm getting and that should be enough. [validated] => 1 [auto_nodetitle_applied] => 1 )
So again, the title is set correctly. Why does it revert back to 'ant' ?
#2
Version: 6.x-1.0 works perfectly with php snippets
am I the only one who gets this bug of the title reverting back to 'ant' after being changed correctly with Version 6.x-1.1?
#3
I am having exactly the same problem. No matter what I set the 'Pattern for the title' to when I enable 'Automatically generate the title and hide the title field' the title of the node always gets set to 'ant'.
I have researched this problem and tried a number of different settings to try and solve it but I have not found any answers.
I also would be grateful of help if anyone knows how to solve this.
#4
I had to revert to version 6.x-1.0 which works perfectly
6.x-1.1 works locally but bugs online
if anyone has any idea, that would be great, even just out of curiosity.
#5
Yes that works for me to. I downloaded the 6.x.1.0 version and it is working fine and correctly replacing tokens.
Now I have come up against a new problem! Tokens for CCK Computed fields are not being replaced. Other tokens are working fine.
#6
I had the same problem: working on test site, not working on production site. Difference is that on the (working) test site we run php 5; on the production site, we run php4. Some compatibility problem?
#7
A (temporary) straightforward solution would be to check $node->title=="ant"
here is an example of such snippet
<?phpif((empty($node->title)) or ($node->title=="ant")){
$random1 = rand(100000000, 999999999);
$random2 = rand(100000000, 999999999);
$total = round(($random1 + $random2) / 2);
echo $total;
} else {
echo $node->title;
}
?>
Let me know if it has any bugs because use it :)