Skip to content

Commit d8a05a4

Browse files
authored
Merge pull request #16 from Automattic/release/1.0.4
2 parents d290a0f + cdc2423 commit d8a05a4

File tree

5 files changed

+155
-27
lines changed

5 files changed

+155
-27
lines changed

.markdownlint.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"code-block-style": {
3+
"style": "fenced"
4+
},
5+
"code-fence-style": {
6+
"style": "consistent"
7+
},
8+
"emphasis-style": {
9+
"style": "underscore"
10+
},
11+
"extended-ascii": {
12+
"ascii-only": true
13+
},
14+
"fenced-code-language": {
15+
"allowed_languages": [
16+
"bash",
17+
"html",
18+
"javascript",
19+
"json",
20+
"markdown",
21+
"php",
22+
"text"
23+
],
24+
"language_only": true
25+
},
26+
"heading-style": {
27+
"style": "atx"
28+
},
29+
"hr-style": {
30+
"style": "---"
31+
},
32+
"line-length": {
33+
"line_length": 240,
34+
"strict": false,
35+
"code_blocks": false
36+
},
37+
"link-image-style": {
38+
"collapsed": false,
39+
"shortcut": true,
40+
"url_inline": false
41+
},
42+
"no-duplicate-heading": {
43+
"siblings_only": true
44+
},
45+
"ol-prefix": {
46+
"style": "ordered"
47+
},
48+
"reference-links-images": {
49+
"shortcut_syntax": true
50+
},
51+
"strong-style": {
52+
"style": "asterisk"
53+
},
54+
"ul-style": {
55+
"style": "dash"
56+
}
57+
}

CHANGELOG.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,52 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.4] - 2025-06-24
9+
10+
### Fixed
11+
12+
- Add cache flushing after video moves in album by @amitraj2203 in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/13>
13+
- Add support for group video uploads and override temp directory by @amitraj2203 in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/14>
14+
15+
### Changed
16+
17+
- docs: Improve README by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/12>
18+
- docs: Small amendments and Markdown linting by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/15>
19+
820
## [1.0.3] - 2025-05-06
921

1022
### Fixed
11-
- Pass extra data to xprofile_cover_image_uploaded hook by @GaryJones in https://github.com/Automattic/BuddyPress-VIP-Go/pull/9
23+
24+
- Pass extra data to xprofile_cover_image_uploaded hook by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/9>
1225

1326
## [1.0.2] - 2025-05-06
1427

1528
### Fixed
16-
- Use correct number of arguments in hook call by @GaryJones in https://github.com/Automattic/BuddyPress-VIP-Go/pull/6
29+
30+
- Use correct number of arguments in hook call by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/6>
1731

1832
## [1.0.1] - 2025-04-29
1933

2034
### Fixed
21-
- Cover image metadata fatal if groups component is not active by @GaryJones in https://github.com/Automattic/BuddyPress-VIP-Go/pull/1
35+
36+
- Cover image metadata fatal if groups component is not active by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/1>
2237

2338
### Changed
24-
- Improve documentation by @GaryJones in https://github.com/Automattic/BuddyPress-VIP-Go/pull/2
39+
40+
- Improve documentation by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/2>
2541

2642
## Maintenance
27-
- Add development files and update code standards by @GaryJones in https://github.com/Automattic/BuddyPress-VIP-Go/pull/3
28-
- Registered on Packagist: https://packagist.org/packages/automattic/buddypress-vip-go
43+
44+
- Add development files and update code standards by @GaryJones in <https://github.com/Automattic/BuddyPress-VIP-Go/pull/3>
45+
- Registered on Packagist: <https://packagist.org/packages/automattic/buddypress-vip-go>
2946

3047
## 1.0.0 - 2016-04-22
3148

3249
### Added
50+
3351
- Initial release of BuddyPress for VIP Go
3452

53+
[1.0.4]: https://github.com/automattic/buddypress-vip-go/compare/1.0.3...1.0.4
3554
[1.0.3]: https://github.com/automattic/buddypress-vip-go/compare/1.0.2...1.0.3
3655
[1.0.2]: https://github.com/automattic/buddypress-vip-go/compare/1.0.1...1.0.2
3756
[1.0.1]: https://github.com/automattic/buddypress-vip-go/compare/1.0.0...1.0.1

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
**Tags:** BuddyPress, BuddyBoss, WordPress VIP
55
**Requires at least:** 4.4.2
66
**Tested up to:** 6.8
7-
**Stable tag:** 1.0.3
7+
**Stable tag:** 1.0.4
88
**License:** GPLv2 or later
99
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -14,13 +14,37 @@ Makes BuddyPress' media work with WordPress VIP's hosting.
1414

1515
This plugin ensures BuddyPress media functionality works correctly on WordPress VIP's hosting environment by:
1616

17-
* Routing all media uploads through VIP's secure file system, bypassing WordPress's default upload directory
18-
* Implementing VIP's security model for file access control and permissions
19-
* Optimizing media delivery through VIP's CDN and caching infrastructure
20-
* Ensuring proper integration with VIP's file storage and retrieval services
17+
- Routing all media uploads through VIP's secure file system, bypassing WordPress's default upload directory
18+
- Implementing VIP's security model for file access control and permissions
19+
- Optimizing media delivery through VIP's CDN and caching infrastructure
20+
- Ensuring proper integration with VIP's file storage and retrieval services
2121

2222
The plugin is essential for any BuddyPress site running on WordPress VIP, as it ensures media uploads, avatars, and other BuddyPress media features work reliably and securely in the VIP environment.
2323

24+
### Implementation
25+
26+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Automattic/BuddyPress-VIP-Go)
27+
28+
Through the use of this plugin, profile and cover images are handled differently than the default.
29+
30+
Profile and cover images for users and groups are stored in user and group metadata.
31+
32+
- `vipbp-avatars` stores user avatars. It contains serialised data of four crop values, ui_width, URL, and filename keys.
33+
- `vipbp-user-cover` contains only a serialised URL key and value.
34+
- `vipbp-group-avatars` stores group avatars. It contains serialised data of four crop values, ui_width, URL, and filename keys.
35+
- `vipbp-group-cover` contains only a serialised URL key and value.
36+
37+
Webcam captures for user profiles are handled in the same way.
38+
39+
For cropping, instead of creating a new image, we store the cropping coordinates and later let the Files Service dynamically crop the image on-demand via Photon-like query parameters.
40+
41+
Deleting files is handled by deleting the meta data, and then calling `wp_delete_file()` with the previously stored URL.
42+
43+
### Additional Integrations
44+
45+
- Temporary directories created for group video uploads are cleaned up using WordPress's WP_Filesystem via a custom override. This ensures compatibility and security on VIP Go, replacing the default BuddyPress temp directory removal logic.
46+
- After a video is moved to a group album, the plugin flushes the BuddyPress media cache to ensure that any cached media data is immediately updated. This is handled automatically via a custom action hook.
47+
2448
## Installation
2549

2650
1. Upload the `buddypress-vip-go` folder to the `/wp-content/plugins/` directory

buddypress-vip-go.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @wordpress-plugin
1111
* Plugin Name: BuddyPress VIP Go
1212
* Description: Makes BuddyPress' media work with WordPress VIP's hosting.
13-
* Version: 1.0.3
13+
* Version: 1.0.4
1414
* Requires at least: 4.4.2
1515
* Requires PHP: 8.2
1616
* Author: Human Made, WordPress VIP

files.php

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,32 @@
1111
add_action(
1212
'bp_init',
1313
function () {
14-
/*
15-
* Tweaks for fetching avatars and cover images -- bp_core_fetch_avatar() and bp_attachments_get_attachment().
16-
*/
14+
// Tweaks for fetching avatars and cover images -- bp_core_fetch_avatar() and bp_attachments_get_attachment().
1715
add_filter( 'bp_core_avatar_folder_dir', '__return_empty_string' );
1816
add_filter( 'bp_core_fetch_avatar_no_grav', '__return_true' );
1917
add_filter( 'bp_core_default_avatar_user', 'vipbp_filter_user_avatar_urls', 10, 2 );
2018
add_filter( 'bp_core_default_avatar_group', 'vipbp_filter_group_avatar_urls', 10, 2 );
2119
add_filter( 'bp_attachments_pre_get_attachment', 'vipbp_filter_get_cover_image', 10, 2 );
2220

23-
/*
24-
* Tweaks for uploading user and group avatars -- bp_core_avatar_handle_upload().
25-
*/
21+
// Tweaks for uploading user and group avatars -- bp_core_avatar_handle_upload().
2622
add_filter( 'bp_core_pre_avatar_handle_upload', 'vipbp_handle_avatar_upload', 10, 3 );
2723
add_filter( 'bp_avatar_pre_handle_capture', 'vipbp_handle_avatar_capture', 10, 3 );
2824

29-
/*
30-
* Tweaks for uploading cover images -- bp_attachments_cover_image_ajax_upload().
31-
*/
25+
// Tweaks for uploading cover images -- bp_attachments_cover_image_ajax_upload().
3226
add_filter( 'bp_attachments_pre_cover_image_ajax_upload', 'vip_handle_cover_image_upload', 10, 4 );
3327

34-
/*
35-
* Tweaks for cropping user and group avatars -- bp_core_avatar_handle_crop().
36-
*/
28+
// Tweaks for cropping user and group avatars -- bp_core_avatar_handle_crop().
3729
add_filter( 'bp_core_pre_avatar_handle_crop', 'vipbp_handle_avatar_crop', 10, 2 );
3830

39-
/*
40-
* Tweaks for deleting avatars and cover images -- bp_core_delete_existing_avatar() and bp_attachments_delete_file().
41-
*/
31+
// Tweaks for deleting avatars and cover images -- bp_core_delete_existing_avatar() and bp_attachments_delete_file().
4232
add_filter( 'bp_core_pre_delete_existing_avatar', 'vipbp_delete_existing_avatar', 10, 2 );
4333
add_filter( 'bp_attachments_pre_delete_file', 'vipbp_delete_cover_image', 10, 2 );
34+
35+
// Tweaks for uploading videos into groups.
36+
add_filter( 'bp_core_pre_remove_temp_directory', 'vipbp_override_remove_temp_directory', 10, 3 );
37+
38+
// Tweaks for flushing the cache after moving a video.
39+
add_action( 'bp_video_after_save', 'vipbp_flush_cache_after_video_move', 99 );
4440
}
4541
);
4642

@@ -789,3 +785,35 @@ function vipbp_delete_cover_image( $_, $args ) {
789785

790786
return false;
791787
}
788+
789+
/**
790+
* Override bp_core_remove_temp_directory on VIP to use WP_Filesystem.
791+
*
792+
* @param bool $override Whether to override the default behavior.
793+
* @param string $directory The directory to remove.
794+
* @param string $image_name The name of the image file to delete.
795+
*
796+
* @return bool True if overridden on VIP, otherwise false.
797+
*/
798+
function vipbp_override_remove_temp_directory( $override, $directory, $image_name ) {
799+
$file_path = trailingslashit( $directory ) . $image_name . '.jpg';
800+
801+
if ( file_exists( $file_path ) ) {
802+
// Skip default directory deletion logic.
803+
wp_delete_file( $file_path );
804+
return true;
805+
}
806+
807+
// Continue with default behavior.
808+
return false;
809+
}
810+
811+
/**
812+
* Flush the media cache after a video has been moved to an album.
813+
*
814+
* This function resets the BuddyPress media incrementor to ensure that
815+
* any cached media data is invalidated after a video is moved.
816+
*/
817+
function vipbp_flush_cache_after_video_move() {
818+
bp_core_reset_incrementor( 'bp_media' );
819+
}

0 commit comments

Comments
 (0)