I want to limit the option "Promoted to Front Page" per role. For example, a user with role "promoter" should only be able to promote 5 nodes a day to promote to front page. And same with sticky option.

I am using 'rules_link' module as well.

Any help.

1 Answer 1


You can achieve above by writing a small custom module in Drupal... Steps are outlined below to achieve the same.

  • Create install file and define schema hook with table name as user_promote_counter with below fields
  • uid, timestamp, nid
  • Using hook_node_presave($node) update above table with a record of uid, timestamp, nid of the node updated whenever promote is set to true so that you can track only promoted to front page actions.
  • Use hook_node_validate($node, $form, &$form_state) in your custom module to verify current user who has promoter role exceeded the limit of 5 by querying above table using timestamp and uid columns. Raise an error if limit is exceeded. That will prevent user to promote more than 5 nodes per day.
  • 1
    You rocks man. I am almost there now. :) Commented Feb 24, 2014 at 14:26
  • 1
    I will be putting all the code when I am done, to help others if they are in the same requirement. Commented Feb 24, 2014 at 14:27
  • in hook_node_presave, I can compare the filed value if it was going to be checked or not by using...if ($node->promote == 1 && $node->original->promote == 0){}, but cant do it in hook_node_presave. Any help? Commented Feb 24, 2014 at 18:52
  • More explanation, I want to validate if a checkbox is going to be newly CHECKED or it was already CHECKED. Commented Feb 24, 2014 at 19:17
  • You can run a query to get old value on node table by nid as a condition... For Example: Forum module does this to get old tid from database here drupalcontrib.org/api/drupal/…
    – Anil Sagar
    Commented Feb 25, 2014 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.