Skip to content

[C2] Fix count of courses in user role change #6461

Open
@ywarnier

Description

@ywarnier

In public/main/admin/user_edit.php (line 484) we check the number of courses of a user so as to have an idea whether this user is a teacher in those courses by using $userObj->getCourses()->count().

This is wrong, as it will return any course associated with the user through the course_rel_user table. That table has a "status" field that gives an idea wether the user is a teacher in there or not (status == 1).

Add a new method "getTaughtCourses()" in the User entity (or any other place where it would make sense) to get only the courses where the user is a teacher.

Linked to #5840 and corresponding PR #6244

Metadata

Metadata

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions