function hook_uc_roles_grant in Ubercart 6.2
Allows modules to react to the addition of an expiring role.
Parameters
$account: The Drupal user object.
$rid: The Drupal role ID.
$timestamp: The UNIX timestamp of the role expiration.
1 invocation of hook_uc_roles_grant()
- uc_roles_grant in uc_roles/
uc_roles.module - Grants a role to a given user.
File
- docs/
hooks.php, line 1909 - These are the hooks that are invoked by the Ubercart core.
Code
function hook_uc_roles_grant($account, $rid, $timestamp) {
// Example: update the expiration date CCK field on a content profile node
// when an expiring role is granted
$node = content_profile_load('profile', $account->uid, '', true);
if ($node) {
$node->field_expiration_date['0']['value'] = date('c', $timestamp);
node_save($node);
}
}