You are here

function commerce_registration_registration_page_access in Commerce Registration 7

Page access callback to view all registrations for a given product display. @todo Registration function to check if a given entity is register enabled.

1 string reference to 'commerce_registration_registration_page_access'
commerce_registration_menu in ./commerce_registration.module
Implements hook_menu().

File

./commerce_registration.module, line 38
Commerce Registration module code.

Code

function commerce_registration_registration_page_access($node) {
  if (isset($node->field_commerce_product)) {
    foreach ($node->field_commerce_product[LANGUAGE_NONE] as $product) {
      $prod = commerce_product_load($product['product_id']);
      $info = array(
        'id' => $product['product_id'],
        'type' => 'commerce_product',
        'bundle' => $prod->type,
      );
      $status = registration_entity_registration_status($info);
      $bundle = registration_entity_registration_bundle($info);
      if ($status == 1 && $bundle != '' && (user_access('view any registration') || user_access('view ' . $bundle . ' registration'))) {
        return TRUE;
      }
    }
  }
  return FALSE;
}