Opened 3 years ago
Closed 3 years ago
#8617 closed enhancement (fixed)
Allow disabling avatar revisions in BuddyPress
Reported by: | sbrajesh | Owned by: | imath |
---|---|---|---|
Milestone: | 10.0.0 | Priority: | highest |
Severity: | blocker | Version: | |
Component: | Core | Keywords: | commit |
Cc: | sbrajesh |
Description
Hi,
BuddyPress 10.0 introduces the features for avatar revisions and recycling. There is no option to turn this off currently.
There are webmasters who don't need this enabled(I have been requested on our forums about the same). Is it possible to add a filter for the same.
The following patch adds an filter where this feature is left enabled by default but can be disabled for individual types(user, group) or individual objects.
It may be a good idea to add this test to other places. The patch works on the assumption that if there is no prior attachment version(that will be true for a new install), the recycle ui will not be visible. This is a shortcut and there may be a better implementation which takes in account the actual recycle UI(irrespective of avatar history).
Attachments (2)
Change History (10)
#1
@
3 years ago
- Keywords dev-feedback added
- Milestone changed from Awaiting Review to 10.0.0
- Priority changed from normal to highest
- Severity changed from normal to blocker
#2
@
3 years ago
Hi @imath
Thank you for taking a look promptly.
I did realize that this approach is not suitable if there are previously uploaded avatars. Activity is not the only problem, it causes issue with cropping/setting avatar too.
Looking at the possible solutions and sorry about the last minute reporting.
#3
@
3 years ago
Hi @sbrajesh
Rereading my previous comment, I hope you didn't take this part personally
So first thing is to think a bit more about it!
It was me talking to myself 😅.
Then, I've tried to build 8617.patch according to the discussion we had about it in slack today.
- Disabling the avatar history can be done using:
add_filter( 'bp_disable_avatar_history', '__return_true' );
In this case, instead of saving a new revision of the avatar, it's simply deleted. Meaning there's only one avatar available for the user: the latest. new_avatar
activities are always using the latest avatar (FYI when avatar history is enabled, it displays the avatar that was in use when the activity was posted).
- Disabling richer logging activities can be done using:
add_filter( 'bp_activity_get_types_supporting_generated_content', '__return_empty_array' );
I personally think, we should also make it possible for plugins to disable this feature using a filter even if it's possible to do it using template overrides (which is easier to do when working from a theme). To disable one of the richer logging activity, instead of returning an empty array, you need to use a callback to return the list of allowed activity type names.
To build this I've tried to think about how could evolve activity types feature (I got inspired by the get_post_types_by_support()
function). Imho, the $bp->activity->actions
global should include a feature property and we should make it possible to register activity types features a bit like WordPress does it for post types. We can probably achieve the WIP function _bp_activity_get_types_by_support()
in a future version of BuddyPress.
How do the team feel about this suggestion?
#4
@
3 years ago
Hi @imath
Thank you.
I am sorry, I did not think there was any issue with your reply. Instead, I wish I could have devoted a bit more time on it and assisted you better.
You have been driving the recent BuddyPress development in a great way and I sincerely appreciate that.
Thank you for the patch. It does work. My suggestion will be to use positive filter( e.g. bp_enable_avatar_history and return true by default). Also, it will make much more sense if you passed the object(user|group) and item id. That will keep it flexible for future.
Just my thoughts :)
#5
@
3 years ago
Hi @imath,
I've just tested the patch, It looks good to me. I am just not sure about storing old new_avatar
activity records when avatar history is disabled. It feels weird seeing the same avatar (the latest one) in all new_avatar
activities.
Your suggestion sounds absolutely great to me. I would like to have this feature in BuddyPress.
Hi @sbrajesh
Thanks for your feedback & patch. I believe we need more than just a filter at the place you put it as this feature has been put in place to use the avatar inside the new_avatar activity.
So first thing is to think a bit more about it!
This is a blocker to 10.0.0 release that was scheduled for tomorrow.