Feature #10987: Site/group creation portal
Create Course objects when site/group Primary Purpose is set to Teaching
This should be pretty straightforward, but there will be some internal logic related to duplicate checks and priorities:
- When editing an existing group/site and changing the primary purpose to Teaching, a Course should be created
- When creating a new group/site and setting the primary purpose to Teaching, a Course should be created
- When editing an existing group/site and changing the primary purpose from Teaching to something else, change the Course so that it's in Draft status (or Private or something similar)
- If a group + site have mismatched Primary Purpose (not sure how this would happen?), err on the side of creating a Course. If there's conflicting metadata in the group and in the site, prefer that from the group
- "Instructor" field on Course will be filled with group/site creator for new groups/sites. For existing, I guess we'll harvest all the admins of the group and/or site.
#1 Updated by Boone Gorges about 2 months ago
- Status changed from New to In Progress
I've made a first pass at adding this functionality for groups. It's turning out to be more complex than I'd hoped. The Courses tool hadn't been designed so that courses could be spun up programatically; I added most of this functionality in https://github.com/cuny-academic-commons/cac-courses/commit/7a53012282c2e2d74275123c96dbeeb4e201d0a4. I then added the hook to create Course objects when switching a group to 'teaching' in https://github.com/cuny-academic-commons/cac/commit/6309d33d251efa248fdde5a647c495409842fdd7
Building for sites has an added layer of complexity: the cac-courses plugin is not network-activated. I think it'll be possible to use the WP REST API to create the cac_course posts, but this will take some extra logic (particularly in terms of authentication). I'll work on this in the upcoming days.
#2 Updated by Boone Gorges about 2 months ago
- Status changed from In Progress to Resolved
I started building the Site version using the REST API, but it was stupidly complex - server-to-server authentication in particular was a mountain I didn't want to climb. Instead, I went for the ugly but easier-to-achieve switch_to_blog() in https://github.com/cuny-academic-commons/cac/commit/eb387cee6be26202a977a42976e5304768aba2df
#3 Updated by Boone Gorges about 2 months ago
https://github.com/cuny-academic-commons/cac/commit/e0a072c1771c719b93380ef8d3644c9b1f0ae083 improves duplicate checks during the group+site creation process
#4 Updated by Boone Gorges about 2 months ago
https://github.com/cuny-academic-commons/cac/commit/9520304eba4df14b0d665c6dff9385975256f76e fixes a problem where the Course created during initial group creation wasn't properly associated with the corresponding Site during Add Site.