You are here

function commerce_order_customer_order_view_access in Commerce Core 7

Menu item access callback: prevent view access to the customer order display for orders in a 'cart' status and then perform a normal order access check.

Parameters

$order: The order object as loaded via the menu item wildcard.

Return value

Boolean indicating the user's access to view the page.

1 string reference to 'commerce_order_customer_order_view_access'
commerce_order_ui_menu in modules/order/commerce_order_ui.module
Implements hook_menu().

File

modules/order/commerce_order_ui.module, line 134

Code

function commerce_order_customer_order_view_access($order) {

  // If the order is in a shopping cart order status...
  if (array_key_exists($order->status, commerce_order_statuses(array(
    'cart' => TRUE,
  )))) {

    // Do not allow the customer to see the page.
    return FALSE;
  }

  // Otherwise fallback on normal order access.
  return commerce_order_access('view', $order);
}