Hi!

I've had a good trawl through the forums and can't see and answer so here I go!

I have a mass of published documents, all of which are of the same content type but tagged with the a taxonomy vocabulary called "Premium", with the terms "Agenda", "Bulletin" and "Manager". Articles can be tagged against more than one term, i.e. "Agenda" and "Bulletin".

I also have three roles defined called "Agenda", "Bulletin" and "Manager". Genius! A user can be a member of more than one role.

Using Contemplate, I would like to display the body field only where there's a match between the user's role and the taxonomy.

So, in pseudo code:

IF Role = Agenda AND Taxonomy = Agenda THEN print body.

I have the following code so far:

<?php

global $user;
if (in_array('agenda', $user->roles)) {
  print $body;
}
else {
  header('Location: /arn/node/6');
}

?>

Many thanks.

Comments

jrglasgow’s picture

I would suggest using Taxonomy Access Control. I have used it in the past in similar situations. You can define which roles can see which categories of nodes.