Example: Moderating content with a simple field, views, and rules

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
emilyf's picture

It's often the case that a CMC would want to track progress of new shows and other content posted on their site by producers or other users. For instance, if a user submits a new show they are hoping your station will help produce, you may want to have that show added to a "review" queue where staff can review the show and then choose to approve or decline it. In addition, you may want those changes to be tracked as revisions in your system.

There are quite a few modules out there that provide different and robust solutions for content moderation, a couple examples being Workbench and Workflow. However, in some cases these modules might be overkill depending on your needs. This was the case with RETN, who started out by using Workbench. Workbench by default provides a lot of options for revisions of content, and specifically it utilizes a drafting system in addition to publishing/unpublishing content. RETN found this was causing too much confusion for what they wanted to do, and so we ultimately decided to just build something simple using fields, views, and rules. Included in this post is both an example screencast of what their system does, as well as attachments of the Features that you can install to use the same system on your site.

Here's the screencast: https://www.youtube.com/watch?v=mxRnUQ-CsVY

Next, a summary of RETN's needs:

1 - Be able to track and get reports on the status of shows, series, and other content types as they are submitted. RETN wanted to be able to track these pieces of content using the following:

  • Needs Review: this would be for a new show or other types of content submitted by users. This is the default state of content. In addition to this, whenever new content is submitted an email is automatically fired off using Rules to the appropriate staff member that directs them to the Content Moderation area (this email rule is not included in the downloadable features, but if you need help setting something like this up just comment below).
  • Approved: after a staff member has reviewed the show or other piece of content, they can set it to approved. Or, in the case of users with a "producer" role, we can create another rule where their content can automatically be set to approved.
  • Declined: a staff member can also set a show to be declined if it the proposed show does not meet RETN requirements.

2 - In addition to these statuses, they use publish/unpublish when desired. For example, a producer who submits a show can automatically have that show be published, but a user who has never before submitted a show will have it stay unpublished until a staff member has both approved it and set it to published. Another reason to separate these is a user may submit production details to RETN on a show that RETN approves, but they wait to publish the show until the finished video has been attached to the show.

3 - Make the moderation process only visible to staff members so that regular users are not confused.

How to install and set this up:
As always, it is recommended you test this out on a development site or else ensure you have a working backup before attempting to install it on a production server. You may have a conflicting configuration so it's always recommended to test first.

The attached two Features will give you RETN's content moderation functionality. This assumes you have the Features and Entity modules installed on your site. In addition, you will need Views, Rules, and Views Bulk Operations.

From the modules page, first turn on the feature called "RETN Moderation Fields". This will give you a new field (added by default to cm_show content type, but you can add it to any content type you want) called "Moderation". Add this field to any additional content types that you want to moderate.

Note that this field is set to use custom permissions, this is to achieve #3 above without too much overhead. To set the permissions go to People > Permissions and do a search for "moderation". There will be 4 applicable permissions you will need to set by role. At RETN, the "staff" role can create, edit, and view any value for that field; no other roles get anything set, which effectively hides the field for them when they are submitting content. If you wanted users to be able to see what moderation state their content is in, you would give them the "view own" permission.

After this is done, you will want to put some content into different states so you have some examples to work with. Then install the feature called "RETN Moderation." This will add a new view and some applicable rules to your system. The new view is called "Content Moderation". You will see it provides a page at yoursite.com/admin/content-moderation. It then has 3 different tabs where you can see content that is in each of the moderation states. In addition, you can issue a variety of bulk operations on these pieces of content, such as publishing/unpublishing content and setting the moderation status between any of the states (needs review, approved, rejected).

If you want Drupal to provide revisions any time this field is changed, you will want to edit the settings for the applicable content type and change the default under publishing options to be "create new revision."

You can set these views to only be accessible to certain roles in the View settings, and you can clone the displays to create an unlimited number of pages/blocks relating to the new workflow states.

In addition, because this solution is field-based, you can use it in conjunction with Rules very easily to do things like fire off automatic emails based on moderation states. You would just add the condition of "data comparison" - you can read more about Rules and data at https://drupal.org/node/1796884. Or, you can set up rules for certain roles to automatically bypass "needs review" and have content set to "approved" and "published" - RETN allows users with the "producer" role to do this. If you're not sure how to set something like that up, post a comment and I'll delve into it further.

Have fun and happy moderating!

AttachmentSize
moderation.tar_.gz4.4 KB

Comments

Less Cumbersome than Workbench Moderation

jdcreativity's picture

I will try to find some time to take a peek at this. We use Workbench Moderation to change the "State" of Shows as they move from Production - > Files backed up - > Post Production - > Airing - > Archived

There are 2 reasons why it isn't the best solution:

1) Too much power. Quite often - we don't need but a fraction of what Workbench Moderation does. In fact, if I change the STATE on the wrong tab the node moves from published to unpublished which causes a headache

2) There is no email notifications. I probably could bend Moderation to do this, but haven't been able to find it yet.

In using Workbench Moderation I have updated the View on the SHOW landing page. I'll try to add that screenshot if possible.

1 is the same issue RETN

emilyf's picture

1 is the same issue RETN ultimately had with workbench. The published to unpublished as well as making additional drafts was too confusing for RETN staff and producers. Even though we had rules overriding some of these headaches, it was all just too cumbersome and that's what drove them to just use views/rules/fields.

For your second issue, you can use Rules to send emails with workbench based on moderation state.

The question is, being

dfrazier's picture

The question is, being realistic about your content needs, is there anything Workbench is currently offering you that you can't already achieve using basic Drupal functionality? We found the answer to be no.

We kept running into issues with Workbench and rather than continue to develop rules, views, roles, permissions, etc, to make Workbench meet our needs it just made sense to eliminate it. RETN's needs are modest compared to the scope of Workbench.

It is also nice to be able to manage content moderation without the overhead of a module.

@dfrazier are you configuring

kreynen's picture

@dfrazier are you configuring Rules yourself? You seem to be implying that Rules is basic and not a module.

I am not implying that. My

dfrazier's picture

I am not implying that. My technical language is admittedly subject to inaccuracies as I am not a developer. If my comment was misleading, here is an attempt to clarify it.

I was trying to give a brief impression of the rationale behind RETN's decision to remove workbench in favor of handling content moderation through some simpler drupal configuration. Although rules may not be basic, I find adding a few fields to a content type to be a more basic approach to content moderation than Workbench.

My understanding of drupal is sufficient for me to have realized that Workbench was not the right fit for RETN content needs. But, like I said, our needs are modest. And, yes, I do understand that Rules is a module. I was referring to the overhead of Workbench specifically, although I see now that that sentence could've been interpreted differently.