Need help in "how to give token value on form submission"..?

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by tarun_nagpal on December 23, 2014 at 2:18pm

Hello There,
I am facing a simple but strange issue.

I have a node form and i want a token that have the node URL that is being submitted/created. I want to send a thank you message to the user along with the node link.

I have created a custom token using hook_token_info (https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...) and given the value using hook_tokens (https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func... ). But, i am unable to change/assign the value of the token at node_form_submit.

The last option is to use the str_replace (http://php.net/manual/en/function.str-replace.php) function of PHP. But i do not want to do it in a dirty manner.

Any Idea how to achieve this.?

Thanks and Regards
Tarun Nagpal

Comments

Use rules module

Posted by rakesh.gectcr on December 23, 2014 at 2:29pm

Use rules module

Rakesh James

Use hook_node_insert/update

Posted by sarath.rajan on December 24, 2014 at 2:12am

Use hook_node_insert/update function to send the email to the author. node url is simply - node/*, replace * with node id.

Thanks I will try this

Posted by tarun_nagpal on December 24, 2014 at 5:35am

Thanks I will try this.

India

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /