7

I have an administrative display (made with views) that lists content that is pending approval.

In the case of my site, approval means flagging with the approval_for_pub flag (which triggers a custom rule).

VBO allows nodes to be flagged/unflagged all at once by clicking a handy button:

flag/unflag button

However, upon clicking this button, by default it shows all possible flags and the flag/unflag option:

lists of flags

This is a problem on my site because some of the people responsible for approval get confused by the names of the flags and select the wrong option. So, what I would like to do is create a VBO option that, when the button is pressed, automatically flags all applicable content with the approval_for_pub flag.

How can I approach this?

It seems like a small detail, but this step happens several times a day, so the chance of making a mistake is quite high.

9
+50

Instead of using the "Flag (or unflag) a node" action directly, create new a rules component and show it in your administrative view.

  1. Navigate to Configuration » Workflow » Rules » Components
  2. Click on Add new component , choose Rule from the components plugin drop-down menu.
  3. Choose a name (e.g. Approve), add a parameter with the type node.
  4. Add a condition, choose Node is flagged from the drop-down menu.
  5. Choose the appropriate flag, select the node-parameter for the node, choose site:current-user for the user on whose behalf the flagging-action will be performed, select negate such that the condition will evaluate to true when the node is not flagged.
  6. Add an action, choose Flag a node from the drop-down menu.
  7. Choose the appropriate flag, select the node-parameter for the node, choose site:current-user for the user on whose behalf the flagging-action will be performed.

Edit your administrative view, configure bulk operations such that the Approve operation is shown instead of the Flag (or unflag) a node

  • Great solution! I have used Rules for VBO before but it didn't occur to me that I could apply it in this case as well. – Patrick Kenny Oct 27 '13 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.