In this video, you will learn how to create a View of all content that has been flagged as offensive. This will make it easy for content administrators to manage offensive content.

  • Go to "Structure => Views => Add new view" (admin/structure/views)
    • View Name: Offensive Content
    • Show: Choose "Content" of type "All"
    • Sorted by: "Newest first"
    • Select "Create a page"
      • Page title: Offensive Content
      • Path: offensive-content
      • Display format: Table (This time, we’ll select table, because we’ll also show how many times each item has been flagged as offensive.)
      • Items to display: (leave empty to display all)
      • Uncheck “Use a pager”
      • Select "Create a menu link"
        • Menu: Main menu
        • Link text: Offensive Content
  • (Continue & edit)
  • Advanced
    • Click "Advanced"
    • Relationships: Click "Add"
      • "Flags: Node flag"
      • "Flags: Node flag counter" (This will give us access to the flag counter field later)
    • (Apply (all displays))
    • Configure Relationship: Flags
      • Select "Include only flagged content"
      • Flag: Select "Flag as offensive"
      • By: Any user
      • (Apply (all displays))
    • Configure Relationship: Flags: counter
      • Flag: Select "Flag as offensive"
      • (Apply (all displays))
  • Click “Settings” next to “Query settings”
    • Select “Distinct” (This will eliminate duplicate results in our view. Without selecting “Distinct” a single piece of content will be listed for each time it has been flagged. ie: if an article is flagged by five people, it will be listed five times.)
    • (Apply (all displays))
  • No results behavior
    • No results behavior: Click "Add"
    • Select "Global: Text area"
  • (Apply (all displays))
    • Label (Textarea): No offensive content! Yay!
  • (Apply (all displays))
  • Fields
    • Fields: Click "Add"
      • Flags: Flag counter (This will show us the number of times a piece of content has been flagged as offensive.)
      • Content: Edit link (This will make it easier for us to edit the offensive content.)
      • Published
      • (Apply (all displays))
      • Configure field: Content: Edit link
        • Label: Edit this content
        • Text to display: Edit
        • (Apply (all displays))
      • Configure field: Published
        • Label: Status
        • Output format: Published/Not published
        • (Apply (all displays))
      • Configure field: Flags: Flag counter
        • Prefix: “Flagged “ (note the space after flagged)
        • Suffix: “ times” (note the space before times)
        • (Apply (all displays))
  • Sort Criteria
    • Flags: Flag counter
      • (Apply (all displays))
      • Select “Sort descending” to display the most flagged content first.
      • (Apply (all displays))
    • Remove the sort criteria “Published Date”
  • Page Settings
    • Click "View published content" link
      • Permissions: Choose "Administer content" (This will make the view only visible to users who have permission to administer content. ie: Users with the ability to unpublish, edit or delete the offensive content.)
    • (Apply (all displays))
  • (Save)

Now, let’s go home and we’ll see the "Offensive Content" tab in our menu. Click the link and it will display, "No offensive content! Yay!", since we haven't flagged any content yet.

I’ll flag one of the articles as offensive.

Click the "Flag as offensive" link, and go to the "Offensive Content" tab. We now see the article in the table and that it has been flagged as offensive.

I’ll log in as another user and flag a couple of articles. When I do this we see the number go up when an article is flagged more than once, and the item flagged the most times is listed first.

Now that we have a view to see the content that has been flagged as offensive, we can edit the content. However, if we edit one of the articles and remove the offensive content, it is still listed in the “Offensive Content” view. It would be too cumbersome to ask each member to unflag it, or do that manually, so let’s create a Rule that automatically removes all flags when the content is edited by a content moderator.