jleyva / moodle-block_configurablereports

This block is a Moodle custom reports builder. You can create custom reports without SQL knowledge. It's a tool suitable for admins or teachers.
http://moodle.org/plugins/view.php?plugin=block_configurable_reports
66 stars 158 forks source link

get_all_user_name_fields() deprecated since Moodle 3.11 #247

Open rmartinezgc opened 2 months ago

rmartinezgc commented 2 months ago

Congratulations for your titanic work with this plugin and its maintenance, bravo!

When upgrading my Moodle platform to version 4.3.3+ (Build: 20240409), and with their respective plugins, and with php 8.1, I have realized that with your new version, it does not work in the report that I had created and working in previous versions. Reviewing the code, I have seen that the get_all_user_name_fields() method is still being used when this method is deprecated since Moodle version 3.11. I think your plugin would work if another method was used instead.

Thank you.

Regards.

top-ender commented 1 month ago

We use this plugin now with Moodle 4.3 and 4.4 and got the same error message when using the user-filters. For a quick and dirty solution to keep the plugin running we locally changed two lines in components/filters/users:

- $sort = implode(',', order_in_string(get_all_user_name_fields(), $nameformat));
+ $sort = implode(',', order_in_string(\core_user\fields::get_name_fields(), $nameformat));
- $users = $remotedb->get_records_select('user', "id " . $usql, $params, $sort, 'id,' . get_all_user_name_fields(true));
+ $users = $remotedb->get_records_select('user', "id " . $usql, $params, $sort, 'id,' . \core_user\fields::for_name()->get_sql('', true, '', '', false )->selects); 

Maybe this could be a solution for your problem as well and supports the further development of this plugin.

Regards, Christoph