You are here

function multiple_email_confirm_page in Multiple E-mail Addresses 5

Same name and namespace in other branches
  1. 6 multiple_email_confirm_page.inc \multiple_email_confirm_page()
  2. 7 multiple_email_confirm_page.inc \multiple_email_confirm_page()
  3. 2.x multiple_email_confirm_page.inc \multiple_email_confirm_page()

Renders the page to confirm an email address

If code is passed in on URL, then it will populate that value in the text field.

Parameters

integer $eid:

string $code:

Return value

string

1 string reference to 'multiple_email_confirm_page'
multiple_email_menu in ./multiple_email.module
Implementation of hook_menu()

File

./multiple_email_confirm_page.inc, line 18
Functions for displaying and processing the confirmation page

Code

function multiple_email_confirm_page($eid, $code = null) {
  global $user;
  $out = '';
  if ($email = multiple_email_get_address($eid)) {
    if ($email->uid != $user->uid) {
      drupal_set_message(t('Email address not found'));
      watchdog('Multiple Email', 'Unauthorized attempt to access email ' . $eid . ' by ' . $user->name . ' (' . $user->uid . ')');
      drupal_goto('my-email-addresses');
    }
    elseif ($email->confirmed) {
      drupal_set_message(t("'%email' is already confirmed!", array(
        '%email' => $email->email,
      )));
      drupal_goto('my-email-addresses');
    }
    else {
      $out .= drupal_get_form('multiple_email_confirm_form', $email, $code);
    }
  }
  else {
    drupal_set_message(t('Email address not found'));
    watchdog('Multiple Email', 'Error loading email ' . $eid, WATCHDOG_WARNING);
    drupal_goto('my-email-addresses');
  }
  return $out;
}