Deleted course students remain in course groups?!

Deleted course students remain in course groups?!

by Gisela Hillenbrand -
Number of replies: 9
Picture of Documentation writers
Hi,

I am using Moodle 1.8.2.
I have a course, I am in the role of a teacher, a have students in my course and I have groups in the course with students in them.
Now I unenrol a student from my course (via admin block, I unassigned a student the student role). Now I don't see that student in the list of students of my course (this is what I expect). But if I look at the groups, that student is still a member of his (former) group. Is this a bug or a feature?
How can I ensure that in the groups view I see only course participants which have assigned a role in my course?

Gisela
Average of ratings: -
In reply to Gisela Hillenbrand

Re: Deleted course students remain in course groups?!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Gisela - Sounds like a bug to me - when the student is removed from the course, I think he should be removed from any groups in that course. This may not be the case as groups lose their connection with courses (actually it may not be the case now as I forget the details of how groups were changed in 1.8). I will verify the behavior on my install and then file something in the tracker if it does not already exist. Peace - Anthony
In reply to Gisela Hillenbrand

Re: Deleted course students remain in course groups?!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Gisela - I just tried unenroling a student and the student was removed from the group. I am not able to reproduce this behavior with 1.8.2+. It is somewhat related to MDL-8059. Peace - Anthony
In reply to Anthony Borrow

Re: Deleted course students remain in course groups?!

by Gisela Hillenbrand -
Picture of Documentation writers
Hi Anthony,

>>I just tried unenroling a student and the student was removed from the group

With which version you did this?

>>I am not able to reproduce this behavior with 1.8.2+.

Did I understand it right: it is a bug in Moodle 1.8.2?

Best regards, Gisela
In reply to Gisela Hillenbrand

Re: Deleted course students remain in course groups?!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Gisela - I am not seeing this behavior in 1.8.2+ (2007021520) so I cannot confirm that it is a bug. Are others seeing this behavior? Peace - Anthony
In reply to Anthony Borrow

Re: Deleted course students remain in course groups?!

by Gisela Hillenbrand -
Picture of Documentation writers
Hi Anthony,

I have now tested this intensively and found out the following:
the test user is enrolled in the course (himself or by trainer assigning him the student role) and enrolled in the group (by the trainer using the groups link in the courses administration block) and then unenrolled (himself or by the trainer unassining him the student role or by the trainer using the unenrol button in the users profil) - I tested all combinations.
Result:
if that test user is an ordinary student with no sitewide rights then everything is ok, i.e. after unenrolling the test user from the course he does not appear in the participants list (via participants block) and he does not appear in the group member list (via groups link in the courses administration block).
But if that test user is in the role of a coursecreator in the site context (i.e. has the global role coursecreator) then after unenrolling him from the course then he does not appear in the participants list (via participants block) but he does appear in the group member list (via groups link in the courses administration block).
So maybe I have to adapt some role/capability settings?

Best regards,
Gisela
In reply to Gisela Hillenbrand

Re: Deleted course students remain in course groups?!

by Gisela Hillenbrand -
Picture of Documentation writers
Hi Anthony,

now I looked at the code and found the following: In the script lib/accesslib.php there is the function role_unassign(). In the foreach ($ras as $ra) - loop almost at the end there is code to remove from groups when user has no role.
That explains the behaviour I described in the previous post: if the test user is a sitewide coursecreator when the trainer unassigns him the student role he still has the coursecreator role in the course (inheritance from site context) and therefore is not removed from the group!
Again my question: is this now a bug or a feature?
Maybe the code fragment

//remove from groups when user has no role
$roles = get_user_roles($context, $ra->userid, true);

should be replaced by

//remove from groups when user has no role
$roles = get_user_roles($context, $ra->userid, false);

i.e. you check whether the user has any role in the exact context.

Sorry for making you so much trouble!

Gisela
In reply to Gisela Hillenbrand

Re: Deleted course students remain in course groups?!

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Gisela - Thanks for good work at detailing how to reproduce the behavior you are observing. It does sound like a bug to me. Could you file an issue in the tracker and reference this forum discussion. Thanks - Anthony
In reply to Anthony Borrow

Re: Deleted course students remain in course groups?!

by Andy Tagliani -
Hi Gisela, hi Anthony,

please let me first tell a question to Gisela in German:
Gisela,
hast du dem testuser nur im Kurs der Rolle Teilnehmer zugewiesen oder auch schon zuvor in dem Kursbereich?

Angenommen du hast einen Kursbereich der nennt sich Allgemein und dort einen Kurs der nennt sich Test. Hast du bereits wenn du den Kursbereich Allgemein anklickst dort schon Rollen an die User vergeben oder nur im Kurs Allgemein? Ich glaube (eigentlich bin ich mir sicher) das dies der Fall ist (du hast im Kursbereich bereits die Rolle vergeben) und dabei dieses Problem auftritt!

Viele Grüße
Andy

Now in english:
Anthony,
this problem (this is my meaning) comes up, when a admin create a role not only in a course. If he create a category role and a role in a course in this category, the user will already exist in a group! This is the reason, why i tell the admins, dont crate category role, create the roles of the user in the courses. Can you confirm?

Andy


In reply to Andy Tagliani

Re: Deleted course students remain in course groups?!

by Gisela Hillenbrand -
Picture of Documentation writers
Hi Andy and Anthony,

I try to explain it shortly in english.

The test user who caused the problem described above is a course creator in site context. This is the case because we use LDAP authentification, and this test user belongs to the LDAP group of creators configured in the LDAP configuration settings (in our university all professors belong to that LDAP group and get course creator rights when authentifying themselves).

I cannot change this authentification method - it is set by our university administration.

I agree with Anthony that it seems to be a bug. I try to put it in the bug tracker (I have never done this before, hope I manage this wink

Best regards

Gisela