You are here

function faq_access in Frequently Asked Questions 5.2

Same name and namespace in other branches
  1. 5 faq.module \faq_access()
  2. 6 faq.module \faq_access()

Implementation of hook_access().

File

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

Code

function faq_access($op, $node) {
  global $user;
  if ($op != 'create') {
    $node = (object) $node;
  }
  if ($op == 'create') {
    if (user_access('create faq')) {
      return TRUE;
    }
  }
  elseif ($op == 'update' || $op == 'delete') {
    if (user_access('edit faq')) {
      return TRUE;
    }
    elseif (user_access('edit own faq') && $user->uid == $node->uid) {
      return TRUE;
    }
  }
}