Without having to user_load(SOME_UID_THAT_HAS_MY_INTENED_ROLES); and swap the current $user object and then replace it.

Is it possible to say,


But tell it to respect the permissions of a certain array of roles like,

views_embed_view('view_of_articles', array(SOME_RID));

I know the above wont work since the function isn't defined in such a way, but could this be possible with theme() functions, or something else I'm missing?

1 Answer 1


In view check the option of "Access" and select roles. Now even if you call the view with views_embed_view() It wont display if the user is not part of the role that have access.

  • Nope that's not what I'm trying to accomplish. For example, when your an admin and you've got contextual links turned on and you look at a view, you see the extra markup and the hovering states. Or imagine a field that is permissioned for certain roles, but you print the view as an admin while you want the view to look like it was for a certain role. Dec 13, 2012 at 6:51
  • Have you check this module : drupal.org/project/roleswitcher It might help.
    – j2r
    Dec 13, 2012 at 7:01
  • Yea I'm also aware of those types of modules, but I don't want to see the whole experience as the other role, just the view in question. Dec 13, 2012 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.