function commerce_node_checkout_expire_relist_access in Commerce Node Checkout 7
Access callback to check associated node is able to be relisted.
Parameters
object $node: The node object
object $account: Optionally supply the user account to check access for. If omitted, the current user will be used.
Return value
TRUE if the user has access to relist the given node, otherwise FALSE.
1 call to commerce_node_checkout_expire_relist_access()
- commerce_node_checkout_expire_field_node_relist_form::render in commerce_node_checkout_expire/
includes/ views/ handlers/ commerce_node_checkout_expire_field_node_relist_form.inc - Implements parent::render().
1 string reference to 'commerce_node_checkout_expire_relist_access'
- commerce_node_checkout_expire_menu in commerce_node_checkout_expire/
commerce_node_checkout_expire.module - Implements hook_menu().
File
- commerce_node_checkout_expire/
commerce_node_checkout_expire.module, line 352 - Provides core hooks and the like for the module.
Code
function commerce_node_checkout_expire_relist_access($node, $account = NULL) {
if (!$account) {
global $user;
$account = clone $user;
}
// Make sure we have products enabled for this node
if (commerce_node_checkout_get_node_type_enabled_products($node->type)) {
// Make sure there is an existing line item for this node
if (commerce_node_checkout_expire_get_node_last_line_item($node)) {
// See if the user owns this node
if ($account->uid == $node->uid) {
return TRUE;
}
}
}
return FALSE;
}