In this thread http://drupal.org/node/171249 a new option is discussed:
ANT will create the title but will not change the title once it is created.
This is usefull if the title has to be generated only once.

Comments

Title:Add extra option to preserve title once createdHere is a patch for D7
Status:Active» Needs review
StatusFileSize
new4.41 KB

Here is a patch for D7.
It includes:
1. The new option "Preserve the title once it is created". This will have no effect on your other ANT nodes already in use.
2. Due to the extra option I changed the IF ELSE ELSIF to a SWITCH loop to prevent clutter
3 Added some description to the edit field on the node entry form so the user can see what is going on regarding the node title.

In the attached images on this node http://drupal.org/node/171249#comment-4033072 you can you see how it looks like.

That's great Clivesj!!!, thanx. ...but there might be cases where specific nodes might need a title change/correction. How about adding a way to override the auto-generated, to-be-preserved title. I was thinking something like:

1. A "Override to-be-preserved auto-generated node titles" permission that can be assigned only to specific roles/users.

2. A "Allow to-be-preserved titles to be overridden" checkbox in the "Automatic title generation options" fieldset that will be available/enabled only when the "Always auto-generate title but preserve first one" is selected. This will give users with the proper permissions the chance to be able to override auto-generated titles when/if required.

3. A "Override auto-generated title" button/checkbox in the node edit form that would make the title field selectable/editable again. If user enters custom text, that will be used. If they do click this "Override title" button and do not edit previous title, then a new title will be generated (à la old behavior).

What do you think?

PS: the title of this issue is to generic/vague for one to find. Also I do not understand why you started a new issue and did not post this over in #171249: Generate title only on insertion, not on update.

Title:Here is a patch for D7Generate title only on insertion, not on update (D7)

Ah, I forgot to fill in the title that´s why it came-up with "here is a patch for D7"
I didn't post the patch in the other thread since that is a D6 issue.
I will post the D6 patch there.

Do you (regulated by permission) want to be able to override all "ANT generated titles" whether they are preserved or not?
In this case we can add a button on the node entry form to enable this.
Maybe you want to exclude ANT title overriding for a certain node-type?

In any case I suggest to add the preserve option as per patch and start a new request for the override option. Let´s also hear Fago´s opinion on this.

I didn't post the patch in the other thread since that is a D6 issue...

Hmm... no it's not. You can switch it back to a 6.x issue (+ denote that in that issue's title with a "(D6)" similarly to what you did here), but I am afraid it's up to Wolfgang (a.k.a. fago, the module's maintainer) to decide how issues that require fixing in 7.x then backport to 6.x are handled. Usually developers like to keep their issue queue as clean (and short) as possible, so they do this in the same issue (usually 7.x first - 6.x after). That's why I asked in the first place, I don't actually mind either way.

... Maybe you want to exclude ANT title overriding for a certain node-type?

...yes, exactly. That's why I suggested (suggestion 3 in post #2 above) that there should be a checkbox to allow this in each content type's settings page. Perhaps I should have made it more clear that I meant that this should be a per-node setting.

btw... Thank you for your hard work and time spent in this one. I really appreciate it!

The D7 patch seemed to be working at first, and then it stopped working and was acting like the "Enabled" mode.

I modified the code in two places and it works now:
Line 80-81 of the D7 patch ($node-> title == 'ant' changed to $node->title == 'ant')

-  return empty($node->auto_nodetitle_applied) && ($setting = auto_nodetitle_get_setting($node->type)) && !($setting == AUTO_NODETITLE_OPTIONAL && !empty($node->title));
+  return empty($node->auto_nodetitle_applied) && ($setting = auto_nodetitle_get_setting($node->type)) && !($setting == AUTO_NODETITLE_OPTIONAL && !empty($node->title)) && !($setting == AUTO_NODETITLE_ENABLED_PRESERVE && !($node-> title == 'ant'));
changed to
-  return empty($node->auto_nodetitle_applied) && ($setting = auto_nodetitle_get_setting($node->type)) && !($setting == AUTO_NODETITLE_OPTIONAL && !empty($node->title));
+  return empty($node->auto_nodetitle_applied) && ($setting = auto_nodetitle_get_setting($node->type)) && !($setting == AUTO_NODETITLE_OPTIONAL && !empty($node->title)) && !($setting == AUTO_NODETITLE_ENABLED_PRESERVE && !($node->title == 'ant'));

And I removed this from the patch because it was re-creating the title every time (Line 71-72):

-  if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title']))) {
+  if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title'])) || ($setting == AUTO_NODETITLE_ENABLED_PRESERVE)) {
It works great now!

Is this code going to be merged into the -dev branch?

Thanks for posting the diffs! If it works, I'll post it as a patch.

Thanks for your patch, but it breaks logic for other node titles. I attached a patch that works for me.

Great module and nice patch - just what was needed!

#8 worked for me but only after implementing the last changes mentioned in #5 "And I removed this from the patch because it was re-creating the title every time (Line 71-72):"

The first change mentioned in # 5 is in the #8 patch.

Thanks to all!

Neil

#8 worked for me but only after implementing the last changes mentioned in #5... The first change mentioned in # 5 is in the #8 patch.

The patch in #8 contains that change too (lines 56-59).

Hey Klonos - in response to #10 - Actually those lines (56-59 in #8) (71-72 in #5) , put in what number 5 says to leave out. So I removed them.

I did the #8 patch first in full but still had it being recreated each time. I saw the # 5 note, and removed the 56-59 insertion, leaving the original and it works!

At least for me.

Thanks for your help.

Neil

ok, thanx.

When I remove line 56-59 I get a malformed function. Can anyone verify the exact code that needs to be moved. Line 56-59 in my patch looks like this:

56 - if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title']))) {
57 + if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title'])) ||
58 + $setting == AUTO_NODETITLE_ENABLED_PRESERVE) {
59 auto_nodetitle_set_title($node);

I'm willing to make a definate patch based on latest dev. But I think fago has to indicate wheter he is willing to incorporate the change. I 'm also willing to co-maintain the module. But i think it will becomd mess if we all propose changes witthout being able to merge ghem into ghe project and have them tested by the community.
I think this change enhances the modules functionality.

Edit: typo's, still have to get used to typing on a smartphone :)

Would be nice to have. My 2c.

This feature is still not implemented in dev, can somebody please post a final patch?

@juves. I don't think the module maintainer wants to further develop this module. I think the intention is to switch over to:
https://drupal.org/project/auto_entitylabel