Old enrolment plugin

Old enrolment plugin

by Silvia Pinheiro -
Number of replies: 0

Hello,

I have just upgraded to Moodle 3.4.3 with PHP 7.2

When I go to the Enrolled Users page, I get this error on some courses:

              Exception - Call to a member function get_user_enrolment_actions() on null

With debug on my local development server, I can see this:

              Notice: Undefined index: shibboleth_4 in C:\xampp\htdocs\moodle3.2\enrol\locallib.php on line 919

              Notice: Undefined offset: 19 in C:\xampp\htdocs\moodle3.2\enrol\locallib.php on line 921

              Exception - Call to a member function get_user_enrolment_actions() on null

              Debug info: 

              Error code: generalexceptionmessage
      Stack trace:
  • line 374 of \user\classes\participants_table.php: Error thrown
  • line 821 of \lib\tablelib.php: call to core_user\participants_table->col_status()
  • line 1514 of \lib\tablelib.php: call to flexible_table->format_row()
  • line 1631 of \lib\tablelib.php: call to table_sql->build_table()
  • line 251 of \user\classes\participants_table.php: call to table_sql->out()
  • line 233 of \user\index.php: call to core_user\participants_table->out()

On site administration > Manage enrol plugins, I can see the reference to enrolment plugins named shibboleth_x. They seem to have a different number according to the course where I get this error. On plugins overview, I can see the reference to that enrolment method as enrol_shibboleth which is disabled. 

At the moment, we are using the enrol_attributes method with Shibboleth authentication and, when I started to work here I don't remember seeing a folder for shibboleth under enrol on the directory. My manager doesn't remember what that was for and the courses where that is used have more than 2 years, so that must have been implemented a while ago.

After some research, I found a possible solution for this, which is renaming all of these enrolments on the database to manual. I did this for some and it worked indeed, but I thought uninstall should delete all the references which doesn't. After deleting it, I still get the error.

By testing the code, I was able to add a foreach to unset the instances of these old enrolment methods on the get_enrolment_instances function, but I know changing the core is not the best option. I thought it could be a bug since the result of this function doesn't seem to match the one who gets the enabled plugins because of the param $onlyenabled "Whether to return data from enabled enrolment instance names only" which sometimes is used as true and other false....

I didn't have this error before the upgrade from Moodle 3.

I was wondering what impact can any of these solutions have in the future, since deleting doesn't solve it and rename on DB seems to do it with the advantage of not messing with core files. I wouldn't want to trigger something else.


Regards,

Silvia


Attachment enrol users local bug.png
Attachment enrolment plugins.png
Average of ratings: -