Thank you Paola!
I wonder if it would work if in the first if statement we included a test to see if it is a guest user ... so, something like:
if ((isset($lastpageseen) && ($lastpageseen != LESSON_EOL)) !(isguestuser()))
and then leave the statement uncommented.
Does anyone know if this would work? We will try it anyway ...