Skip to:
Content

BuddyPress.org

Opened 2 months ago

Closed 2 months ago

#9311 closed enhancement (fixed)

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

Reported by: garyj's profile GaryJ Owned by: espellcaste's profile espellcaste
Milestone: 14.5.0 Priority: normal
Severity: normal Version:
Component: Media 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
2 months ago

  • Cc emaralive added

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


2 months ago
#2

  • Keywords has-patch added; needs-patch removed

#3 @espellcaste
2 months ago

  • Component changed from Core to Media
  • Milestone changed from Awaiting Review to 14.5.0

#4 @espellcaste
2 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
2 months ago

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

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.