Error viewing category when using XP block
Closed this issue · 2 comments
I am using XP in courses in Category 3 in Moodle. As a logged in user I have no issues viewing the url:
http://learn.culturalinfusion.org.au/course/index.php?categoryid=3
If I try to access this URL when NOT LOGGED IN - an error occurs:
`Debug info: SELECT u.id, x.userid, x.xp, u.id AS userid,u.picture,u.firstname,u.lastname,u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.imagealt,u.email, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance
FROM {user} u
JOIN {context} ctx
ON ctx.instanceid = u.id
AND ctx.contextlevel = :contextlevel
LEFT JOIN {block_xp} x
ON x.userid = u.id
AND x.courseid = :courseid
WHERE u.id = :userid
[array (
'contextlevel' => 30,
'courseid' => 37,
'userid' => 0,
)]
Error code: invalidrecordunknown
Stack trace:
line 1561 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
line 104 of /blocks/xp/classes/local/xp/course_user_state_store.php: call to moodle_database->get_record_sql()
line 127 of /availability/condition/xp/classes/condition.php: call to block_xp\local\xp\course_user_state_store->get_state()
line 70 of /availability/condition/xp/classes/condition.php: call to availability_xp\condition->get_user_level()
line 84 of /availability/classes/condition.php: call to availability_xp\condition->is_available()
line 265 of /availability/classes/tree.php: call to core_availability\condition->check_available()
line 197 of /availability/classes/info.php: call to core_availability\tree->check_available()
line 1819 of /lib/modinfolib.php: call to core_availability\info->is_available()
line 1848 of /lib/modinfolib.php: call to cm_info->obtain_dynamic_data()
line 1168 of /lib/modinfolib.php: call to cm_info->get_user_visible()
line 72 of /filter/activitynames/filter.php: call to cm_info->__get()
line 176 of /lib/filterlib.php: call to filter_activitynames->filter()
line 218 of /lib/filterlib.php: call to filter_manager->apply_filter_chain()
line 1282 of /lib/weblib.php: call to filter_manager->filter_text()
line 2408 of /course/renderer.php: call to format_text()
line 226 of /theme/moove/classes/output/core/course_renderer.php: call to coursecat_helper->get_course_formatted_summary()
line 186 of /theme/moove/classes/output/core/course_renderer.php: call to theme_moove\output\core\course_renderer->coursecat_coursebox_content()
line 121 of /theme/moove/classes/output/core/course_renderer.php: call to theme_moove\output\core\course_renderer->coursecat_coursebox()
line 1479 of /course/renderer.php: call to theme_moove\output\core\course_renderer->coursecat_courses()
line 1572 of /course/renderer.php: call to core_course_renderer->coursecat_category_content()
line 1703 of /course/renderer.php: call to core_course_renderer->coursecat_tree()
line 66 of /course/index.php: call to core_course_renderer->course_category()`
Thank you for the report. This was fixed in the availability plugin xp
, which I'll post on Moodle.org right after I post this message. The problem originated from the activitynames
filter which attempted to check the availability of an activity restricted by xp
for a non-logged in user.