Auto assign cohort (deprecated for local_cohortauto)

Maintained by Dan Marsden, Catalyst IT
This Authentication plugin automatically assigns users into cohorts based on information in their user profile fields.
Price option: Free

Supports Moodle 2.0-3.0 See all versions
Latest release: 10 years ago
Installations: 142
Downloads (last 90 days): 22

Frankenstyle name: auth_mcae
Authentication

Comments

Comments are no longer open for new posts. Existing comments remain available to read.

Fantastic plugin.
Hi, is there more documentation related this plugin?
Hello,
Thanks a lot Andrew for this new release with the improvement I need.
It is exactly what I want and it works great !
Kevin
Very great Plugin !
It's exactly what I need to create cohort corresponding to groups that exist in a shibboleth attributes that I receipt.
I just need 1 improvement if it's possible :
The field I request contain multi-values, separate by a ";" (in exemple "gs2;GIPAD-GS2", or "gs2;AII-GS2")
Is it possible to split this cohort in 2 or more cohorts, defining by a separator parameter (in my case ";" to obtain 3 cohorts ("gs2", "GIPAD-GS2" and "AII-GS2") rather than 2 ("gs2;GIPAD-GS2" and "gs2;AII-GS2")) ?
Thanks a lot for this plugin.
Kevin
I cannot understand the instructions. Could someone who has had success with this plugin provide their examples? I would like to help with the documentation, after I have a working example.
Can I use this to auto enrol a user to a cohort based on email domain? Or does it have to be a profile field ?
Hi Sam!
To enable autounenroll users:
1. Go to moodle/auth/mcae/convert.php page
2. Select cohorts you want and convert to "auth_mcae"
3. At the plugin configuration page check "Enable / Disable automatic unenrol" option.
If "Enable / Disable automatic unenrol" option enabled:
1. Manually created cohorts are managed by admin
2. Automatically created cohorts are managed by plugin
3. To view cohort members go to moodle/auth/mcae/view.php page
Great plugin indeed!!
However when change the value in the profile field based on which the autoenrol occurs, the user is nicely enrolled into the new cohort.
BUT!!
The user also stays enrolled in the previous cohort, thus the user is now enrolled in the "old" cohort and in the "new" cohort.
Would it be possible to add this to the plugin? Perhaps a setting where you can define is the plugin should or should not unenrol users when the profile fields are changed.
Highest regards,
Sam
FIXED: Changed line (36) in /auth/mcae/view.php to read
From:
$sql = "SELECT u.id AS uid, CONCAT(u.firstname, ' ', u.lastname) AS usrname FROM {cohort_members} AS cm JOIN {user} AS u ON u.id = cm.userid WHERE cm.cohortid = ? ORDER BY usrname";
TO:
$sql = "SELECT u.id AS uid, (u.firstname + ' ' + u.lastname) AS usrname FROM {cohort_members} AS cm JOIN {user} AS u ON u.id = cm.userid WHERE cm.cohortid = ? ORDER BY usrname";
Very nice plugin, but received error with 2.5 when selecting [Cohort Viewer] menu option
Error reading from database
More information about this error
Debug info: SQLState: 42000
Error Code: 195
Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]'CONCAT' is not a recognized built-in function name.
SELECT u.id AS uid, CONCAT(u.firstname, ' ', u.lastname) AS usrname FROM mdl_cohort_members AS cm JOIN mdl_user AS u ON u.id = cm.userid WHERE cm.cohortid = '0' ORDER BY usrname
[array (
0 => 0,
)]
Error code: dmlreadexception
Stack trace:
◦line 426 of \lib\dml\moodle_database.php: dml_read_exception thrown
◦line 260 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
◦line 367 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
◦line 779 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
◦line 827 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql()
◦line 37 of \auth\mcae\view.php: call to sqlsrv_native_moodle_database->get_records_sql()
Great plugin, very useful. I was able to use it with Moodle 2.4.1 but I have to add the line:
require_once($CFG->dirroot.'/user/profile/lib.php');
at the beginning of auth/mcae/auth.php as it was posted by Francis Vendrell. Thanks again
Hey Andrew - Just tested on 2.4 seems to be working for me! - only issue is that the 'cohort operations' & 'cohort viewer' links are displayed at the root of the settings menu would these be perhaps better placed within the autoenrol cohort settings or within users > accounts?
Really useful plugin though!
OK, took a wild guess and just added my AllUsers cohort to the first box and bingo - too easy - thanks
OK, this looks exactly what I need. I have a cohort called AllUsers and want all users automagically added to it when they register with Moodle.
But I am confused as to what goes in the various fields. So to achieve this what values would I use - no issue in deleting that cohort as it has no users yet anyway if that is needed.
Is this plugin available for Moodle 2.4?
Thanks