You are here

function multiple_email_user_update in Multiple E-mail Addresses 7

Same name and namespace in other branches
  1. 2.x multiple_email.module \multiple_email_user_update()

Implements hook_user_update().

File

./multiple_email.module, line 270
multiple_email module file

Code

function multiple_email_user_update(&$edit, $account, $category) {
  if (!empty($edit['mail'])) {
    $object = multiple_email_find_address($edit['mail']);

    // add this to multiple email
    if (empty($object)) {

      // If an administer is making a change or user doesn't have
      // multiple emails permission, mark as confirmed.
      $confirmed = user_access('administer multiple emails') || !user_access('use multiple emails', $account);

      // confirm if action done by administer
      $eid = multiple_email_register_email($account->uid, $edit['mail'], $confirmed);
      if (empty($confirmed) && !empty($eid)) {
        multiple_email_send_confirmation($account, multiple_email_load($eid));
      }
    }
  }
}