Skip to:
Content

BuddyPress.org

Opened 9 months ago

Closed 9 months ago

#9311 closed enhancement (fixed)

Add pre-filter to bp_avatar_get_avatars_history() for custom storage backends

Reported by: GaryJ Owned by: espellcaste
Priority: normal Milestone: 14.5.0
Component: Media Version:
Severity: normal Keywords: has-patch
Cc: emaralive

Description

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 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():

$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.

Change History (5)

#1 @emaralive
9 months ago

  • Cc emaralive added

This ticket was mentioned in PR #426 on buddypress/buddypress by renatonascalves.


9 months ago
#2

  • Keywords has-patch added; needs-patch removed

#3 @espellcaste
9 months ago

  • Component CoreMedia
  • Milestone Awaiting Review14.5.0

#4 @espellcaste
9 months ago

In 14151:

Add pre-filter hook for avatar history.

Add bp_pre_avatar_get_avatars_history filter to allow short-circuiting avatar history retrieval.
Fix typo @parma to @param in bp_core_avatar_handle_upload docblock.

Props GaryJ.

See #9311 (14.0)

#5 @espellcaste
9 months ago

  • Owner set to espellcaste
  • Resolutionfixed
  • Status newclosed

In 14152:

Add pre-filter hook for avatar history.

Add bp_pre_avatar_get_avatars_history filter to allow short-circuiting avatar history retrieval.
Fix typo @parma to @param in bp_core_avatar_handle_upload docblock.

Props GaryJ.

Closes https://github.com/buddypress/buddypress/pull/426/
Fixes #9311 (trunk)

Note: See TracTickets for help on using tickets.