You are here

function node_recur_node_recur_form_access in Node recur 7.2

Same name and namespace in other branches
  1. 7 node_recur.module \node_recur_node_recur_form_access()

Access handler for the node recur form

1 string reference to 'node_recur_node_recur_form_access'
node_recur_menu in ./node_recur.module
Implements hook_menu().

File

./node_recur.module, line 88

Code

function node_recur_node_recur_form_access($node) {
  global $user;
  $access = FALSE;

  // See if recurring is enabled for this node and we have a valid date field
  if (node_recur_recurring_enabled($node->type) && node_recur_get_date_field_name($node->type)) {

    // Check permissions
    $recur_access = user_access('recur all nodes') || user_access('recur own nodes') && $node->uid == $user->uid;
    if ($recur_access && node_access('create', $node->type)) {

      // Granted
      $access = TRUE;
    }

    // Allow modules to alter this
    drupal_alter('node_recur_access', $access, $node);
  }
  return $access;
}