-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2032 from rtCamp/feature/allow_media_upload_witho…
…ut_text_in_activity Enhance activity post media experience.
- Loading branch information
Showing
5 changed files
with
86 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
app/main/controllers/group/RTMediaBuddyPressGroupActivity.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Handle/change BuddyPress group activities behaviour. | ||
* | ||
* @package rtMedia | ||
*/ | ||
|
||
/** | ||
* Class to handle/change BuddyPress group activities behaviour. | ||
* | ||
* @author utsavladani | ||
*/ | ||
class RTMediaBuddyPressGroupActivity { | ||
|
||
/** | ||
* RTMediaBuddyPressGroupActivity constructor. | ||
*/ | ||
public function __construct() { | ||
// Allow only media uploading without text in activity. | ||
add_filter( 'bp_before_groups_post_update_parse_args', array( $this, 'bp_before_groups_post_update_parse_args' ) ); | ||
} | ||
|
||
/** | ||
* Filter content before processing in group 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_groups_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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# Copyright (C) 2023 rtCamp | ||
# Copyright (C) 2024 rtCamp | ||
# This file is distributed under the same license as the rtMedia for WordPress, BuddyPress and bbPress package. | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: rtMedia for WordPress, BuddyPress and bbPress 4.6.17\n" | ||
"Report-Msgid-Bugs-To: https://rtmedia.io/support/\n" | ||
"POT-Creation-Date: 2023-12-28 10:36:32+00:00\n" | ||
"POT-Creation-Date: 2024-01-02 06:22:56+00:00\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=utf-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n" | ||
"PO-Revision-Date: 2024-MO-DA HO:MI+ZONE\n" | ||
"Last-Translator: rtMedia <[email protected]>\n" | ||
"Language-Team: rtMedia <[email protected]>\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,61 +2581,61 @@ 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. | ||
#. translators: 1: Username, 2: Number of medias, 3: Media slug. | ||
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 "" | ||
|