Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a filter to edit how the attached media is added to the activity content #82

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion bp-attachments/bp-attachments-activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,22 @@ function bp_attachments_activity_attach_media( $args = array() ) {
}

if ( $medium_block ) {
$args['content'] = $content . "\n" . $medium_block;
$text_block = $content;

// By default the Medium block is appended to the Activity text block.
$content .= "\n" . $medium_block;

/**
* Filter here to edit how the attached media is added to the activity content.
*
* @since 1.1.0
*
* @param string $content The Activity text block with the appended Medium block.
* @param string $text_block The serialized Activity text block.
* @param string $medium_block The serialized Medium block.
* @param array $args The arguments used to post an activity update.
*/
$args['content'] = apply_filters( 'bp_attachments_activity_attach_media', $content, $text_block, $medium_block, $args );
}
}

Expand Down