You are here

function multiple_email_primary_page in Multiple E-mail Addresses 5

Renders page to confirm making an address primary

Parameters

integer $eid:

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

File

./multiple_email_primary_page.inc, line 13
Functions for making an email address the primary address for a user

Code

function multiple_email_primary_page($eid) {
  global $user;
  if ($email = multiple_email_get_address($eid)) {
    if ($user->uid == $email->uid) {
      if ($email->primary_address) {
        drupal_set_message("'{$email->email}' is already your primary address!");
      }
      else {
        return drupal_get_form('multiple_email_primary_form', $email);
      }
    }
    else {
      watchdog('Multiple Email', 'Attempted unauthorized access to email ' . $eid . ' by user ' . $user->uid);
    }
  }
  else {
    watchdog('Multiple Email', 'Failed to load address ' . $eid, WATCHDOG_WARNING);
  }
  drupal_goto('my-email-addresses');
}