Skip to:
Content

BuddyPress.org

Opened 12 months ago

Closed 4 weeks ago

#8179 closed defect (bug) (fixed)

Improved default value for site avatar

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

Description

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: https://buddypress.trac.wordpress.org/browser/tags/5.0.0/src/bp-blogs/classes/class-bp-blogs-blog.php?marks=227,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.

Attachments (9)

Avatar 1.png (2.6 KB) - added by vapvarun 2 months ago.
Avatar Idea 1
Avatar 2.png (2.8 KB) - added by vapvarun 2 months ago.
Avatar Idea 2
12.png (9.4 KB) - added by vapvarun 2 months ago.
Blog Default 1
9.png (12.2 KB) - added by vapvarun 2 months ago.
Blog Default 2
blog-icons.zip (254.9 KB) - added by vapvarun 2 months ago.
all variation with background color
8179.patch (7.9 KB) - added by imath 4 weeks ago.
blog-red-icon.png (6.7 KB) - added by vapvarun 4 weeks ago.
blog BP red to match with default avatar color
blog-light-icon.png (6.7 KB) - added by vapvarun 4 weeks ago.
Blog Light v1
blog-light-icon-2.png (6.7 KB) - added by vapvarun 4 weeks ago.
Blog Light v2

Download all attachments as: .zip

Change History (25)

#1 @imath
12 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
12 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
9 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
8 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
5 months ago

  • Milestone changed from Up Next to 7.0.0

#6 @imath
2 months ago

  • Keywords needs-patch added

@vapvarun could you design a nice default avatar for blogs?

#7 @vapvarun
2 months ago

adding 2 design samples, color can be updated

@vapvarun
2 months ago

Avatar Idea 1

@vapvarun
2 months ago

Avatar Idea 2

#8 @johnjamesjacoby
2 months ago

Just saw this ping. 🙈 No objection from me. Change at will.

#9 @imath
2 months ago

Thanks for your feedback JJJ. @vapvarun what about a design more meaningful about the blog object. The 2 you shared are great but are more meaningful for the user object.

@vapvarun
2 months ago

Blog Default 1

@vapvarun
2 months ago

Blog Default 2

@vapvarun
2 months ago

all variation with background color

#10 @imath
2 months ago

Thanks a lot @vapvarun 😍 I like blog default 1, I’ll look into the zip, but I believe we should probably use grey for the background and white for the images/texts. To be consistent with group default avatar and our mysterious man for users, we should probably don’t use round corners 👌

#11 @vapvarun
2 months ago

@imath zip contains all variation in the same pattern for the round corner I will update the final one with a square corner :)

#12 @imath
2 months ago

Awesome ❤️

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


5 weeks ago

@imath
4 weeks ago

#14 @imath
4 weeks ago

  • Keywords has-patch added; needs-patch removed

8179.patch is my suggestion to fix this ticket during 7.0.0 milestone.

It adds a default avatar for blogs and use it if the blog do not have a site_icon and no admin_user_id was provided to the list of arguments of bp_blog_avatar(). It removes a filter that is deprecated since 1.5.

Here's a screenshot of the list of sites with the patch applied

https://cldup.com/UV6s4rDS21.png

If you wan to test the patch, you'll need to make sure to get the first 2 images from there and put them into the src/bp-core/images folder.

@vapvarun I've quickly made these images, but feel free to add an improved versions of them to the ticket 😉

If we commit this, the blog avatar will be:

  1. The blog's site icon if available.
  2. The Blog's admin avatar if $args['admin_user_id'] is provided (just like into the BP REST API Blog avatars endpoint).
  3. The mystery-blog image by default

@vapvarun
4 weeks ago

blog BP red to match with default avatar color

@vapvarun
4 weeks ago

Blog Light v1

@vapvarun
4 weeks ago

Blog Light v2

#15 @imath
4 weeks ago

Thanks @vapvarun for your new images. I'm afraid I might have brought some confusion. I need improved versions of these :

  • 150px x 150px

https://cldup.com/jGWVer38bx.png

  • 50px x 50px

https://cldup.com/bxg0pxFuft.png

:)

#16 @imath
4 weeks ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 12772:

Blogs: use a default "blavatar" when the blog has no site icon

So far when the Blogs component was not supporting the WordPress site icon feature or when the blog had no site icon set, we used to fallback on the Blog Administrator's avatar.

We realized this was a wrong approach, because:

  • 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.
  • The site admin may have changed in some other way.
  • The site creator's account may have been deleted.
  • Etc.

When any of these happen, you get the avatar of a random site user.

That's why just like we do for users or groups, we are now using a default blog avatar (mysterious-blog.png) as a fallback when the site icon for the blog is not available.

Props boonebgorges, vapvarun, johnjamesjacoby

Fixes #8179

Note: See TracTickets for help on using tickets.