Pages

Monday, August 27, 2012

How does the Topics Course Format remember the last state per user? Moodle Community to the rescue.

And how do you cause it to "forget" the last state? Here's how! Read on.


An expert and authority on Course Formats, Gareth J Barnard, replied.


Here's the hack code that does the job of stopping persistance in all Topics courses:

Edit 'format.php' in the  '/course/format/topics' folder and change the code from:


if ($topic != -1) {
   $displaysection = course_set_display($course->id, $topic);
} else {
   $displaysection = course_get_display($course->id);
}
to
if ($topic != -1) {
    $displaysection = $topic;
} else {
    $displaysection = 0;
}


And once again, thanks to the unsung heroes and kind Moodle Community, another stuck programmer is rescued and a teething programming problem is solved. Don't you just LOVE the Moodle Community?

Happy Moodling
Frankie Kam

If you like this post or site
a small donation would be nice but would last only a day,
otherwise leaving a comment (or a compliment) below will last me a month!

Ratings and Recommendations by outbrain