A new optional parameter $context has been added to the
core_group::groups_get_members_join() function.
Besides, some core_group methods now accept -1 (USERSWITHOUTHGROUP) for
the groupid field.
Similarly to what the previous patch does, we now change the default
sorting in functions enrol_get_users_courses() and
enrol_get_all_users_courses() too.
The patch also adds missing phpDocs for the functions, improves the
readability of some existing bits and mentions the changes in the
enrol/upgrade.txt file.
The new default value (null) now respects the navsortmycoursessort
behaviour and should be consistently used whenever we are displaying the
courses in the UI.
The function groups_get_user_groups is called too often both before rendering the page and after the page is rendered (using ajax).
The function was executing a query joining 3 tables in each call. The plementation of the function has now modified to store the
query result in a request cache.
* New optional parameter $enrolid for the following functions:
- get_enrolled_join()
- get_enrolled_sql()
- get_enrolled_with_capabilities_join()
Setting this parameter to a non-zero value will add a condition
to the query such that only users that were enrolled with this
enrolment method will be returned.
Part of MDL-59290.
Allow enrol_get_my_courses to be filtered by a set of known course ids
that the user may or may not be enrolled on.
The result will be a subset of the given course ids that the user is
enrolled in.
Part of MDL-55611 epic.
This commit change send course welcome message to a drop-down that now supports sending emails from:
- Course contact
- Enrolment key holder
- No reply address
Also moves part of the logic of handling send welcome email from to a new method get_welcome_email_contact() and unit test for this new method.
Refactor similar SQL generation code from get_users_by_capability
and get_enrolled_uses to make get_with_capability_sql.
Modified files: accesslib.php, enrollib.php, grouplib.php, new tests.
The course object returned by enrol_get_all_users_courses does not include the defaultgroupingid.
This course object is passed to user_get_user_details - which does need
the defaultgroupingid.
All the other group info is returned (groupmode) etc - so it makes sense to also return this extra field.