You are here

function _uc_addresses_get_default_address_id in Ubercart Addresses 6

Same name and namespace in other branches
  1. 5.2 uc_addresses.module \_uc_addresses_get_default_address_id()
  2. 5 uc_addresses.module \_uc_addresses_get_default_address_id()

Get a user's default address id. Because the addresses module can be added to an existing system, it's possible that some people will not have a default address (or any addresses).

Parameters

$uid The id of the user who "owns" the address.:

Return value

The $id of the default address or NULL if none.

3 calls to _uc_addresses_get_default_address_id()
uc_addresses_list_addresses in ./uc_addresses.module
Generate a list of one or all addresses defined by one user and then theme the list for display.
uc_addresses_token_values in ./uc_addresses.module
Implementation of hook_token_values().
_uc_addresses_db_get_address in ./uc_addresses.module
Get an address or list of addresses from the database.

File

./uc_addresses.module, line 1620

Code

function _uc_addresses_get_default_address_id($uid) {
  $def = db_query("SELECT aid FROM {uc_addresses_defaults} WHERE uid = %d", $uid);
  $aid = NULL;
  while ($obj = db_fetch_object($def)) {
    $aid = $obj->aid;
  }
  return $aid;
}