You are here

function multiple_email_load_addresses in Multiple E-mail Addresses 6

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

Returns an array of information about the specified user's associated email addresses.

Index 0 contains an associative array of all the addresses in eid=>addresses format. Subsequent indexes are the eid of the address, then an object of properties corresponding to columns in the table.

Parameters

integer $uid:

array $tablesortHeaders:

Return value

array

4 calls to multiple_email_load_addresses()
MultipleEmailBasicUserTestCase::testMultipleEmailBasicUser in ./multiple_email.test
Test that the Multiple E-mails user can add a new e-mail address.
MultipleEmailUserTestCase::testMultipleEmailUser in ./multiple_email.test
Test that the Multiple E-mails user can add a new e-mail address.
multiple_email_handler_filter_current::query in views/multiple_email_handler_filter_current.inc
multiple_email_manage in ./multiple_email_manage.inc
FormAPI callback for managing an accounts e-mail addresses.

File

./multiple_email.module, line 390
multiple_email module file

Code

function multiple_email_load_addresses($uid, $tablesortHeaders = NULL) {
  $addresses = array();
  $results = db_query("\n    SELECT\n      a.eid,\n      a.uid,\n      a.email,\n      a.time_registered,\n      a.confirmed,\n      a.confirm_code,\n      a.time_code_generated,\n      a.attempts,\n      IF(LOWER(a.email) = LOWER(u.mail), 1, 0) AS primary_address\n    FROM\n      {multiple_email} a\n    INNER JOIN {users} u ON (u.uid = a.uid)\n    WHERE\n      a.uid = %d" . ($tablesortHeaders ? ' ' . tablesort_sql($tablesortHeaders) : ''), $uid);
  while ($row = db_fetch_object($results)) {
    $addresses[0][] = $row->email;
    $addresses[$row->eid] = $row;
  }
  return $addresses;
}