You are here

function termstatus_term_access in Taxonomy Term Status 7

Return true if the given account has access to the specified term.

1 call to termstatus_term_access()
TermstatusAccessTestCase::testAPIFunctionForUnpublishedTerms in ./termstatus.test
Test that api function for unpublished terms.

File

./termstatus.module, line 229
Hook implementations and API for the taxonomy term status module.

Code

function termstatus_term_access($term, $account = NULL) {
  if (variable_get('termstatus_enable', FALSE) && !user_access('administer taxonomy', $account) && !user_access('view unpublished taxonomy terms', $account)) {
    $result = db_query('SELECT status FROM {termstatus} where tid = :tid', array(
      ':tid' => $term->tid,
    ));
    return $result
      ->fetchField();
  }
  else {
    return user_access('access content', $account);
  }
}