How to set the published content by the Drupal Rules module node as the frontpage node?
I've got a rule set wh开发者_Go百科ich publishes a node based on some condition. This is working great. Now I would like to also promote that node as the front page (not publish it in the front page): in other words, I would like to automatically change the drupal front page alias to the newly created node.
Do I need to create a custom PHP action in my rule set which will update the database ? Is there a simpler way using default rules actions ?
Rules comes with a rule for "Execute custom PHP code", which you could use to make this rule. The front page is saved as a variable with name "site_frontpage", so the custom rule code should be something very simple like this (untested):
variable_set('site_frontpage', $node->path);
精彩评论