You are here

function _uc_addresses_get_default_address_id in Ubercart Addresses 5.2

Same name and namespace in other branches
  1. 5 uc_addresses.module \_uc_addresses_get_default_address_id()
  2. 6 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

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

Return value

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

2 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_db_get_address in ./uc_addresses.module
Get an address or list of addresses from the database.

File

./uc_addresses.module, line 1577

Code

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