Pasāda is an ancient Pāli word that means "clearness; brightness; joy; faith; the faculty of senses."
पसाद
Here's the situation: you've got a Drupal-based website with multiple target audiences. You've also got a dashboard with content targeted at the authenticated user. Not all of your target audiences authenticate so you need a way to display relevant news items to both authenticated and non-authenticated users. Here's a little recipe to do exactly that.
First you create a news content type. Then you create a taxonomy vocabulary with items for each target audience (e.g. students, staff, faculty, patients, alumni, etc.) and assign it to the news content type. It's easy to create a page display in Views to show a list of news item teasers filtered on target audience. But what if you want to create a dashboard page that shows news items targeted only to the authenticated user? What if there are news items that should be visible only to certain roles and not others?
[Note: Role names and taxonomy terms must match exactly for this method to work.]
The following will allow you to set up TAC Lite permissions that will allow taxonomy based access to news items. With this configuration, items tagged for a specific target audience will always be visible to the coinciding role. News items tagged as visible to Everyone will be available to the anonymous and authenticated user roles. Content contributors will be able to view, edit and delete all content regardless of target audience.
Now let's create a view to display news items targeted to the authenticated user:
global $user;
$terms = "";
foreach($user->roles as $role){
$tid = db_result(db_query("SELECT tid FROM term_data WHERE name = '%s'", $role));
if ($terms == "")
$terms .= $tid;
else
$terms .= "+" . $tid;
}
if ($terms !== "") {
return $terms;
}This little code snippet will match taxonomy terms to roles and return a string of term ID's in the form "1+2+3". The string is then validated and passed as a Term ID arguement. Thus you get a list of news items targeted specifically at the authenticated user based on their role(s).