1 This files describes API changes in /enrol/* - plugins,
2 information provided here is intended especially for developers.
6 * Functions get_potential_users() and search_other_users() now return more information to avoid extra count query:
7 - users: List of user objects returned by the query.
8 - moreusers: True if there are still more users, otherwise is False.
9 - totalusers: Number users matching the search. (This element only exists if the function is called with $returnexactcount param set to true).
10 * enrolledusercount is now optional in the return value of get_users_courses() for performance reasons. This is controlled with the new
11 optional returnusercount parameter (default true).
15 * External function core_enrol_external::get_users_courses now return more information to avoid multiple queries to build the
17 - displayname: Course display name for lists.
18 - marker: Course section active marker.
19 - completed: Whether the given user completed the course or not.
20 - lastaccess: Last time the user accessed the course.
21 - overviewfiles: Course overview files.
22 - completionhascriteria: Whether completion criteria is set for the course.
23 - isfavourite: Whether the user marked the course as favourite.
24 - hidden: Whether the user hide the course from the dashboard.
25 * External functions core_enrol_external::get_enrolled_users and core_enrol_external::get_enrolled_users_with_capability now return
26 the last access time for the users in the given course.
30 * Default sorting in enrol_get_my_courses(), enrol_get_all_users_courses() and enrol_get_users_courses() now respects
31 the site setting "navsortmycoursessort" and should be consistently used when displaying the courses in the UI.
35 * render_course_enrolment_users_table method has been removed from the renderer. The enrolled users page is now
36 combined with the participants page. /enrol/users.php no longer exists.
40 * External function core_enrol_external::get_users_courses now return the user progress, start and the end course dates.
44 * External function core_enrol_external::get_users_courses now return the category id as an additional optional field.
48 * core_enrol_external::get_enrolled_users now supports two additional parameters for ordering: sortby and sortdirection.
49 * Enrolment plugins UI have been consolidated. Plugins can implement use_standard_editing_ui() function
50 and add edit_instance_form() and edit_instance_validation() methods instead of providing their own edit.php and form.
51 They can then rely on the default implementation of get_action_icons and get_course_navigation. In future this will
52 mean they can be called by webservices/user upload tools because they can validate their data.
56 * Added new events enrol_instance_created, enrol_instance_updated and
57 enrol_instance_deleted . Always trigger them when changing records in the
59 * Constant CACHE_COURSE_CONTACTS_TTL was deleted.
60 * External function core_enrol_external::get_enrolled_users now returns only the viewable participants if the course has groups enabled and no groupid is passed.
64 * External function core_enrol_external::get_users_courses now returns additional optional fields:
65 - summary: Course summary.
66 - summaryformat: Course summary format.
67 - format: Course format.
68 - showgrades: True if grades are shown, otherwise false.
69 - lang: Forced course language.
70 - enablecompletion: Control or not via completion and activity settings.
74 * enrol_plugin::instance_deleteable() is deprecated and has been replaced by enrol_plugin::can_delete_instance()
75 * enrol_plugin::can_hide_show_instance() is a new function to control who can hide/show enrolment instances.
76 Returns true by default but plugins must implement their own logic.
80 * Enrolment plugin which supports self enrolment should implement can_self_enrol()
81 * Enrolment plugin should implement get_enrol_info() to expose instance information
82 with webservice or external interface.
83 * Webservice core_enrol_get_enrolled_users_with_capability was incorrectly specifing
84 float as the return type for user id. int is the actual returned type and is now
89 * plugins may use general enrol/editenrolment.php page to let users edit
91 * new support for grade recovery in enrol_plugin::enrol_user() method
95 required changes in code:
96 * use role_get_name() or role_fix_names() if you need any role names, using role.name
97 directly from database is not correct any more
98 * new restore support: ENROL_RESTORE_EXACT, ENROL_RESTORE_NOUSERS
99 and ENROL_RESTORE_CLASS were removed, implement new restore_* plugin methods instead
101 other changes and new features:
102 * course enrolment manager now works with disabled plugins too
103 * new support for protected group membership linked to enrol instance
104 * new support for expiry notifications - see enrol_plugin::send_expiry_notifications() method
109 required changes in code:
110 * load_temp_role() is deprecated, use load_temp_course_role() instead, temp role not loaded
111 * remove_temp_role() is deprecated, use remove_temp_course_roles() instead
112 * 'user_unenrol_modified' event was renamed to 'user_enrol_modified'
117 required changes in code:
118 * enrolment plugins need to be rewritten to use new API - see inline phpdocs and official plugins