Closed jazinheira closed 5 years ago
This would be extremely useful to me!
I got it working with the following addition to sso.php, right after the $extraparams block:
// Send cohort membership as groups
$cohort_query = "SELECT idnumber FROM {cohort} INNER JOIN {cohort_members} ON {cohort}.id={cohort_members}.cohortid WHERE {cohort_members}.userid = ?";
$groups_list = $DB->get_fieldset_sql($cohort_query, [$USER->id]);
$extraparams['groups'] = implode(",",$groups_list);
Happy to make a pull request, but I'm new to both moodle and php so the code might be flawed/sloppy.
@theopen-institute I just released a new version with this feature! We've been running it for a couple months so it should be good, but let me know if you run into anything.
I added a way to select which cohorts to sync - since we're using an automatic cohort plugin, we've got thousands of cohorts!
Would it be useful to be able to select Moodle cohorts to sync and add those cohorts/users to groups in Discourse?