Help: create a rule that demotes nodes of a view from front page

Events happening in the community are now at Drupal community events on www.drupal.org.
elvin - albania drupal developer's picture

I have this usecase that i need to implement.

I need to have only 5 nodes promoted to the front page at all times.

I have a view that lists all the nodes that are promoted to the front page WITH AN OFFSET OF 5.
This view gives me the rest of the nodes that i now manually demote from the front page.

i need to create a rule that every time i promote a node to the front page, it automatically removes all other nodes from the front page with an offset of 5.

So when i promote a new node to the front page, the sixth node that is promoted, should automatically be demoted from the front page.

Thanks

Comments

Just off the top of my head

tripper54's picture

Just off the top of my head without actually trying this:

  1. Create a nodes view, filter for 'promoted to front page' , pager set to show all items with an offset of 5.
  2. Add a views bulk operations field to the view.
  3. create a rules action set. add action 'load a list of entity objects from views bulk operation. select the view you created above.
  4. add a loop to loop through the list.
  5. add an action, 'remove node from front page' to the loop.
  6. add a rule, set condition 'when a node is promoted to front page' , set action to the action set you just created.

Should work, let me know how you go.

THANKS A LOT i managed to

elvin - albania drupal developer's picture

THANKS A LOT

i managed to find the solution by following your steps and this tutorial: http://drupalize.me/videos/using-vbo-load-list-objects-rules

the issue was that i needed to add VBO to the master page, and then after that everything went smoothly.

take care

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: