jonjbar
jonjbar

Reputation: 4066

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

I've got a rule set which 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 ?

Upvotes: 0

Views: 453

Answers (1)

Scott Reynen
Scott Reynen

Reputation: 3550

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

Upvotes: 1

Related Questions