How to display og group visibility in a view, even if user can't change it I'm working on a content pane view that displays a list of the groups the current user is a member of. Most properties of the groups are displayed in the view just fine, like the group title. But the group visibility is only shown to specific users.

I'd like to have a note in the group list whether a group is public or private, something along the lines of


  Group #1 | You're a member since... | This group is public
  
  Group #2 | You're a member since... | This group is private
  
  (and so forth)


But when I add the field "Content: Group visibility" to the view, the value only is visible for users that have permission to change the respective group's visibility (permission "Administer Organic groups permissions"). For any other user, the "No results behaviour" kicks in. The settings for the field "Group visibility" is public ("author and administrators can edit, everyone can view"), so shouldn't the field's content be visible to everyone?
I've found a solution - probably not the most elegant solution and quite "hacky", but it's working so far.

Even though some users are not allowed to see the group's visibility, the information is still provided to the view, but with a marker '#access' set to false. It's possible to alter the data displayed by the view by using the hook hook_views_pre_render. An implementation, for example in a custom module, could look like this

function MY_CUSTOM_MODULE_views_pre_render(&amp;$view) {
  // $view is a reference to the view object

  // alter only the data of the view we want to change,
  // not every view on the website
  if($view-&gt;name == "MY_VIEW_NAME" &amp;&amp; $view-&gt;current_display == "MY_CURRENT_DISPLAY") {
    // iterate over the list of entities, in this case over the list of groups
    foreach($view-&gt;result as $index =&gt; &amp;$result) {
      // again, have $result as a reference
      // so changes are applied to the "original data", not just to a copy

      // change '#access' field deep in the field data structure
      $result-&gt;field_group_access[0]['rendered']['#access'] = true;
    }
  }
}