Hi,
We are using moodle 3.7.1, while deleting the few courses, we getting the following error
Coding error detected, it must be fixed by a programmer: Invalid user parameter supplied for mark_user_dirty() function!
More information about this error
Debug info:
Error code: codingerror
Stack trace:
line 1719 of /lib/accesslib.php: coding_exception thrown
line 1648 of /lib/accesslib.php: call to mark_user_dirty()
line 5234 of /lib/moodlelib.php: call to role_unassign_all()
line 5036 of /lib/moodlelib.php: call to remove_course_contents()
line 68 of /course/delete.php: call to delete_course()
Kindly help us..
Maybe there are some null values in the database column mdl_role_assignments.userid. This column should not allow nulls.
Do you know how to run database queries? What do you get when you run (assuming you have MySQL or MariaDB):
DESC mdl_role_assignments;
On my Moodle 3.7 site this is:
+--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| id | bigint(10) | NO | PRI | NULL | auto_increment |
| roleid | bigint(10) | NO | MUL | 0 | |
| contextid | bigint(10) | NO | MUL | 0 | |
| userid | bigint(10) | NO | MUL | 0 | |
| timemodified | bigint(10) | NO | | 0 | |
| modifierid | bigint(10) | NO | | 0 | |
| component | varchar(100) | NO | MUL | | |
| itemid | bigint(10) | NO | | 0 | |
| sortorder | bigint(10) | NO | MUL | 0 | |
+--------------+--------------+------+-----+---------+----------------+
Also try:
SELECT * FROM mdl_role_assignments WHERE userid IS NULL OR userid = 0;What do you get?
While execute the following query
DESC mdl_role_assignments;
Field | Type | Null | Key | Default | Extra | |
---|---|---|---|---|---|---|
id | bigint(10) | NO | PRI | NULL | auto_increment | |
roleid | bigint(10) | NO | MUL | 0 | ||
contextid | bigint(10) | NO | MUL | 0 | ||
userid | bigint(10) | NO | MUL | 0 | ||
timemodified | bigint(10) | NO | 0 | |||
modifierid | bigint(10) | NO | 0 | |||
component | varchar(100) | NO | MUL | |||
itemid | bigint(10) | NO | 0 | |||
sortorder | bigint(10) | NO | MUL | 0 |
And for
SELECT * FROM mdl_role_assignments WHERE userid IS NULL OR userid = 0;
|
roleid | contextid | userid | timemodified | modifierid | component | itemid | sortorder | |
545053 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545520 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545521 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545522 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545523 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545524 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545525 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545526 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545527 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545528 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545529 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545530 | 3 | 0 | 0 | 0 | 2 | 0 | 0 | ||
545531 | 3 | 0 | 0 | 0 | 2 | 0 | 0 |
Kindly do the needful...
Hi leon,
I deleted the records having userid=0 in the table mdl_role_assignments, now am able to delete the course..
Thank you so much
Arun
I deleted the records having userid=0 in the table mdl_role_assignments, now am able to delete the course..
Thank you so much
Arun
The records having userid=0 suggests something other than Moodle inserted data into the Moodle database, maybe you have a script to populate user enrolment. If so, using the Moodle API instead would avoid these problems.
Also: you should update the site to Moodle 3.7.9. The site is missing over a year's fixes including 29 security updates.