开发者

How to set the published content by the Drupal Rules module node as the frontpage node?

开发者 https://www.devze.com 2023-02-02 00:46 出处:网络
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)

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消