Display users who flagged content In my Drupal 7 project I have users of role A and B respectively. Users of role A can create content and users of role B can flag it.

I'm building a view that displays on A users' account page their content and names of B users who flaggd it.

I have created a view Content (not User) and added relationship Flags: Content flag and consequently field Flags: User uid to display together with content related fields.

In view block I use Grid format. Same content information is displayed several times per each user who flagged it, like  bellow

Content title QWERTY
Users uid  who flagged 1

Content title QWERTY
Users uid who flagged 2

Content title QWERTY
Users uid  who flagged 3

How can I display content information only once and users who flagged in one field separated by comma?
you need to edit /drupal/sites/all/themes/MYTHEMENAME/template.php
then add the following code.
function MYTHEMENAME_preprocess_views_view_fields($vars){
      if ($vars['view']-&gt;name == &quot;VIEWNAME&quot; &amp;&amp; $vars['view']-&gt;current_display == &quot;DISPLAY&quot; &amp;&amp; $vars['id'] != 1){
        $vars['fields']['title']-&gt;content = '';
      }
    }

What this code is saying is if your row is not equal to (!=) 1, then don't display anything. Thus, it will print your title only for row 1.

replace MYTHEMENAME with your actual theme name.

replace VIEWNAME with your view's name. example: flagged_content

replace DISPLAY with your view's machine name. You can find this by editing your view, then under Advanced -&gt; other
examples: block, block_1, page, page_1 or default. It's default if you're using your master view.


For user's separated by comma you would have to use css for that.
JS FIDDLE EXAMPLE
PS: I think you would have to change it from grid to html list for your view.