You are here

function node_recur_node_recur_form_access in Node recur 7

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

Access handler for the node recur form

1 call to node_recur_node_recur_form_access()
node_recur_form_alter in ./node_recur.module
Implements hook_form_alter().
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 161

Code

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

  // See if recurring is enabled for this node
  if (node_recur_recurring_enabled($node->type)) {

    // Check permissions
    if (user_access('recur all nodes') || user_access('recur own nodes') && $node->uid == $user->uid) {

      // Make sure node is published, or admin
      if ($node->status || user_access('administer nodes')) {

        // Make sure we have a valid date field
        if (node_recur_get_date_field_name($node->type)) {

          // Granted
          $access = TRUE;
        }
      }
    }

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