Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding block to home page breaks site #16

Closed
leonstr opened this issue Mar 17, 2022 · 2 comments
Closed

Adding block to home page breaks site #16

leonstr opened this issue Mar 17, 2022 · 2 comments

Comments

@leonstr
Copy link

leonstr commented Mar 17, 2022

Adding block_attendance (and mod_attendance) breaks the site, you get an error on login (Moodle 3.11.5):

Debug info: SELECT id,parent FROM {course_categories} WHERE id = ?
[array (
0 => '0',
)]
Error code: invalidrecord
Stack trace:

line 1646 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
line 1622 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
line 6742 of /lib/accesslib.php: call to moodle_database->get_record()
line 107 of /blocks/attendance/block_attendance.php: call to context_coursecat::instance()
line 341 of /blocks/moodleblock.class.php: call to block_attendance->get_content()
line 235 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
line 1181 of /lib/blocklib.php: call to block_base->get_content_for_output()
line 1239 of /lib/blocklib.php: call to block_manager->create_block_contents()
line 374 of /lib/blocklib.php: call to block_manager->ensure_content_created()
line 3984 of /lib/outputrenderers.php: call to block_manager->region_has_content()
line 40 of /theme/boost/layout/columns2.php: call to core_renderer->blocks()
line 1400 of /lib/outputrenderers.php: call to include()
line 1330 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 100 of /index.php: call to core_renderer->header()

Originally reported in Moodle forum post: Can't find data record in database table course_categories.

@leonstr
Copy link
Author

leonstr commented Mar 17, 2022

Presumably this block shouldn't be added to the site home page so line 158 of blocks/attendance/block_attendance.php should be changed to:

    return array('all' => true, 'my' => false, 'admin' => false, 'tag' => false, 'site' => false); 

Alternatively -- and as a workaround for anyone encountering this error -- insert the following lines to blocks/attendance/block_attendance.php below line 56:

    if ($COURSE->id === SITEID) {
        return $this->content;
    }

@danmarsden
Copy link
Owner

thanks for the report - I've just pushed a fix for that into the repo, will look to update the plugins db with the latest version soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants