Improvements to the way that Course "Instructor" field is populated and managed
Currently, the "Instructor" field for courses is always populated with the information of the user who creates the course. In some cases, this results in unwanted behavior. See eg #14051.
Following up on the conversation in #14051, I propose the following changes:
1. By default, populate the list of 'instructor-ids' for a Course with the combined list of Administrators for the linked site and admins for the linked group. When a Course site/group is first created, this list will contain only the ID of the user creating the Course. But when additional users are added to or subtracted from the list of group/site admins, the instructor-ids list will be modified accordingly.
2. Introduce a new section to the existing Teaching-specific metadata fields in the group and site admin areas ("Academic Term", "Disciplinary Clusters"), called "Course Instructors". This area will have a list of checkboxes, corresponding to the combined list of group+site admins. By default, all of these boxes will be checked (see item 1 above). In this way, we limit the list of users who can be added as instructors to those with admin access to a Course asset.
3. If the admin unchecks one or more boxes and saves the changes, then two things happen. First, the 'instructor-ids' metadata on the Course object is changed to reflect the checked boxes. Second, a flag on the course object is set - something like 'instructors_manually_set'. When this flag is set, the automatic syncing of group-site admins to instructors (as described in item 1) is disabled.
4. Whenever a group or site has an admin removed, that user is removed from the list of 'instructor-ids', regardless of whether the 'instructors_manually_set' flag is set.
5. If a course goes to "manual" mode, and then later on, an admin re-checks all the available boxes (or the boxes are automatically checked because an eligible admin is no longer an admin; see 4), then the 'instructors_manually_set' flag is unset, and the instructor-administrator automatic sync is reenabled.
I realize that this sounds complicated, but I think that the end result for users will be pretty straightforward, and I think that this covers all the weird cases that can arise.
#2 Updated by Boone Gorges 5 months ago
- Assignee changed from Boone Gorges to Jeremy Felt
Jeremy, do you want to tackle this? You're familiar with the teaching-related "metadata" fields. The difference here is that we won't be introducing the interface during creation - only when editing an existing group or site.
Search cac-functions.php and bp-nelo for calls to
set_instructor_ids(). You'll have to do some manipulation here to break out the
$is_new case from the existing-site case, and build your own method for assembling a deduplicated list of the admins of the group+site (feel free to add something in cac-courses https://github.com/cuny-academic-commons/cac-courses/blob/master/src/Course.php if it makes the most sense).