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

Conversation

imath
Copy link
Member

@imath imath commented Aug 14, 2023

If you need to prepend the Medium to the activity content, you simply need to use the bp_attachments_activity_attach_media filter this way:

/**
 * Filter to prepend the Medium to the Activity text.
 *
 * @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.
 * @return string The Activity text block with the prepended Medium block.
 */
function testovac_attachments_activity_prepend_media( $content, $text_block, $medium_block ) {
	return $medium_block . "\n" . $text_block;
}
add_filter( 'bp_attachments_activity_attach_media', 'testovac_attachments_activity_prepend_media', 10, 3 );

Fixes #81

@imath imath merged commit 84a360b into trunk Aug 15, 2023
@imath imath deleted the filter/activity-prepend-attachment branch August 15, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a filter to prepend the Medium block to the Activity text block
1 participant