How to handle " Pre unpublish validations" ....?

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

I want to add a workflow for unpublished content using Rules.
scenario is like this:

1.The normal user can request to unpublish content.

2.A mail wiil go to admin & editor that "xyz content is pending for unpublish"

3.Admin will review it & whtever action will take.

Now here in point 1, I want to create an event " request for unpublish content"

I referred this post but my idea is not clear for this case
http://drupal.org/node/298549

in short i need action "pre unpublish" like we have presave.

any suggestion ....guys...??

Comments

Node save

Itangalo's picture

You don't really need a new event – all you need is some kind of data to keep track of the state of the content. Something like this:

  • A boolean checkbox field "request for unpublishing".
  • A rule acting on node save, checking if the field has been set (and was previously unchecked). If so, an e-mail is sent to relevant user(s).
  • A Bulk Operations View that administrators can use, for unpublishing content requested for unpublishing.

If you want, you can also have the unpublish field reset when the content is actually unpublished (but it might be a good idea to keep that information).

This solution requires that users can edit the content, to request the unpublishing. If this is not the case, then it is probably easiest to use the Flag module instead of the field. (The you will also have the event "content has been flagged with 'request for unpublishing'", which should be useful.)

Good luck!
//Johan Falk
**
Check out NodeOne's Drupal Learning Library! 150+ screencasts and exercises, for Drupal introduction, advanced configuration, and coding.

Hey ... Thanks Johan

chintan4u's picture

-I used a checkbox for "request for unpublish"

  • Attached a rule for checking status of that checkbox

-sending mail if "request for unpublish" checkbox is check.

Here my admin/editor are now receiving 2 mails.
-one mail for "request for unpublishing"
-another mail for resource updation (I have another rule on updation of content)

now I m looking for workaround so admin will receive only 1 mail for "request for unpublish" not for update.

Additional condition checks

Itangalo's picture

I think the best way to do this is to add another condition to the resource update notification, using the same conditions as for "request for unpublishing" – but negated. Thus, you send out the update notification if the content was not requested for unpublishing.

If you're using Rules 2 (Drupal 7), then you can package all the conditions into a condition component, making it easy to re-use the same configuration in several places.

Good luck,
//Johan Falk
**
Check out NodeOne's Drupal Learning Library! 180+ screencasts and exercises, for Drupal introduction, advanced configuration, and coding. Creative Commons license!

Fix the other rule

bartl's picture

Make its conditions stricter. You don't have to check "request for unpublish" in it; instead, I would rather check if anything else has changed. If not, ignore it.

So the admin can still get 2 mails for one update, if :

  1. "request for unpublish" was checked
  2. Something else changed too

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week