You are here

function multiple_email_load_addresses in Multiple E-mail Addresses 2.x

Same name and namespace in other branches
  1. 5 multiple_email.module \multiple_email_load_addresses()
  2. 6 multiple_email.module \multiple_email_load_addresses()
  3. 7 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()
BasicUserTest::testMultipleEmailBasicUser in src/Tests/BasicUserTest.php
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.
UserTest::testMultipleEmailUser in src/Tests/UserTest.php
Test that the Multiple E-mails user can add a new e-mail address.

File

./multiple_email.module, line 390
multiple_email module file

Code

function multiple_email_load_addresses($uid, $tablesortHeaders = NULL) {
  $addresses = array();
  $query = db_select('multiple_email', 'a')
    ->fields('a')
    ->condition('a.uid', $uid);
  $query
    ->addJoin('INNER', 'users', 'u', 'u.uid = a.uid');
  $query
    ->addExpression('IF(LOWER(a.email) = LOWER(u.mail), 1, 0)', 'primary_address');
  $result = $query
    ->execute();
  while ($row = $result
    ->fetchObject()) {
    $addresses[0][$row->eid] = $row->email;
    $addresses[$row->eid] = $row;
  }
  return $addresses;
}