Skip to:

Opened 8 months ago

Last modified 4 weeks ago

#8179 new defect (bug)

Improved default value for site avatar

Reported by: boonebgorges Owned by:
Milestone: 7.0.0 Priority: normal
Severity: normal Version:
Component: Blogs Keywords: 2nd-opinion


Related: #192, #8150, #6544.

Since BP 2.7 [11150] the WP site icon (Customizer > Site Identity) is used as the site avatar in listings throughout BP (/sites/, /members/[member]/sites). This is cool.

When no site icon is available, the "admin_user_id" avatar is used. This is OK in theory, but the logic we use to decide this is pretty bad: ​,234#L219 We join against wp_bp_user_blogs to get a user_id, which is then assumed to be the admin user. The problem is that wp_bp_user_blogs contains one entry for each user of the site. The default logic of the JOIN means that the record with the lowest id is selected. Often this is OK. But (a) the site creator may no longer be a member of the specific site, in which case the lowest id will belong to a different (non-admin) user. Or (b) the site admin may have changed in some other way. Or (c) the site creator's account may have been deleted. Etc. When any of these happen, you get the avatar of a random site user.

A couple possible ways forward:

  1. Fall back on Gravatar instead, and never use a user avatar. (This is a big change - this behavior has always been a part of BP.)
  2. Use the site's admin_email option to decide on the admin_user_id. We could probably sync this to blogmeta, and then join against that in BP_Blogs_Blog::get()
  3. Since admin_email to blogmeta and use it as the default avatar fallback, but leave admin_user_id logic as-is.
  4. Something else I haven't thought of.

Option b seems like the safest, since this specific bug (avatar of the wrong user) could manifest itself in other ways if you're relying on admin_user_id to be correct.

Change History (5)

#1 @imath
8 months ago

Option b. looks fine to me. Another option could be to use a default avatar just like we’re doing for groups or users 😊

#2 @boonebgorges
8 months ago

Ah - @imath has maybe the best idea of all. This is the easiest to implement and most consistent with other components.

The historical reason for using the user avatar is that early BP assumed that user sites in a multisite network would be *blogs*, and would be in one-to-one correspondence with users. As it turns out, BP/MS aren't always or even usually used in this way. @johnjamesjacoby has shown interest through the years in remembering this part of the original idea of BuddyPress, so I wonder whether he has any objections to a blog-specific default avatar.

#3 @imath
5 months ago

  • Milestone changed from Awaiting Review to 6.0.0

As @espellcaste is working on Blogs component avatar for the BP REST API, I believe we should talk about this ticket during 6.0.0

#4 @imath
4 months ago

  • Milestone changed from 6.0.0 to Up Next

We're running out of time for 6.0.0. Let's progress about it in next milestone.

#5 @imath
4 weeks ago

  • Milestone changed from Up Next to 7.0.0
Note: See TracTickets for help on using tickets.