You are here

function answers_field_access in Answers 6.2

Same name and namespace in other branches
  1. 7.3 answers.module \answers_field_access()

Implements hook_field_access().

File

./answers.module, line 170

Code

function answers_field_access($op, $field, $account, $node = NULL) {
  if ($field['field_name'] == 'field_notify_p' && $op == 'edit') {
    return !empty($account->uid) && variable_get('answers_new_answer_notice_allow_p', TRUE);
  }

  // Lock field used programatically.
  if ($field['field_name'] == 'field_question_locked_p') {
    return FALSE;
  }

  // Hide links to the answer node in places such as the question_answers view,
  // which uses the full build mode to display answers.
  if ($field['field_name'] == 'field_answer_question' && $op == 'view') {
    $node = menu_get_object('node');
    if ($node->type != 'answer') {
      return FALSE;
    }
  }
}