Many time it happen we want the Drupal to perform certain task or action automatically We use action in drupal to automate certain task mainly task which need to be acted upon content and user account. By default there are number of simple and advanced actions available which can be configured by appropriate user.
Lets set simple action which will send an email to admin once new user get registered.
Configure actions
Configuration -> Actions -> SYSTEM (default actions cannot be modified)
Create a new advanced action
Set up a new Send e-mail action by selecting it from the drop-down list and click on the Create button. And label it notify admin when new user register remember label is important as it will distinguish this action from the other ones, try to make the label meaningful and concise to avoid any confusion. Fill all the required information such as recipient, subject, Message fields. Once all done then save it. Now this action will appear in a list where you can edit and delete it.
Your action is set now. But note action itself wont do any thing action cannot do anything unless there is a specific system event triggered , these events in Durpal are called triggers. When any event occurs Drupal check if any trigger is associated with it and if yes it runs the action which is attached with this trigger that means triggers and action work together.
Triggers are not enabled by default, you need to enable it go to MODULES and enable Triggers module. Once enable go to the Actions page and click on triggers
Triggers are divided into five different categories, each providing a range of triggers to which actions can be attached. Assigning a trigger is basically selecting an action to apply from the drop-down list of the relevant trigger and clicking on the Assign button.
Now select USER tab in the Trigger : AFTER CREATING A NEW USER ACCOUNT box, select the newly defined action in our case 'notify admin when new user register' click Assign. Now you are done with you action and trigger and Now Test it.
- Log-out from admin
- Register a new account
you will find that the new user register notification email is in your inbox
0 Comment(s)