You are here

function new_faq_node_access in Frequently Asked Questions 7.2

Implements hook_node_access().

Deprecated

7.x-2.x

File

./faq.module, line 52
The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.

Code

function new_faq_node_access($node, $op, $account = NULL) {
  global $user;
  if (empty($account)) {
    $account = $user;
  }

  // Ignore non-FAQ node.
  if ((is_object($node) ? $node->type : $node) !== 'faq') {
    return NODE_ACCESS_IGNORE;
  }
  if ($op != 'create') {
    $node = (object) $node;
  }
  if ($op == 'view') {
    return NODE_ACCESS_IGNORE;
  }
  elseif ($op == 'create' || $op == 'update' || $op == 'delete') {
    if (user_access('administer faq')) {
      return NODE_ACCESS_ALLOW;
    }
  }
  return NODE_ACCESS_IGNORE;
}