You are here

function multiple_email_register_email in Multiple E-mail Addresses 5

Same name and namespace in other branches
  1. 6 multiple_email.module \multiple_email_register_email()
  2. 7 multiple_email.module \multiple_email_register_email()
  3. 2.x multiple_email.module \multiple_email_register_email()

Adds an unconfirmed email address to the email registry.

If you specify the 3rd parameter to be true, the email address will be recorded as having been confirmed.

Returns the email's eid on success, false on failure.

Parameters

integer $uid:

string $email:

boolean $confirmed:

Return value

mixed

2 calls to multiple_email_register_email()
multiple_email_add_form_submit in ./multiple_email_add_page.inc
Processes form submission of multiple_email_add_form
multiple_email_user in ./multiple_email.module
Implementation of hook_user()

File

./multiple_email.module, line 419
multiple_email module file

Code

function multiple_email_register_email($uid, $email, $confirmed = false) {
  $success = db_query("\n    INSERT INTO {multiple_email}\n      (`uid`,`email`,`time_registered`,`confirmed`,`confirm_code`,`time_code_generated`)\n    VALUES\n      (%d, '%s', %d, %d, '%s', %d)", $uid, $email, time(), (int) $confirmed, $code = multiple_email_code(10), time());
  if ($success !== false) {
    $result = db_query("SELECT LAST_INSERT_ID() AS eid");
    $r = db_fetch_array($result);
    $email = multiple_email_get_address($r['eid']);
    module_invoke_all('multiple_email_register', $email);
    return $r['eid'];
  }
  else {
    return false;
  }
}