0

I have some events within WordPress that users can register for. I would like to give access to certain content ON THE DAY of the event.

So, I have 2 possible approaches:

Every time a user registers for the event, I schedule a WP cron job event for the day of the event that gives them access to restricted content.

Or, tag the users with the date of the event they chose, and run a daily WP cron-job which checks all users and gives them access to the restricted content IF the date on the user matches the current date.

Since I'm quite a newbie - which one is the better approach (performance, scalability, etc)?

Maybe there's a third, better solution I haven't thought of as well :)

1
  • How are you restricting access to the content in the first place? – Jacob Peattie May 14 '20 at 14:13
0

I don't think I would use cron jobs for this at all. If I was writing code for it I would probably have a check on the page that just says if the user is part of x group and date is greater than the event start date then render the page, otherwise return a message saying it's too early, check back later.

Either that or just setup the page/post so it's scheduled to publish on the date of the event. If the content should only be available to users in a certain group use a membership plugin with the ability to restrict content to members of that group.

When you schedule a post it will get picked up by the WordPress cron, this can be setup in a couple of different ways.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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