Last updated May 29, 2010. Created by Francewhoa on May 28, 2010.
Log in to edit this page.
Objective
In this tutorial we will use rules module to run cron when a content is saved or updated. This tutorial is for absolute beginners. If you consider yourself an advanced user find the README.txt file that comes with the module.
Requirements
- Drupal 6.x
- Rules module 6.x-1.2 or more recent.
- Both
Rules Forms support&Rules Administration UIRules sub-modules must be activated atadmin/build/modules. - We assume that your CCK content type is already created.
Optional
- Token module if you want to use tokenized URL. Make sure that the Token sub-module
Token actionsis activated.
Steps
- Go to
admin/rules/formsto configuringForm events. - Check
Enable event activation messages on formsfeature. Click onSave settingsbutton. - Go to
node/add. - Click on the appropriate content type link. Rules will run cron when a page from this content type is saved or updated.
- Close by the top of the next page search for the big message box. Click on
Activate events for ********_node_formlink. - On the next page click on
Activatebutton. - Go to
admin/rules/trigger/add. - To create a new rule fill the
Labelfield. The label could be anything. - Under
EventselectRules Forms > **** node form is submittedoption. - Leave other options to their default setting.
- Click on
Save changesbutton. - On the next screen click on
Add an actionlink. - Under
Select an action to add:selectPHP > Execute custom PHP codeoption. - Click on
Nextbutton. - Type in the following PHP code into
PHP Codefield.module_invoke_all('cron'); - Click on
Savebutton. - That's it you have successful created a rule that will run cron when a content type is saved or updated.
- To test simply create an new node at
node/add
Where *********** is the name of your content type.
Source PHP code: rickauer http://drupal.org/user/69553
Comments
Thank you
Great tutorial. Would you be so kind as to tell me what I would put into the PHP code field if I wanted, say, to update URL aliases (using pathauto and token) once new content was created?
I do not see where to put the
I do not see where to put the php code indicated in step 13. The rest of the steps worked.