Does anyone have suggestions on the best way to create a system that would automatically give a user group access to certain content when said content reaches x. days of age?
For instance, I want to give a group access only to blog entries that are OLDER than 30 days. But without having to manually change the resource group of these articles.
On the face of it, I have a feeling that the way you could use contexts might help here.
Different getResources calls based on the context it is in? I'm thinking aloud, sorry!
-
☆ A M B ☆
- 30 Posts
Your best bet would be to utilise a cron job (if your server allows it) - every day at midnight run a script that finds all resources that have a published date of >NOW()-30 and the add the to the relevant resource group.
.
If you can't run a from job you could accomplish it with snippets or getResources, but it will add a huge weight onto your page load time as it would have to recalculate on every single page load rather than just once a day
If you can't use a cron job, you could put the code in a plugin attached to something like OnDocFormSave or OnPageNotFound that won't slow the site down too much, or in a snippet with a tag on a page that isn't accessed too often.