1

I am building a site where I need to give each individual user access to site content according to the user progression of content consuming.

For the example, User A has access to watch entry no.1, than only a week later, he can get access to entry no.2 and so on.

What would be the best approach for to create such hierarchy in Craft 3?

Thank you for any hint!!

2 Answers 2

1

You'd most likely need to write a custom plugin. I think it might be doable (but maybe not advisable) with Twig.

The plugin would contain an array of the entries in the sequence. How you specify this is up to you. It could be from within plugin settings, or a specific entry, or even just hard coded into your plugin.

Then you need to create some way to store user ids against the last entry they watched and a date. Perhaps in a database table created by your plugin. Alternatively each user would have a custom field on their profile that contained the ids of the last entry they viewed plus the date they watched it.

When visiting the url for an entry, there is a check performed against that field. If this is the next entry in the sequence, and sufficient time has passed since they viewed the previous entry then allow them access. Also update the database table (or their hidden profile field) with the new entry ID and current date.

It's really down to scoping out the exact way you want it to work, not worrying about the method or code involved. Once you've got that you can determine how to write the plugin.

1

I did the same thing, had to create a custom plugin, try checking out this thread i made awhile back might give you a little insight on how to go about doing it.

Entry Tracker to see who has completed the course

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.