Broken site image/icon
See attached screenshot. I don't have access to this site, but maybe there's an upload or file format issue keeping the icon from displaying? And maybe there's a way to recognize this and show one of Sara's placeholder icons instead? Here's the site:
#1 Updated by Raymond Hoh 5 months ago
When a site icon is uploaded, it is uploaded to that site's file space.
The issue here is that specific site is private and we have custom permissions for files uploaded to private sites, causing that site icon not to display (see #7997). We might have to mirror private site icons to the main site and add some custom code to BuddyPress in order for those site icons to display properly.
Boone, do you have any other suggestions?
#5 Updated by Raymond Hoh 5 months ago
- Category name set to BuddyPress (misc)
- Status changed from New to In Progress
- Assignee set to Raymond Hoh
- Target version set to 1.19.1
The "Sites Across CUNY" block is powered by the BuddyPress activity component. The query looks for public activity items that are either with the 'new_blog', 'new_blog_post', or 'new_blog_comment' type.
ccnyparasites site is private, however the related
'new_blog' activity item is public. #14223 addressed switching over the 'new_blog_post' and 'new_blog_comment' items to hidden, but not the 'new_blog' one. I've just added a fix for this here: https://github.com/cuny-academic-commons/cac/commit/634380add027bc14a86a72f2bca5f3627693b872.
I'm also running a query to fix all the older 'new_blog' activity items that are public, but need to be hidden.
Boone, this is the DB query I ran to determine the ones that need to be switched over:
SELECT a.id FROM wp_bp_activity a LEFT JOIN wp_blogs wb ON (a.item_id = wb.blog_id) WHERE a.type = 'new_blog' AND a.hide_sitewide = 0 AND a.primary_link like '%.commons.gc.cuny.edu%' AND wb.public < 1;
This returns 8748 'new_blog' activity items that need to be switched to hidden. Will update the ticket once the script is done.
#10 Updated by Raymond Hoh 5 months ago
Before closing this out, see screenshot for another broken site image I just noticed on the Site Directory, no placeholder image shown.
For this specific instance, the site is public and previously had a site icon. However, sometime later, an administrator removed the site icon manually from the Media Library and did not replace the site icon with another one. Currently, BuddyPress does not detect manual site icon removals from the Media Library. Thus, the corresponding site icon URL meta values that BuddyPress references were never removed. This results in the broken site icon image for the site.
The typical way to remove the site icon is via the Customizer and BuddyPress will detect site icon removals that way, so this is an edge-case.
Anyway, I've just added a fix to wipe out the
site_icon option value when a site icon is deleted from the Media Library. See https://github.com/cuny-academic-commons/cac/commit/c4d0cb85d5b930db0e6dffbee987f122196a9647. (After committing the fix, I found a related ticket on WordPress Trac about this issue: https://core.trac.wordpress.org/ticket/49086 .) I've also removed the site icon meta values manually for the
casd1643levy21 site, so we should be good to close this issue.