View only works for root user I have a really strange issue occurring within a view I've created. I have the same code base on two servers, one is a stage server one is on a Vagrant instance on my local machine. 

The view displays messages for a user (the UID is retrieved from the currently logged in user via a contextual filter). If I pass the UID of a user I know has messages into the contextual filter preview box in the Views admin panel while logged in as root then the view returns a record. If I try the same with another user it does not even though I am specifying the same UID, and the other user has the "administration" role checked in their profile so they should have the same permissions.

Does anybody have any ideas as to what may be causing this? I have a feeling it's something to do with configuration as like I said, the code base is mirrored yet works on one site but not the other.
Views hardcodes RIDs in when you export or featurize a view. That means that if the role has a different RID on one site than on the other, you'll have issues with Views giving permissions to the wrong users.

One way I've gotten around this is to hack the exported view, and where it would say something like 

$handler-&gt;display-&gt;display_options['access']['role'] = array(
  4 =&gt; 4,
);


I have 

$rid = ($role = user_role_load_by_name('administrator'));
$handler-&gt;display-&gt;display_options['access']['role'] = array(
  $rid =&gt; $rid,
);