diff --git a/README.md b/README.md index 63f135eea..1aab7645b 100755 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ https://www.youtube.com/watch?v=dJrykKQGDcs ## Changelog ## -### 4.6.17 [December 28, 2023] ### +### 4.6.17 [January 2, 2024] ### * Enhancement @@ -163,6 +163,7 @@ https://www.youtube.com/watch?v=dJrykKQGDcs * Fixed PHP compatibility issue. * Fixed issues related to Twenty Twenty Four theme. + * Fix BuddyPress nouveau template issue. ### 4.6.16 [November 16, 2023] ### diff --git a/app/assets/js/rtMedia.activity.js b/app/assets/js/rtMedia.activity.js index 207ec90bd..0fea0c6dd 100644 --- a/app/assets/js/rtMedia.activity.js +++ b/app/assets/js/rtMedia.activity.js @@ -4,7 +4,7 @@ // Overwrite the inject function and apply mediaelement library player after adding activity. bp.Nouveau.inject = function( selector, content, method ) { - callback( selector, content, method ); + callback.bind(this)( selector, content, method ); if ( 'function' === typeof rtmedia_on_activity_add ) { rtmedia_on_activity_add(); diff --git a/app/assets/js/rtMedia.backbone.js b/app/assets/js/rtMedia.backbone.js index acd48e150..040f14324 100755 --- a/app/assets/js/rtMedia.backbone.js +++ b/app/assets/js/rtMedia.backbone.js @@ -1432,10 +1432,7 @@ jQuery( document ).ready( function( $ ) { * By: Yahil */ if ( '' === jQuery( '#whats-new' ).val().trim() ) { - if ( rtmedia_activity_text_with_attachment == 'disable' ) { - $( '#whats-new' ).css( 'color', 'transparent' ); - $( '#whats-new' ).val( ' ' ); - } else { + if ( rtmedia_activity_text_with_attachment != 'disable' ) { jQuery('#whats-new-form').prepend('

' + rtmedia_empty_activity_msg + '

') jQuery( '#whats-new' ).removeAttr( 'disabled' ); return false; @@ -1588,13 +1585,6 @@ jQuery( document ).ready( function( $ ) { * Blank error display issue resolved */ if ( bp_template_pack && 'legacy' !== bp_template_pack ) { - - if ( 'disable' === rtmedia_activity_text_with_attachment && '' === jQuery.trim( jQuery( '#whats-new' ).val() ) ) { - let textarea = jQuery( '#whats-new' ); - textarea.css( 'color', 'transparent' ); - textarea.val( ' ' ); - } - jQuery( '#whats-new-form' ).submit(); } else { jQuery( '#aw-whats-new-submit' ).click(); @@ -1692,10 +1682,7 @@ jQuery( document ).ready( function( $ ) { * By: Yahil */ - if ( rtmedia_activity_text_with_attachment == 'disable') { - $( "#whats-new" ).css( 'color', 'transparent' ); - $( "#whats-new" ).val( ' ' ); - } else { + if ( rtmedia_activity_text_with_attachment != 'disable') { jQuery('#whats-new-form').prepend('

' + rtmedia_empty_activity_msg + '

') jQuery( '#whats-new' ).removeAttr( 'disabled' ); return false; diff --git a/app/main/RTMedia.php b/app/main/RTMedia.php index eaf4d2943..f3038cc5d 100755 --- a/app/main/RTMedia.php +++ b/app/main/RTMedia.php @@ -1050,8 +1050,9 @@ public function init() { $this->set_allowed_types(); // Define allowed types. - global $rtmedia_buddypress_activity; + global $rtmedia_buddypress_activity, $rtmedia_buddypress_group_activity; $rtmedia_buddypress_activity = new RTMediaBuddyPressActivity(); + $rtmedia_buddypress_group_activity = new RTMediaBuddyPressGroupActivity(); $media = new RTMediaMedia(); $media->delete_hook(); diff --git a/app/main/controllers/activity/RTMediaBuddyPressActivity.php b/app/main/controllers/activity/RTMediaBuddyPressActivity.php index 10168c994..3058e7fc6 100644 --- a/app/main/controllers/activity/RTMediaBuddyPressActivity.php +++ b/app/main/controllers/activity/RTMediaBuddyPressActivity.php @@ -81,6 +81,9 @@ public function __construct() { add_filter( 'bea_get_activity_content', array( $this, 'rtm_edit_activity_filter' ) ); add_filter( 'bea_activity_content', array( $this, 'rtm_save_activity_with_media_filter' ), 10, 2 ); } + + // Allow only media uploading without text in activity. + add_filter( 'bp_before_activity_post_update_parse_args', array( $this, 'bp_before_activity_post_update_parse_args' ) ); } /** @@ -1473,4 +1476,26 @@ public function rtm_save_activity_with_media_filter( $content_new, $activity_id } return $content; } + + + /** + * Filter content before processing in activity. + * It adds the ' ' if content is empty, when we are only uploading media from activity. + * + * @param array $args Activity arguments. + * + * @return array + */ + public function bp_before_activity_post_update_parse_args( $args ) { + // if content is non-breaking space then set it to empty. + if ( isset( $args['content'] ) && '' === $args['content'] ) { + + // Nonce verification is not required here as it is already done in previously. + if ( ! empty( $_POST['rtMedia_attached_files'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing + $args['content'] = ' '; + } + } + + return $args; + } } diff --git a/app/main/controllers/group/RTMediaBuddyPressGroupActivity.php b/app/main/controllers/group/RTMediaBuddyPressGroupActivity.php new file mode 100644 index 000000000..dc467a74e --- /dev/null +++ b/app/main/controllers/group/RTMediaBuddyPressGroupActivity.php @@ -0,0 +1,43 @@ +\n" "Language-Team: rtMedia \n" "Language: en\n" @@ -2312,7 +2312,7 @@ msgid "rtMedia: Import Media Size" msgstr "" #: app/main/RTMedia.php:163 app/main/RTMedia.php:1530 app/main/RTMedia.php:1623 -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:760 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:763 #: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:113 #: app/main/controllers/upload/processors/RTMediaUploadFile.php:246 msgid "Media Files" @@ -2581,28 +2581,28 @@ msgstr "" msgid "Adding media in Comments is not allowed" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:490 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:493 #: app/main/controllers/upload/RTMediaUploadEndpoint.php:60 #: app/main/controllers/upload/RTMediaUploadEndpoint.php:74 msgid "Terms and Conditions checkbox not found!" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:819 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:822 #: app/main/controllers/media/RTMediaComment.php:219 #: app/main/controllers/shortcodes/RTMediaUploadShortcode.php:135 #: app/main/controllers/template/rtmedia-functions.php:2265 msgid "You are not allowed to upload/attach media." msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:975 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:978 #: app/main/controllers/media/RTMediaMedia.php:797 #. translators: 1: user link, 2: media. #. translators: 1: username, 2: media type, 3: media name, 4: total media. msgid "%1$s added a %2$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:982 #: app/main/controllers/activity/RTMediaBuddyPressActivity.php:985 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:988 #: app/main/controllers/upload/RTMediaUploadEndpoint.php:283 #. translators: 1: user link, 2: media count, 3: media. #. translators: 1: user link, 2: media count, 3: rtMedia slug. @@ -2610,32 +2610,32 @@ msgstr "" msgid "%1$s added %2$d %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1057 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1060 #. translators: 1: username, 2: media, 3: group name. msgid "%1$s liked a %2$s in the group %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1060 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1063 #. translators: 1: username, 2: media. msgid "%1$s liked their %2$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1069 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1072 #. translators: 1: username, 2: author, 3: media. msgid "%1$s liked %2$s's %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1178 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1181 #. translators: 1: username, 2: media, 3: group name. msgid "%1$s commented on a %2$s in the group %3$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1181 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1184 #. translators: 1: username, 2: media. msgid "%1$s commented on their %2$s" msgstr "" -#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1190 +#: app/main/controllers/activity/RTMediaBuddyPressActivity.php:1193 #. translators: 1: username, 2: author, 3: media. msgid "%1$s commented on %2$s's %3$s" msgstr "" diff --git a/readme.txt b/readme.txt index 68ba83ba5..921aff7ed 100755 --- a/readme.txt +++ b/readme.txt @@ -133,7 +133,7 @@ http://www.youtube.com/watch?v=dJrykKQGDcs == Changelog == -= 4.6.17 [December 28, 2023] = += 4.6.17 [January 2, 2024] = * Enhancement @@ -144,6 +144,7 @@ http://www.youtube.com/watch?v=dJrykKQGDcs * Fixed PHP compatibility issue. * Fixed issues related to Twenty Twenty Four theme. + * Fix BuddyPress nouveau template issue. = 4.6.16 [November 16, 2023] =