![]() Repeat the process with a new Fetch entity by id action. Give it a recognisable Variable label and name, such as "Fetched Node" and "node_fetched". This is the id of the node the comment was made on. We're looking for a node id, so scroll through the Data Selectors until you see comment:node:nid. Start by creating an action, Fetch entity by id. To get to the user, you need to follow this chain. The Rule event would be After Saving New Comment, which gives you data selectors relating only to the comment itself. Comment -> refers to a Node -> Node has Author -> Author has Email address If you have a rule with multiple entities involved, you need to "Fetch" the entities you didn't start with. For example, if you wanted the site to email the author of a node whenever a comment was made on that node, think about the "chain" of connections and break it out. If the event is something non-content related, such as a "System" event like Cron maintenance tasks are performed, those parameters will be all you have to work with. This all works fine if the content you want to affect is directly connected to the Event, like adding a user role when you create a new user account. In any other case you might be frustrated when opening up the Data Selector menu and not finding the parameters you're looking for. Standard data is always available, like site:current-user:uid or site:name. The event you choose affects the type of data you can access from the Data Selector when you add conditions or actions on the next screen. This means that when choosing a node event like deleting, saving, or updating content, the data in the data selector will all be based around "nodes." If you choose a user event like After creating new user, then the data selectors will all relate to "account." Data SelectorsĬreating a Rule forces you to start with an "Event" such as After Saving New Content. The key difference between creating a Rule and creating a Rule from Components is the data it has to work with. These are defined on the Components manual page. Components can be single pieces of a "Rule" or even a full Rule or Rule Set. Rules and Componentsįrom the Rules config page, admin/config/workflow/rules, you can immediately create a new Rule, or click the Components tab where you can create a new Component. Rules depends on Entity and Entity Token, make sure you have those too. Note: To follow these examples, install Drupal 7, and enable Rules and the Rules UI. I won't give a detailed tutorial that covers every part of Rules in this post, but I'll cover some parts that I found difficult. ![]() Just like the Views module, the learning curve requires that you familiarize and understand its terminology. When starting out with Rules it might not seem so simple. Similar to the way Views allows you to structure complex queries, Rules lets you grab pieces of content and chain together reactions. ![]() Rules is a powerful module that allows you to script actions and results in Drupal without writing any code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |