You are here

function faq_ask_access in FAQ_Ask 6.2

Same name and namespace in other branches
  1. 6 faq_ask.module \faq_ask_access()

Implementation of hook_access().

File

./faq_ask.module, line 53
This module is an add-on to the FAQ module that allows users with the 'ask question' permission to create a question which will be queued for an 'expert' to answer.

Code

function faq_ask_access($op, $node, $account) {

  // If node is already published, it's not ours any more.
  if ($node->status == 1) {
    return NULL;
  }
  if ($op == 'create') {
    return user_access('ask question') || user_access('answer question');
  }
  else {

    //    return user_access('answer question') || user_access('edit_own_faq');
    // We don't include "edit own" because the intent is they can edit their own until it's published.
    return user_access('answer question') || $account->uid == $node->uid;
  }
}