I have written a custom module which defines some tokens. These tokens are used e.g. in Wysiwyg editor this way: [mytype:closing_date] (I have token_filter module)

Is it posible to make these tokens available also in the Webform module, and specifically in the confirmation e-mail that is sent after filling the form?

I tried %mytype[closing_date] but didn't work.

1 Answer 1


use also the token module, you'll find instructions in its documentation.

basically, you'll need to implement these two hooks:

function my_user_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'user') {
    $user = $object;
    $tokens['name']      = $user->name;
    $tokens['mail']      = $user->mail;
    return $tokens;


function my_user_token_list($type = 'all') {
  if ($type == 'user' || $type == 'all') {
    $tokens['user']['name']      = t("The user's name");
    $tokens['user']['mail']      = t("The user's email address");
    return $tokens;
  • I have already implemented these hooks in my custom module which defines tokens (the hooks are named differently in D7 than in D6). But how to use them in the Webform e-mail confirmation?
    – camcam
    Mar 28, 2012 at 20:26
  • hmm -- maybe here you'll find something .. drupal.org/node/627726
    – rémy
    Mar 29, 2012 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.