[buddypress-trac] [BuddyPress Trac] #9311: Add pre-filter to bp_avatar_get_avatars_history() for custom storage backends

buddypress-trac noreply at wordpress.org
Tue Dec 16 09:44:19 UTC 2025


#9311: Add pre-filter to bp_avatar_get_avatars_history() for custom storage
backends
-------------------------+-----------------------------
 Reporter:  GaryJ        |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Core         |    Version:
 Severity:  normal       |   Keywords:  needs-patch
-------------------------+-----------------------------
 On hosting platforms like WordPress VIP, the filesystem uses a custom
 stream wrapper that doesn't support `FilesystemIterator` directory
 listing. This causes a fatal error when BuddyPress tries to enumerate
 avatar history.

 The [https://github.com/Automattic/buddypress-vip-go buddypress-vip-go]
 plugin handles avatar uploads by storing data in user meta. However,
 there's no way to provide avatar history from meta because
 `bp_avatar_get_avatars_history()` directly accesses the filesystem.

 Currently, the only workaround is `add_filter(
 'bp_disable_avatar_history', '__return_true' )` which removes the Recycle
 feature entirely.

 == Proposed Change ==

 Add a pre-filter to `bp_avatar_get_avatars_history()`:

   {{{#!php
   $pre_history = apply_filters( 'bp_pre_avatar_get_avatars_history', null,
 $item_id, $object, $type );
   if ( null !== $pre_history ) {
       return $pre_history;
   }
   }}}

 This follows the same pattern as `bp_core_pre_avatar_handle_upload` and
 `bp_attachments_pre_get_attachment`.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/9311>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list