I'm attempting to create a simple php evaluation of the tac_lite grants (terms the user is allowed to view) that I can use for non-node material that is not regulated by tac_lite. The code below doesn't work however I got the idea from viewing the tac_lite module and was hopeful that it might help someone understand what I am trying to accomplish. Using Drupal 4.7
Faulty code:
global $user;
if ($grants->tid == 4)
{return TRUE;}
Below I pasted the functions from tac_lite for reference.
I'd appreciate any guidance that would help resolve my shortfall here.
// $Id: tac_lite.module,v 1.5 2006/05/03 17:15:19 yogadex Exp $
/**
* Return the term ids of terms this user is allowed to access
*
* Users are granted access to terms either because of who they are,
* or because of the roles they have.
*/
function _tac_lite_user_tids(&$account) {
$grants = array();
if (count($account->tac_lite)) {
// $account->tac_lite is array. Keys are vids, values are array of tids within that vocabulary, to which the user has access
foreach ($account->tac_lite as $tids) {
if (count($tids))
$grants = array_merge($grants, $tids);
}
}
// add per-role grants in addition to per-user grants
$defaults = variable_get('tac_lite_default_grants', array());
foreach ($account->roles as $rid => $role_name) {