You are here

function tft_get_forbidden_terms in Taxonomy File Tree 7

Same name and namespace in other branches
  1. 7.2 tft.module \tft_get_forbidden_terms()

Get an array with all the terms to which the user has no access.

Parameters

int $tid = 0: The root term tid. 0 by default (looks through the entire tree)

array() &$forbidden: The forbidden elements array

stdClass $account = NULL: An optional account to test access. By default, the current user is used.

File

./tft.module, line 1378
Module hooks.

Code

function tft_get_forbidden_terms($tid = 0, &$forbidden, $account = NULL) {

  // Start by all root terms, and build up from there
  $result = db_query("SELECT tid FROM {taxonomy_term_hierarchy} WHERE parent = :tid AND vid = :vid", array(
    ':tid' => $tid,
    ':vid' => variable_get('tft_vocabulary_vid', 0),
  ));
  while ($tid = $result
    ->fetchObject()) {
    if (!tft_term_access($tid, $account)) {
      $forbidden[] = $tid;
    }
    else {
      tft_get_forbidden_terms($tid, $forbidden, $account);
    }
  }
}