Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
mehedi-bb committed Aug 14, 2024
2 parents 8ba67cd + 6cd17a2 commit fb0b244
Show file tree
Hide file tree
Showing 15 changed files with 329 additions and 242 deletions.
2 changes: 1 addition & 1 deletion bp-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: The BuddyBoss Platform adds community features to WordPress. Member Profiles, Activity Feeds, Direct Messaging, Notifications, and more!
* Author: BuddyBoss
* Author URI: https://buddyboss.com/
* Version: 2.6.71
* Version: 2.6.72
* Text Domain: buddyboss
* Domain Path: /bp-languages/
* License: GPLv2 or later (license.txt)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
},
"license": "GPL-2.0-or-later",
"version": "3.1.0",
"BBVersion": "2.6.71"
"BBVersion": "2.6.72"
}
14 changes: 13 additions & 1 deletion src/bp-document/bp-document-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,13 @@ function bp_document_add_handler( $documents = array(), $privacy = 'public', $co

$bp_document = new BP_Document( $document['document_id'] );

if ( ! empty( $bp_document->id ) ) {
if (
! empty( $bp_document->id ) &&
(
bp_loggedin_user_id() === $bp_document->user_id ||
bp_current_user_can( 'bp_moderate' )
)
) {

if ( bp_is_active( 'activity' ) ) {
$obj_activity = new BP_Activity_Activity( $bp_document->activity_id );
Expand Down Expand Up @@ -646,6 +652,12 @@ function bp_document_add_handler( $documents = array(), $privacy = 'public', $co
}
}
} else {

// Check if a document is already saved.
if ( get_post_meta( $document['id'], 'bp_document_id', true ) ) {
continue;
}

$file = get_attached_file( $document['id'] );
$file_type = wp_check_filetype( $file );
$file_name = basename( $file );
Expand Down
4 changes: 2 additions & 2 deletions src/bp-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: The BuddyBoss Platform adds community features to WordPress. Member Profiles, Activity Feeds, Direct Messaging, Notifications, and more!
* Author: BuddyBoss
* Author URI: https://buddyboss.com/
* Version: 2.6.71
* Version: 2.6.72
* Text Domain: buddyboss
* Domain Path: /languages/
* License: GPLv2 or later (license.txt)
Expand All @@ -24,7 +24,7 @@
}

if ( ! defined( 'BP_PLATFORM_VERSION' ) ) {
define( 'BP_PLATFORM_VERSION', '2.6.71' );
define( 'BP_PLATFORM_VERSION', '2.6.72' );
}

if ( ! defined( 'BP_PLATFORM_API' ) ) {
Expand Down
16 changes: 14 additions & 2 deletions src/bp-media/bp-media-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ function bp_media_add( $args = '' ) {
function bp_media_add_handler( $medias = array(), $privacy = 'public', $content = '', $group_id = false, $album_id = false ) {
global $bp_media_upload_count, $bp_media_upload_activity_content;
$media_ids = array();
$media_id = 0;

$privacy = in_array( $privacy, array_keys( bp_media_get_visibility_levels() ) ) ? $privacy : 'public';

Expand All @@ -589,11 +590,17 @@ function bp_media_add_handler( $medias = array(), $privacy = 'public', $content
// save media.
foreach ( $medias as $media ) {

// Update media if existing
// Update media if existing.
if ( ! empty( $media['media_id'] ) ) {
$bp_media = new BP_Media( $media['media_id'] );

if ( ! empty( $bp_media->id ) ) {
if (
! empty( $bp_media->id ) &&
(
bp_loggedin_user_id() === $bp_media->user_id ||
bp_current_user_can( 'bp_moderate' )
)
) {

if ( bp_is_active( 'activity' ) ) {
$obj_activity = new BP_Activity_Activity( $bp_media->activity_id );
Expand All @@ -619,6 +626,11 @@ function bp_media_add_handler( $medias = array(), $privacy = 'public', $content
}
} else {

// Check if a media is already saved.
if ( get_post_meta( $media['id'], 'bp_media_id', true ) ) {
continue;
}

$media_id = bp_media_add(
array(
'attachment_id' => $media['id'],
Expand Down
9 changes: 9 additions & 0 deletions src/bp-templates/bp-nouveau/includes/document/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,15 @@ function bp_nouveau_ajax_document_document_save() {
ob_end_clean();
}

// Check if the document is empty return error.
if ( empty( $document ) ) {
$response['feedback'] = sprintf(
'<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>',
esc_html__( 'There was a problem when trying to save the document.', 'buddyboss' )
);
wp_send_json_error( $response );
}

wp_send_json_success( array( 'document' => $document ) );
}

Expand Down
8 changes: 8 additions & 0 deletions src/bp-templates/bp-nouveau/includes/media/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ function bp_nouveau_ajax_media_save() {
ob_end_clean();
}

if ( empty( $media ) ) {
$response['feedback'] = sprintf(
'<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>',
esc_html__( 'There was a problem saving media.', 'buddyboss' )
);
wp_send_json_error( $response );
}

$media_personal_count = 0;
$media_group_count = 0;
$media_all_count = 0;
Expand Down
8 changes: 8 additions & 0 deletions src/bp-templates/bp-nouveau/includes/video/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ function bp_nouveau_ajax_video_save() {
ob_end_clean();
}

if ( empty( $video ) ) {
$response['feedback'] = sprintf(
'<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>',
esc_html__( 'There was a problem saving video.', 'buddyboss' )
);
wp_send_json_error( $response );
}

$video_personal_count = 0;
$video_group_count = 0;
$video_all_count = 0;
Expand Down
21 changes: 16 additions & 5 deletions src/bp-video/bp-video-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ function bp_video_add( $args = '' ) {
function bp_video_add_handler( $videos = array(), $privacy = 'public', $content = '', $group_id = false, $album_id = false ) {
global $bp_video_upload_count, $bp_video_upload_activity_content;
$video_ids = array();
$video_id = 0;

$privacy = in_array( $privacy, array_keys( bp_video_get_visibility_levels() ), true ) ? $privacy : 'public';

Expand All @@ -707,14 +708,20 @@ function bp_video_add_handler( $videos = array(), $privacy = 'public', $content
// update the content of videos for later use.
$bp_video_upload_activity_content = $content;

// save video.
// save video.
foreach ( $videos as $video ) {

// Update video if existing.
if ( ! empty( $video['video_id'] ) ) {
$bp_video = new BP_Video( $video['video_id'] );

if ( ! empty( $bp_video->id ) ) {
if (
! empty( $bp_video->id ) &&
(
bp_loggedin_user_id() === $bp_video->user_id ||
bp_current_user_can( 'bp_moderate' )
)
) {

if ( bp_is_active( 'activity' ) ) {
$obj_activity = new BP_Activity_Activity( $bp_video->activity_id );
Expand All @@ -740,6 +747,11 @@ function bp_video_add_handler( $videos = array(), $privacy = 'public', $content
}
} else {

// Check if a video is already saved.
if ( get_post_meta( $video['id'], 'bp_video_id', true ) ) {
continue;
}

$video_id = bp_video_add(
array(
'attachment_id' => $video['id'],
Expand All @@ -766,7 +778,6 @@ function bp_video_add_handler( $videos = array(), $privacy = 'public', $content
if ( $video_id ) {
$video_ids[] = $video_id;
}

}
}

Expand Down Expand Up @@ -4188,7 +4199,7 @@ function bb_video_check_is_ffprobe_binary() {
class_exists( 'BuddyBossPlatform\FFMpeg\FFMpeg' ) ||
class_exists( 'FFMpeg\FFMpeg' )
) &&
(
(
class_exists( 'BuddyBossPlatform\FFMpeg\FFProbe' ) ||
class_exists( 'FFMpeg\FFProbe' )
)
Expand Down Expand Up @@ -4628,7 +4639,7 @@ function bb_video_get_activity_video( $activity = '', $args = array() ) {
&& in_array( $activity->type, array( 'bbp_forum_create', 'bbp_topic_create', 'bbp_reply_create' ), true )
&& bp_is_forums_video_support_enabled()
) {
$is_forum_activity = true;
$is_forum_activity = true;
$video_args['privacy'][] = 'forums';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,10 @@ public function get_profile_field_rendered_value( $value = '', $profile_field =
// Reset the global before returning the value.
$field = $reset_global;

if ( 'textarea' === $profile_field->type ) {
return $value;
}

return wp_specialchars_decode( $value );
}

Expand Down Expand Up @@ -1110,6 +1114,10 @@ public function get_profile_field_raw_value( $value = '', $profile_field = null
}
}

if ( 'textarea' === $profile_field->type ) {
return $value;
}

return wp_specialchars_decode( $value );
}

Expand Down Expand Up @@ -1141,7 +1149,11 @@ public function get_profile_field_unserialized_value( $value = '', $profile_fiel

$unserialized_value = maybe_unserialize( $value );
if ( ! is_array( $unserialized_value ) ) {
$unserialized_value = (array) wp_specialchars_decode( $unserialized_value, ENT_QUOTES );
if ( 'textarea' === $profile_field->type ) {
$unserialized_value = (array) $unserialized_value;
} else {
$unserialized_value = (array) wp_specialchars_decode( $unserialized_value, ENT_QUOTES );
}
} elseif ( ! empty( $unserialized_value ) && is_array( $unserialized_value ) ) {
foreach ( $unserialized_value as $k => $v ) {
$unserialized_value[ $k ] = wp_specialchars_decode( $v, ENT_QUOTES );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function update_items( $request ) {
unset( $value[ $key ] );
}
}

if ( ! empty( $value ) ) {
xprofile_set_field_data( $field_id, $user_id, $value, $field->is_required );
}
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/api_project.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define({
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2024-07-09T06:24:56.176Z",
"time": "2024-08-14T13:52:51.464Z",
"url": "http://apidocjs.com",
"version": "0.22.1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/api_project.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2024-07-09T06:24:56.176Z",
"time": "2024-08-14T13:52:51.464Z",
"url": "http://apidocjs.com",
"version": "0.22.1"
}
Expand Down
Loading

0 comments on commit fb0b244

Please sign in to comment.