0

I have this code working:

function custom_form_alter(&$form, &$form_state,$form_id) {
switch ($form_id) {
case 'user_register_form':
      $form['#submit'][] = 'custom_user_register_submit';
  break;
}
}

function custom_user_register_submit($form, &$form_state) {
$form_state['redirect'] = 'content/welcome';
}

This is working great no problems.

The node I'm redirecting to has a typical welcome message. Part of the message has: Your verification has been sent to (user's email address).

How do I get the registration email address for the welcome message?

I've created a custom template for the content/welcome node. Just not sure what to do from here.

1 Answer 1

1

In your submit handler, you could use drupal_set_message to set the message like this:

function custom_user_register_submit($form, &$form_state) {
  $form_state['redirect'] = 'content/welcome';
  drupal_set_message('Your mail is @mail', array('@mail' => $form_state['user']->mail));
}

You could also save it in the $_SESSION if you don't want to use drupal_set_message and get it from there.

1
  • Thanks! That got me on the right direction. I ended up adding the variable to the session: code function custom_user_register_submit($form, &$form_state) { $_SESSION['var1'] = $form_state['values']['mail']; $var1 = $form_state['values']['mail']; //this works dpm($var1); $form_state['redirect'] = 'content/welcome'; }
    – Max
    Apr 12, 2016 at 15:58

Your Answer

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

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