Repository navigation
Conversation
BuddyPress uses its own bp_embed_oembed_html filter for oEmbeds in activity comments, not WordPress' embed_oembed_html. As a result comment embeds were loaded directly as iframes without an Embed Privacy consent overlay, while regular activity updates were handled. Forward bp_embed_oembed_html to embed_oembed_html so the existing oEmbed replacement applies to comments too. Fixes epiphyt#285
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Embeds in BuddyPress activity comments (replies) load directly as iframes without an Embed Privacy consent overlay, while embeds in regular activity updates get the overlay. Fixes #285.
Root cause
BuddyPress does not use the WordPress
embed_oembed_htmlfilter for oEmbeds in activity comments — it uses its ownbp_embed_oembed_htmlfilter. Embed Privacy only hooksembed_oembed_html(viaPost::init()), so the replacement never ran for comment embeds. The existing BuddyPress integration (Buddypress::init()) only hookedbp_get_activity_content_body, which covers activity-update text but not the comment oEmbed path.Fix
Forward the BuddyPress filter to the WordPress one in
Buddypress::init(): registerbp_embed_oembed_html→Buddypress::replace_activity_comment_oembed(), which callsapply_filters( 'embed_oembed_html', $html, $url, $attributes ). This reuses the existingReplacer::replace_oembed()hook, so comment embeds get the same consent overlay as every other oEmbed. The callback accepts 3 args to match the forwarded WordPress filter signature.Note: the separate MutationObserver limitation for AJAX-loaded activity streams (#284) is not addressed here; this change makes the overlay appear — clicking it inside dynamically loaded comments still depends on #284.
Testing
testReplaceActivityCommentOembedForwardsToWordPressFilter(red before fix: hook missing and method undefined) and extendedtestInitRegistersHooksto assert the new filter.phpunit --no-coverage→ 513 tests / 1416 assertions passing (16 pre-existing deprecations).phpcsclean on both changed files (EpiphytCodingStandard).