0

I have a drupal 7 site that is used for registration for certain events. We are currently using content types to collect the information. What I need is to only allow registered users to post certain content types between a certain set of dates. Certain roles should be able to add/edit at any time.

For example. One of the content types is Grant. But we only accept grants between May 1 and May 31st.

Before May 1st we'd like to have a message that states: Grants are currently not open, please check back May 1st. After May 31st we'd like a message to state: Grants are currently closed for Spring 2018, please try again next year. or something like that.

1 Answer 1

1

I would suggest looking into the Rules module for this.

Using this module, you can use its Condition feature to:

  • Check the date ranges that you specified
  • Check what content type is being created
  • Check the current logged in user's role if it's the permitted user role to create a content type

Based if these conditions are met, you can then add what event or message for this matter to display to the user. You aren't also limited to creating one rule but you can create multiple rules based on your conditions.

Hope this gives you an idea and solution.

2
  • Which "Rules Event" would such custom rule use? Something like "Before saving content", or "After saving content"? If so how would you actually STOP such content to be created? And what about updates of existing content (whereas one first creates a node that satisfies the validations, and then update the date(s) to something that wouldn't fit anymore)? Commented Apr 2, 2018 at 12:29
  • I was able to get just about every other piece of the rules to work. I created a "dates" node with entity reference pulled into the Event Node. I have Rules checking the dates for my event submissions against the current server date. What I'm unable to figure out is how to trigger the rule on node creation. There only seems to be before save, after save, before delete and viewing content. None of which fit my need. Is there another module that adds this functionality? Commented Apr 3, 2018 at 3:47

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.