Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [rules]

Use it for questions about the engine which allows site administrators to automate actions: the Rules module.

24
votes
5answers
7k views

How can I quickly re-save all the nodes on my site (to trigger a rule that activates on content update)?

I made some mistakes configuring a certain content type on my site. To fix these mistakes, I made a rule that performs some actions "when existing content is updated." However, I don't want to go ...
23
votes
1answer
13k views

Programmatically execute an action set (Rules module)

I want to use Rules UI to define some action sets, but want to execute those actions programmatically from a custom module. How to I execute the action by code and pass the needed arguments (just a ...
20
votes
3answers
14k views

How to change a field value with a Rules Action?

I'm trying to set up a Rules Action that can change the value of a field. I created an Action Set with a data type of Node. When I go to create a Rules Action, I have access to every default Drupal ...
15
votes
3answers
5k views

How to create Facebook style user notifications?

Using Heartbeat I have been able to effectively make streams of user activities through Rules triggers. However I would like to be able to have users notified of new activities, and keep a count of ...
15
votes
1answer
3k views

Send email notification with Rules

I'm using Drupal 8.1 with Rules 8.x-3.0-alpha1. I want to create a rule to send an email to the author of a node when a new comment is posted to this node. Problem is I didn't get the email address ...
12
votes
5answers
17k views

How to redirect anonymous users to login page using Rules module?

I'm using rules module with drupal 7 in order to redirect anonymous users to the login page, so I created a rule with react on event "Drupal is initializing", condition "User has role" with anonymous ...
10
votes
2answers
2k views

How to set Rules event for “Content is viewed” from excluding Teaser view?

I set up a Rule that will execute during the "Content is viewed" Event and the action was to show a system message. It worked and was triggered when I viewed the node. However, when I went to the ...
10
votes
3answers
3k views

How to to check if user has changed the password?

I wanted to send basic notification email to the user, after it has changed the password, to inform him of password change. I am using Rules modules for that. But I am not finding any option there, ...
9
votes
3answers
7k views

Email a Whole Node (Including template contents)

I have created my own custom node.tpl.php file. I now want to email the entire node, each time the user creates a new node of that content type (I have made sure that all the HTML in my node.tpl.php ...
9
votes
4answers
2k views

How can anonymous users be allowed to post while still maintaining content integrity?

A little background: As you see on http://charlotte.ebayclassifieds.com, if you click 'post an ad' and then choose a category, you can fill out the form and submit content without having to sign up. ...
9
votes
2answers
2k views

How to grant User Points equal to the price of a Commerce Product?

I would like to grant User Point to product owner in amount of product price after a product is sold. For this I defined a rule as below: Events: Completing the checkout process Actions: Loop (...
9
votes
3answers
3k views

Add role to user after joining organic group with rules

I'm trying to add a user role to a user who has become a member of a group. The workflow is like this: User requests to join group. Request is approved by group administrator. User is a member of ...
8
votes
5answers
7k views

How do I check if a single on/off checkbox is checked?

There does not appear to be any way to check the value of a single on/off (boolean) checkbox in the data selector for the Rules module. If "field-MyField" = checked or "field-MyField" = 1, then do '...
8
votes
2answers
206 views

How to change a user to a different role based on the number of their posts?

Are there any techniques out there that can put a user in a specific role into a different role automatically after they make X number of posts (core forum topics or/and replies)? I'd like to ...
8
votes
2answers
1k views

What is the correct way to update existing module's rules programmatically?

I want to provide an update for my custom module, which also has some rules provided via hook_default_rules_configuration. Now, how can I update those existing rules? Can I re-import them? Override ...
8
votes
5answers
569 views

How to publish nodes 3 times a day?

I have a list of unpublished nodes, created with the Views module. I would like a task to be run 3 times a day, at specified times. Every time the task runs, only one of the nodes on the list should ...
7
votes
3answers
7k views

How to pre-populate fields on a node creation form based on fields from Profile2 module?

There is a content type ("Job Listing") that a business account can use to list job openings, and a Profile2 profile for each business that contains the business's address, organization name and ...
7
votes
2answers
4k views

Disable editing of a node after it has been published

Scenario: A user can create a node (content type "story"). All story nodes that are created are unpublished by default. I have a boolean field called "publish my story". Once this has been checked ...
7
votes
2answers
563 views

How to stop a loop in rules?

I'm using Conditional Rules module, there some conditions inside the loop I need to break out of. However, there's no action in rules for stopping/terminating the loop. I tried a custom rules where I ...
7
votes
1answer
1k views

How to create a view of unread comments on own nodes for the user's profile page?

I'd like to create a view for the user's profile page that displays all unread comments on the nodes he/she created. When I say 'unread', I mean that the page where the comment is situated (namely, ...
6
votes
2answers
9k views

How should I use token_replace()?

Could somebody give me an example of how to use token_replace()? I'm trying to write a custom PHP rule for the Rules module that will rewrite few fields of a new saved content, using the values from ...
6
votes
2answers
4k views

How to use the Rules module to implement a custom redirect for an outdated URL?

I used to show content from a catalog via the Views module, accessing an external database, so that all of the URLs would be something like /content?name=[name]. For various reasons, I've opted to ...
6
votes
3answers
6k views

Programmatically import a feed

I can successfully import remote content using the Feeds module by manually clicking on the Import button. I need to execute the import process from code, either from a module or executing PHP code ...
6
votes
4answers
4k views

How to create custom commerce order states?

I want to create custom order state's and in a view use a "button" or a "select list" to toggle those states. For example I have view that display's a table of all orders that are marked completed. I ...
6
votes
5answers
2k views

Rule condition to check which language is used by the visitor?

I have a multilingual website (English, Spanish). Is there any way to create a rule condition to compare the language used by the visitor against a fixed value? The condition would something like: ...
6
votes
2answers
2k views

How do I send an email to all users that has flagged a node using rules?

I need to send an email when there is a new comment on a node to all users that have flagged that node? How do I do this? The flag is called "Follow" and the content type is "Blog"
6
votes
1answer
2k views

Convert an exported rule to a programmatic rule

I created a Rule through the GUI and it works fine. I would like to convert this into a programmatic rule that I can include with my custom module. This way I dont have to re import my rule every ...
6
votes
2answers
1k views

Commerce partial payment : pay deposit at checkout and full settlement later

In a Travel Booking website, how can I configure checkout so that customers pay only a n% deposit of the order total at checkout (off-site payment ATOS solution) ? If the order is created : less ...
6
votes
1answer
2k views

How to use tokens in php code of the rules module?

I'm using Ajax_comments to add comments on nodes without having to reload the page on save. Now the "node history" doesn't get updated which throws off the "new comment" count. I tried to create a ...
6
votes
2answers
376 views

Which user does the Rules module execute as?

I've set up a rule which is triggered by "after saving a new user account". This rule simply sends an e-mail. The e-mail contains various tokens, one of them is the field [account:field_country]. I'...
6
votes
3answers
1k views

How to prevent a node being saved when using the Rules module?

Is it possible to prevent a node from being saved with Rules? This is what I do now: Create a rule Before saving content of type ''. Condition: IF ... TRUE => Redirect & set message Create a ...
6
votes
3answers
716 views

How to mass update recurring date rules?

I would like users to be able to mass update recurring date rules possibly using VBO and Rule sets. For example: user would like to add "exclude date = 01/01/2012" recurring date rule for all ...
6
votes
1answer
2k views

Token replacement pattern for triggered rules on node creation

I am currently using triggered rules to send notifications whenever a certain node type is created (by anonymous, unauthenticated users). In the email notification sent I would like to include some of ...
6
votes
1answer
2k views

How can I compare data comparison with values submitted in a webform?

I am trying to use webforms with the Rules module. How can I compare data with the values submitted in a webform ? For example, if the webform has a yes/no radio button, how can check the submitted ...
6
votes
2answers
266 views

How do I update weight using Rules?

I am creating a sampler pack of all my products. I have a product display with several node reference fields (not product reference) so that whenever a new product is added, that reference field is ...
5
votes
6answers
4k views

How to add a custom icon or symbol to a flag link?

I'm working on a 'sample request' implementation for a commerce site using Flag, Views, sessions and a little custom code. I'd like to add an icon or a symbol to let people know that an item they are ...
5
votes
3answers
86 views

How to know user submitted first content of a specific type?

I used Rules module to know when a user has logged in and notify the user about his/her login event. Now I just want to check when the user has submitted a content of one specific type for the first ...
5
votes
1answer
425 views

How do I disable a module when Drush or the GUI doesnt work?

My site just gives a WSOD and throws this error: Error: Unsupported operand types in sites/all/modules/rules/includes/rules.state.inc, line 620 Since I can't even get to my site now without a WSOD,...
5
votes
3answers
5k views

How to find the right token to use in a rule for sending an email to the node author?

I am having the toughest time figuring out how to send an email to the node author. I created my rule and everything works if I hard code the email but I can't seem to get the right token to use and ...
5
votes
1answer
689 views

How to show messages starting with “Debug : ” to an administrator only?

I'm developing a lot of complex rules in D7 and for debugging reasons it is very handy to have different messages (the standard Drupal message) within the website. For this I use "showing a message on ...
5
votes
2answers
453 views

Loop through node reference

I want to send emails using email stored on node fields that are referenced twice by other two contents types. I have this content types relationship: Content1 field1 (unlimited) - ...
5
votes
3answers
2k views

Is it safe to use php within a Rules condition?

Using Rules I need a condition which checks if the logged in user has authored a given content type. It seems that I need some custom php for this and I found the code below from a post on drupal.org,...
5
votes
2answers
93 views

What's the difference between the 2 different Rules pages in admin?

What's the difference between the Rules shown under Structure > Content Types > My type > Rules and Config > Workflow > Rules? The first one is from Entity Rules (= "Instead of adding ...
5
votes
1answer
407 views

How do I create a Rule “When role is removed, send email to the user”?

I am trying to create a rule that sends an email to the user when a role has been removed from their account. I can't seem to find a rule reaction under User "When role is removed". How do I create a ...
5
votes
2answers
2k views

How can I check whether a username is in use?

On creating a "course" content, i am creating a dummy user as its "instructor". Here is the related question. I wasn't able to add a condition to the rule that creates the user, that checks whether a ...
5
votes
1answer
3k views

Pass an argument to a Rules Action using VBO

If I create a Rules Action to set the value of a CCK field, and point to that action from VBO, is there a way to add user inputs to the VBO form on the views page to pass parameters to the Rules ...
5
votes
3answers
7k views

Commerce/Rules - Multiply the price by a custom field value

In my Drupal Commerce store, I have a field called Commission. The Commission is input as a percentage (i.e. its not a fixed global value). I need the final price to be updated so it incorporates ...
5
votes
4answers
3k views

Execute reaction rule programmatically

I want to run Commerce rule "Create a new account for an anonymous order" from code. I can create user with user_save and etc, but I like this rule and want to reuse it. After a hour I finished with ...
5
votes
1answer
2k views

What's the alternative to using the Conditional Rules module?

The Conditional Rules module allows for including Rules Conditions within Rules Actions (using its If/Else constructs), something you cannot do by only using the Rules module. Here are just a few (out ...
5
votes
2answers
2k views

drupal commerce conditional checkout panes

I have used the following module to add a custom checkout pane to get some additional information from the user regarding the order. https://drupal.org/project/commerce_fieldgroup_panes I now need ...