I have a rather basic question but I can not wrap my mind around how to solve it "nice".
I have a node type that contains calendar info, I use views to get the month-view rendered nice and all is good so far.
Next thing was to make the calendar view also contain nodes of type "group_xyz" but only display these events when a user is logged in I managed to do that with filtering using a couple of lines PHP to get user id and node type, but already here it didnt feel like a real drupalish solution...

To my problem, we would like to limit the display of calendar posts depending on the user role and a taxonomy term used in the node.

So the node has a taxonomy term reference "visibility_to" lets say one of (All, Internal, Administrators) set.
The user can be either guest, logged in user or administrator.

Now I would like to find a nice way to filter like this: Display the item IF node-type is calendar AND ( (visibility_to == "All") OR ( (visibility_to == "Internal") AND (role=="administrator" OR role == "logged_in") OR (visisbility_to == "Administrators" AND role =="administrator"))

I think you get the point... I think I could manage to hard code this in PHP but the day when we add new roles, new taxonomy terms I would rather have all this configured using the admin interface...

Any help and/or suggestions is appreciated.

brgds // DW

Comments

hokuspokus’s picture

You want to look into the Views module http://drupal.org/project/views. It allows for a enormous amount of content filtering and display options. It is a little overwhelming at first, but there numerous tutorials (both video and text) out there for getting a handle on the basics.

mounte’s picture

I am already using the views module. As I wrote I have managed to get some of the functionality but it doesnt feel too good to rely on php-code in the filters such as:

global $user;
$node = node_load($data->nid);
if( $node->type == 'group_xyz' && $user->uid == 0) {
  return True;
} else {
  return False;
}

I want a more solid/alternative solution.

And also a way to filter on user-role <--> taxonomy item on calendar_node

hokuspokus’s picture

Apologies, I just skimmed the question. Not an expert in the area you need (obviously) but advanced filtering may require the more messy php tweaking you are trying right now. Hopefully someone else here has more experience and can help more.