Student as Default role is not available in cohort Sync

Student as Default role is not available in cohort Sync

by Christophe Coussement -
Number of replies: 4

Hi Community,

I took the Admin of a Moodle over for a new client. But they are not able to enrol students within cohorts with the "student" status.

When checking Site administration > Plugins > Enrolments > Cohort sync, "student" (Etudiant in French) is not even between the available choices.


Any pointer about how to modify this ?

TIA,

Christophe

Average of ratings: -
In reply to Christophe Coussement

Re: Student as Default role is not available in cohort Sync

by Joost Elshoff -
Picture of Particularly helpful Moodlers Picture of Testers
Interesting issue you have there. Could you check if the Student role exists in any way in Site admin > Users > Permissions > Define roles? The error message (current value invalid: 5) in the yellow box suggests the role is missing from the system, as the core student role has '5' as its role identifier in the database.

Only way you could correct that, is by recreating or importing the student role as XML file. Or do a system restore...
In reply to Joost Elshoff

Re: Student as Default role is not available in cohort Sync

by Christophe Coussement -
Interesting idea you had. But Student rol with id 5 exists (Etudiant in French), as show on this screen copy :



Anyway, thanks for the suggestion !
In reply to Joost Elshoff

Re: Student as Default role is not available in cohort Sync

by Christophe Coussement -
Wel, it didn't take long...

Your suggestion made me search for an error within the student profile, rather than a cohort one. And, guess what... one of the user of the client's website deselected all in the "Context types where this role may be assigned" - "Cours" and "Module d'activité" should be marked...



I could reproduce the error on a clean Moodle site... SOLVED wink
Average of ratings: Useful (2)
In reply to Joost Elshoff

Re: Student as Default role is not available in cohort Sync

by Christophe Coussement -
To be complete, the error was somewhat deeper.

The database was corrupted : id field in mdl_role_context_levels was not set on autoincrement, which triggered the error saying "Field 'id' doesn't have a default value".

Allowing autoincrement again fixed the problem.