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: |
|
Owned by: |
|
|---|---|---|---|
| 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)
This ticket was mentioned in PR #426 on buddypress/buddypress by renatonascalves.
2 months ago
#2
- Keywords has-patch added; needs-patch removed
Trac ticket: https://buddypress.trac.wordpress.org/ticket/9311