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)
Comments
Comment #1
poloparis commenteda 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' ?
Comment #2
poloparis commentedVersion: 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?
Comment #3
Hazlitt commentedI 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.
Comment #4
poloparis commentedI 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.
Comment #5
Hazlitt commentedYes 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.
Comment #6
francoud commentedI 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?
Comment #7
Denys Babenko commentedA (temporary) straightforward solution would be to check $node->title=="ant"
here is an example of such snippet
Let me know if it has any bugs because use it :)
Comment #8
benkallos commented#4 is the way to go.
This problem is not repaired as of Version 6.x-1.2.
The best bet remains version 6.x-1.0 which still works perfectly.
The patch offered for Drupal 6 at http://drupal.org/node/171249#comment-1363276 had a Hunk Failure
% patch -b < ant_preserve_option.patch
patching file auto_nodetitle.module
Hunk #2 FAILED at 28.
Hunk #3 succeeded at 88 with fuzz 1 (offset 10 lines).
Hunk #4 succeeded at 167 (offset -2 lines).
1 out of 4 hunks FAILED -- saving rejects to file auto_nodetitle.module.rej
Comment #9
Todd Young commented6.x-1.0 did *not* work for me, using tokens nor php snippets.
Comment #10
u4yk commentedI was having a problem with this, too; however, it turned out that it was a conflict with the Workflow Fields module. After uninstalling both modules (along with the Workflow module), running "delete from system where name = 'auto_nodetitle';" and reinstalling all modules, this problem was then fixed. FYI.
Comment #11
loominade commentedsubscribe
Comment #12
aaronbaumanThis (naïve) patch seems to work for me:
edit: fixed original patch suggestion
Comment #13
jvieille commentedsub
Comment #14
Jorenm commentedYour patch doesn't do anything for me. No matter what I put in the pattern field I get out "ant".
Comment #15
brpubs commentedsub
Comment #16
clivesj commentedAs mentioned in the comments that patch was no good, it ios replaced by http://drupal.org/node/171249#comment-4033072
But be carefull there are some patches agains dev and some against last stable!
I would suggest using the latest dev.
Comment #17
shaneonabike commentedYeah I also experienced this and I'm using workflow as well.
Now what's interesting is that in the end I am getting the final title correct but when I try to process it during a Trigger action it's messed up showing 'ant'
My configuration is just simply using the titles from two different node references (tokens) as the title.
[reference_1] & [reference_2]
Comment #18
gaurav.kapoor commented