Opened 5 years ago
Closed 4 years 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
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:
- 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.)
- Use the site's
admin_email
option to decide on theadmin_user_id
. We could probably sync this toblogmeta
, and then join against that inBP_Blogs_Blog::get()
- Since
admin_email
to blogmeta and use it as the default avatar fallback, but leaveadmin_user_id
logic as-is. - 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)
Change History (25)
#2
@
5 years 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
@
5 years 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
@
5 years 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.
#6
@
4 years ago
- Keywords needs-patch added
@vapvarun could you design a nice default avatar for blogs?
#9
@
4 years 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.
#10
@
4 years 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
@
4 years ago
@imath zip contains all variation in the same pattern for the round corner I will update the final one with a square corner :)
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
4 years ago
#14
@
4 years 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
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:
- The blog's site icon if available.
- The Blog's admin avatar if
$args['admin_user_id']
is provided (just like into the BP REST API Blog avatars endpoint). - The mystery-blog image by default
Option b. looks fine to me. Another option could be to use a default avatar just like we’re doing for groups or users 😊