You are here

function answers_field_access in Answers 7.3

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

Implements hook_field_access().

File

./answers.module, line 331

Code

function answers_field_access($op, $field, $entity_type, $entity, $account) {

  // Only offer notification field to registered users and only when answers is
  // configured to allow notifications.
  if ($field['field_name'] == 'field_notify_p' && $op == 'edit') {
    return !empty($account->uid) && variable_get('answers_new_answer_notice_allow_p', TRUE);
  }
  elseif ($field['field_name'] == 'field_question_locked_p') {
    return FALSE;
  }
  elseif ($field['field_name'] == 'field_answer_question' && $entity_type == 'node' && $op == 'view') {
    $node = menu_get_object('node');
    if ($node && $node->type != 'answer') {
      return FALSE;
    }
  }
}