Toggle for Public Sites in Course Directory
Adding this ticket following up the commons meeting today. Would it be possible to add a toggle to the search filter in the courses directory to allow users to filter and view only public groups and sites?
Do we want to think about the placement/function of this "view public courses" toggle along site the possible addition of an OER metadata tag and toggle?
#2 Updated by Sonja Leix 8 months ago
Boone Gorges wrote:
Adding Sonja to get her brief thoughts.
Sorry for the late response to this. I took a look and since this is a toggle vs. the various drop down menus we have in our filter UI, I'd recommend to add a simple check box below the line of filters to toggle this feature on/off. It could read something like "Show public courses only"
#4 Updated by Sonja Leix 8 months ago
Laurie Hurson wrote:
Thanks for your insight Sonja. This sounds like a good plan to me.
Would the check box be located in the gray filter box or below where the number of sites are listed? I think within the gray filter box might be more obvious.
Yes agreed, they should be part of the grey filter box. I suggest in the line below the other filters.
#5 Updated by Boone Gorges 8 months ago
- File Screenshot_2021-05-25_15-58-05.png Screenshot_2021-05-25_15-58-05.png added
- File Screenshot_2021-05-25_15-51-52.png Screenshot_2021-05-25_15-51-52.png added
- Target version set to 1.19.0
Thanks all. Agreed that a simple checkbox is fine.
I mocked up putting it in a second line. IMO it becomes confusing - it seems like it's tied to the search box, and it's no longer clear that the 'Filter' and 'Reset' buttons apply to this input.
I tried a second version that involved moving the action buttons to the second row. It's not visually great but it retains the distinction between filters and action buttons.
It's also worth flagging here that my mockups in #14170 suggest making other changes to this filter interface (though perhaps not on the Courses directory) and we risk mucking up an interface that we worked hard to keep clean and easy to understand.
#6 Updated by Sonja Leix 8 months ago
Since the user has to click "filter" after they check the new "public sites" checkbox, it makes more sense to drop the action buttons below the filter options. We might want to add a 1px separator between the action buttons and the filter options so it's clear, see rough adjusted mockup attached.
#8 Updated by Boone Gorges 8 months ago
- Assignee set to Boone Gorges
- Target version set to 1.19.0
Thanks, Sonja. Breaking the action buttons into a separate line gives us more flexibility in general, since we'll have more screen real estate to deal with. I'll see what I can do about working up a prototype.
#10 Updated by Colin McDonald 4 months ago
I just wanted to bump this. Boone, did you end up working on a prototype? Is there anything else we can pass your way to help putting that together? We discussed on Friday that this ticket could be good to include in our regular package of release items related to teaching and course improvements.
#12 Updated by Boone Gorges 4 months ago
- File Screenshot_2021-10-05_10-29-19.png Screenshot_2021-10-05_10-29-19.png added
- File cac-fill-blog-public-courses.php cac-fill-blog-public-courses.php added
- Status changed from New to Testing Required
I've built a first pass at this, and it's ready for testing on cdev. A screenshot is also attached.
Fairly substantial changes were required to make this work. Here's a rundown, for posterity:
- Group 'status' and site 'blog_public' are stored in separate tables, in a way that could not be joined as part of the course query. As such, I needed to write routines to mirror these 'public' flags to postmeta, where I could use WP's meta_query.
- Some of the mirroring routines require a switch_to_blog(), because users can change their blog_public value while on the subsite. This means registering and unregistering certain taxonomies and post types on the fly, so that course queries work (WP doesn't handle this well natively; see https://core.trac.wordpress.org/ticket/20541)
- Because of the subsite issue, I also needed to change the plugin to be 'Network: true' so that it would detect blog_public changes on subsites. A side benefit of this change is that it's now possible to fix #14437, which I've done as part of my work here.
- I've written a CLI script to fill in the 'public' postmeta for existing courses, attached here. I'll need to run this after the release.
#14 Updated by Colin McDonald 4 months ago
Thanks Boone, I checked it out on cdev and it worked well for me. One simple thing, sorry if it's come up before, but when I searched "english" the first result is "scott test group creation" and it has a public group and private site. After hitting the public courses only filter, that result is still there. Is that expected behavior, that we'd rather show the public group even if it has a private site? Makes sense to not hide both altogether?
#20 Updated by Colin McDonald about 1 month ago
I tried changing privacy settings for a group and a group+site, and this worked as intended. If changed to private, the result disappeared when Public Only was checked. But for this site:
When I changed, it seemed to go private but not disappear from the results when the box is checked. See screenshot.
#21 Updated by Boone Gorges about 1 month ago
Thanks, Colin. This is a bug related to the fact that you were changing the visibility on the site's Dashboard. The metadata saving routine wasn't configured to run on options-reading.php.
I fixed this, but then found that there was an odd problem with advanced-post-cache. The Course was still showing up even after the has-public-group-or-site postmeta was deleted. It could be that this is a core bug, or a bug in advanced-post-cache. I couldn't figure it out so I just excluded cac_course from advanced-post-cache altogether.
#22 Updated by Colin McDonald about 1 month ago
- File 1-screenshot.png 1-screenshot.png added
- File 2-screenshot.png 2-screenshot.png added
- File 3-screenshot.png 3-screenshot.png added
Hi Boone, I just set up a new public site that was NOT a teaching site, just a simple public site, "colin site to delete" at this URL added to hosts file:
Then I went in and changed it to Teaching and it showed up in the Courses directory as in 1-screenshot attached. Then I changed it to private, and it still appeared with Show Public checked at the top of Newly Created, except with no links or other data as in 2-screenshot attached. Then I toggled back and see two different results, as in 3-screenshot attached.
#23 Updated by Boone Gorges about 1 month ago
Colin - Somehow, your test site got associated with more than one Course object in the database. Once I deleted the duplicates, the problem no longer occurs.
I don't see how the duplicates occurred in the first place. If you manage to reproduce it, please take very careful note of the specific things you're doing, and share these notes with me. For example, it's critically important that I know exactly where you're going to toggle privacy changes, and what you're changing them from/to.
#24 Updated by Colin McDonald about 1 month ago
Hi Boone, I was able to reproduce it this way, as detailed as I think I can describe:
- Created fresh new public site "delete later colin" via creation portal, campus Brooklyn and purpose Conference.
- In Settings > General, changed Purpose to Teaching, Term to Spring 2022, cluster to STEM. OER box is unchecked.
- The site now showed up in Courses as in attached 1-courses screenshot. Not sure if it should have had instructor or other lines within the item box.
- In Settings > Reading for the site, changed Site Visibility from Allow search engines... to I would like... users I add to it. Then refresh Courses, sorted by Newly Added, and two items appear as in 2-courses screenshot attached.
Left it like that for now in case you wanted to examine. Didn't want to try toggling back or complicating the sequence more.
#27 Updated by Boone Gorges 15 days ago
- Status changed from Testing Required to Resolved
I've run the migration script, and public courses are now showing up in the Courses directory: https://commons.gc.cuny.edu/courses/?filters%5Bkeyword%5D=&filters%5Bpublic%5D=on&order-by=semester