With the D7 version of the Rules module, is there any way to create a rule which asks the triggering user whether to proceed or not?

Specifically, I'm trying to set up an "After updating existing content" rule but I would like it to ask the user "Do you wish to <action>? Yes/No" then continue executing if they choose "Yes" or halt and return to the node view if they click "No".

I was hoping it could be done within the rules UI somehow but if I have to code a custom module, so be it.

I've looked through all the modules in the "Rules" category on drupal.org and I've looked at all the available rule conditions in the rules UI but I haven't found anything useful so far.

  • i believe that's the point where you really should consider writing your own module instead of uding rules.
    – Mołot
    Jul 17, 2015 at 11:21

3 Answers 3


You might want to check, and experiment with, the Rules Link module. Here is an excerpt from its project page:

... lets you create links which trigger arbitrary functionality with the help of Rules.

There are three types of links (usages):

  • Javascript - Links that will trigger the rules using Ajax.
  • Token - This are basic links, that will reload the page after calling them.
  • Confirmation link - Show a confirmation form before executing the rule

The module's Readme.txt contains some more documentation about how to use it.

Example Configuration

  1. Define a rules_link with a "Link type" of "Confirmation" and make sure to define a "Path" for it, e.g. http://example.com/confirmation-page.
  2. Edit the rules_link you created and go to "Configure rules" then create a "Reaction" rule containing all the actions you want to take if the user clicks "Confirm" on the confirmation page.
  3. Create a normal rule for the particular event you want to trigger the confirmation page on (in this case we're using an "After updating existing content" event).
  4. Add whatever conditions you might require then add a single "Page redirect" action where the "URL" is defined as the path to the rules_link confirmation page plus a node ID token and a destination parameter, e.g. confirmation-page/[node:nid]?destination=node/[node:nid].

With this configuration, when the user updates a node with nid 12345 they are redirected to "http://example.com/confirmation-page/12345?destination=node/12345". If they click "Confirm" the rest of the required actions are executed before returning to the updated node. If they click "Cancel" they return directly to the updated node without any further actions executing.

  • This seems to be a good solution. What I had to do was set my "After updating existing content" rule to simply redirect to the path defined in a rules_link, then move the rest of my rule's actions to the corresponding rules_link rule. It was also important to add a ?destination=node/[node:nid] parameter to the redirect path, otherwise clicking "Cancel" on the rules_link confirmation page sent the user to the home page instead of back to the node they edited.
    – morbiD
    Jul 20, 2015 at 8:57
  • Hm, thanks for sharing this extra info (and accept of course)! Next question? Jul 20, 2015 at 9:01

Under action Check Execute custom PHP code under PHP. May be it will be useful or do it using custom js

  • Not entirely sure how a custom PHP condition or action would allow me to build a confirmation page with confirm/cancel options, display it in-between saving a node and viewing it, detect the user's choice and then continue or halt the rule accordingly. Also, if all that could be done with custom PHP, I think I'd probably be better off writing a module anyway.
    – morbiD
    Jul 20, 2015 at 8:31

This can be done with the contrib module Popup ON Load. It has rules integration. Specifically here are instructions.

Some more details about this module (from its project page):

... allows to display a popup once after a certain delay on a page load. This fills a gap in popup modules family (Popups, Popup), which are designed to show popups only after a click on an HTML element, or to implement a complex behavior like modal dialog forms.

  • Unfortunately, as somebody mentioned in that issue you linked, it seems popups can only be triggered by the event "Content is viewed" which means this won't work for the event "After updating existing content", unless you have some solution for that? I tried setting a boolean $display_popup variable in an update rule and then reading it in a content view rule but it doesn't seem to persist between them even if I set it as a global or use drupal_static().
    – morbiD
    Jul 17, 2015 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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