You are here

function multiple_email_load_addresses in Multiple E-mail Addresses 5

Same name and namespace in other branches
  1. 6 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

1 call to multiple_email_load_addresses()
multiple_email_addresses_form in ./multiple_email_addresses_page.inc
Builds form which will output a table of email addresses with management links

File

./multiple_email.module, line 330
multiple_email module file

Code

function multiple_email_load_addresses($uid, $tablesortHeaders = null) {
  $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(a.email = 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;
}