Such an action would allow automatic node title in some edge cases where auto node title not works:

e.g. http://drupal.org/node/197867

Furthermore more customized wishes could be also done with this action, like this one:
e.g. http://drupal.org/node/171249

So if anyone cares about that, I'd happily receive a patch which adds this action to auto nodetitle.

Comments

amcc’s picture

I would like to know more about how to do this, i'm submitting a 'first name' and 'last name' via CCK fields using the bio module. These appear on the registration page, and i want the title of the node set to [field_first_name] [field_last_name] - it needs to do this on creation (which it currently doesn't), it works fine when updating.

I've no experience with adding actions to modules, but have some experience in making modules - so any pointers would be welcome.

fago’s picture

Title: provide worklfow-ng action to set the node title » document worklfow-ng action to set the node title

I think this isn't necessary any more due to the improvements of workflow-ng: https://more.zites.net/workflow-ng/ghop_php_action

so the action is done easily by writing the php code

<?php
$node->title = 'new_tite [token_example]';
return array('node' => $node);
?>

However, I think there should be an example which shows how this can be used to set the node title on creation and how this can interact with ANT.

bomarmonk’s picture

Will Workflow-ng and token allow taxonomy terms to be added to node titles on creation? If so, how does this happen? Can I simply use the above code, with the correct token designation, and then voila? I'm not sure.... I currently have the 5.x.2.x dev version of workflow-ng installed.

bomarmonk’s picture

It looks like Workflow-ng works rather well (to answer my question above). After testing, though, I am still unable to get my code to work exactly right (mostly due, I'm sure, to my lack of PHP knowledge). My code for the custom PHP title generation upon node creation:

$node->title = '[node:term]'.' '.'('.'[node:field_additional_text-formatted]'.')'.' '.'for'.' '.'[node:field_date_of_meeting-value]';
return array('node' => $node);

My two troubles that I would be very grateful if someone helps me with: the "[node:field_additional_text-formatted]" is optional, so I want its inclusion to be governed by an "if this exists, then print the parenthesis." Second, if I include the "date_of_meeting-view," which is what I really want for the formatting, the PHP prints out the literal HTML characters, rather than sending the HTML to the browser as HTML.

Can someone help me alter my above code so that these two issues are fixed? And if this works, is there any need to keep automatic node titles? I guess it hides the title field, so maybe...

Thanks again!

gaurav.kapoor’s picture

Issue summary: View changes
Status: Active » Closed (outdated)