Fix for Fatal Error when book on homepage (1.9.10)

Fix for Fatal Error when book on homepage (1.9.10)

by Ian Nisbet -
Number of replies: 0

To reproduce:

1. On the site home page, add a book.
2. View Book, then click on Import
3. Click on the Choose or upload a file... button
4. Error is displayed at the bottom:

Call to a member function get_id() on a non-object in /lib/blocklib.php on line951

The fix is built upon [#MDL-13276] Fatal error in files/index.php - Moodle Tracker, which is now implemented in Moodle 1.9 files/index.php but does not seem to have made it into the /mod/book/coursefiles.php which is based on files/index.php.

Anyway, find the line (probably 46) with:

if ($course->id == SITEID) {

Then add:

if ($course->id == SITEID and !$choose) {

Average of ratings: Useful (2)