You are here

function signup_email_confirm_submit in Signup 6.2

Same name and namespace in other branches
  1. 6 modules/signup_confirm_email/signup_confirm_email.inc \signup_email_confirm_submit()
  2. 7 modules/signup_confirm_email/signup_confirm_email.inc \signup_email_confirm_submit()

Submit callback for the signup form.

This checks if the e-mail address is being changed. If not, it completes the normal signup form workflow. However, if the e-mail address is changed from the one stored in the profile, the user is redirected to a confirmation form to verify they want to update the e-mail address in their profile before the signup is completed.

1 string reference to 'signup_email_confirm_submit'
signup_confirm_email_alter_signup_form in modules/signup_confirm_email/signup_confirm_email.inc
Alter the signup form to add the e-mail confirmation functionality.

File

modules/signup_confirm_email/signup_confirm_email.inc, line 105
Code to confirm the e-mail during signups. Since this code is only needed when building or submitting the signup form (or editing an existing signup), it all lives in this include file and is only loaded when needed.

Code

function signup_email_confirm_submit($form, &$form_state) {
  global $user;
  if (!empty($form_state['values']['email_confirm']) && !empty($form_state['values']['email_address'])) {
    if ($form_state['values']['email_address'] != $user->mail) {

      // Update the user's e-mail address in their profile.
      $user->mail = $form_state['values']['email_address'];
      user_save($user, array(
        'mail' => $user->mail,
      ));
      drupal_set_message(t('Updated the e-mail address in your profile to %new_address.', array(
        '%new_address' => $user->mail,
      )));
    }
  }
}