Skip to main content
2 of 3
added 110 characters in body
Smern
  • 25
  • 11

After some digging... I found that I am able to get field information like...

$variables["#object"]->field_roles_allowed["und"]; //array containing id's of roles allowed
$variables["#object"]->field_download["und"]; //array containing information about the file

and that I can get the current user's roles like...

global $user;
$user->roles; //array containing current user's roles

Then I can compare the field roles allowed with the current user's roles and determine what to output from there.

Still not very happy with this, I would prefer something where I don't have to right PHP logic in a field.

Smern
  • 25
  • 11