General developer forum

First activity in a course

Picture of Alex Noble
First activity in a course

I am currently working on a course format where under certain conditions you are directed to the first activity on a course. Does anyone know of any easy way to get hold of this?

I could just create a course format setting with the idnumber of the activity I want to access first but I am sure there most be a code way to do that. 

I got as far as looping through course sections where the sequence is not empty (there is at least one activity) however despite deleting the news forum I can't seem to get it to forget that was there. I could ignore section 0 but that seems lazy and an activity could be in that section.


Average of ratings: -