Lesson (quiz) prerequisites

aotu
Hi guys, I know it's possible at Course level to have prerequisite Courses, however is it also possible at Lesson level? i.e. Course A Lesson 1 Lesson 2 (You must pass lesson 1 first) Lesson 3 (You must pass lesson 2 first) If it's not currently possible, do you think it would be easy to achieve without a big performance hit? I'm thinking about adding an additional field to content type 'Lesson' (->Required lesson), which is of type node-reference (pulling available lessons from a View using OG_Group) to make sure only lessons within the current course are available, In order to check if required lesson exists & is completed, I would then need to run a little loop over every lesson in the course and change their availability in the front-end accordingly. I think that will work, but it doesn't seem too great. Any ideas? Thanks as always, Gavin
James Aparicio

Hi aotu,

Hi aotu,

Sure it is possible to implement.

Start by create a entity reference field (restricted to lesson node content types) in the lesson content type.

Then you have to deny access to a quiz if the user is a student and has not completed the prerequisite. You can implement a hook_node_access to do this.

https://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_access/7

To have the best performance you should not get the lessons from the view. For that look at the table structure in the database and do db_query. db_query is more efficient that db_select.

Best regards

aotu

Hi James,

Hi James, Thanks for your reply, I'll post an update with how I get on Cheers, Gavin
don

Hi aotu

Hi aotu, Do you manage to do the lesson prerequisites? Do you mind to share on how you do the prerequisites? Regards, Don
IASO

Lesson prerequisites

Hi, I implemented the solution you gave above but I have some issues with it. It works well in some places like it disables the next lesson button between lessons if prerequisites are not met. But in some case, like if you access the lessons list and just click to start one lesson with prerequisites, the lesson starts even if the prerequisites are not met. Do you have any idea how can I fix this ? Best regards,
IASO

Lesson prerequisites

So,do you have any idea how it can be fixed ?
ismailkhan

Same issue here

Hi any one there who has done this i want to implement the same functionality couldn't make it possible ... if somebody has done it kindly share here.. Thanks in advance
ismailkhan

Do have resolved the issue ?

Do have resolved the issue ?