You are here

function hook_uc_addresses_may_delete in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 uc_addresses.api.php \hook_uc_addresses_may_delete()

This hook allows you to prevent a certain address from being deleted.

Don't use this hook if you want to prevent deleting addresses for users with a certain role. You can use the permission settings for that. Default addresses are always protected from being deleted.

If you want the address not to be deleted return FALSE. Return TRUE in all other cases. WARNING: If you don't return TRUE, then no address may be deleted.

Note that this hook is only invoked when permissions are checked and not when an address is deleted programmatically.

Parameters

object $address_user: The owner of the address.

UcAddressesAddress $address: (optional) Address object.

object $account: The account to check access for.

Return value

boolean FALSE if the account may not delete the address or any address from the address user if no address is passed. TRUE otherwise.

1 invocation of hook_uc_addresses_may_delete()
UcAddressesPermissions::canDeleteAddress in class/UcAddressesPermissions.class.php
Check if the user can delete addresses of this user. Default addresses can never be deleted.

File

./uc_addresses.api.php, line 390
These hooks are invoked by the Ubercart Addresses module. @todo more documentation needed for hook_uc_addresses_field_handlers(). @todo Document the rest of the API.

Code

function hook_uc_addresses_may_delete($address_user, $address, $account) {

  // No specific restrictions for deleting addresses.
  return TRUE;
}