Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 3 years ago

#7395 closed defect (bug) (wontfix)

embed_oembed_html not used on sitewide activity?

Reported by: petervandoorn Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Core Keywords: has-patch
Cc:

Description

I’m using this code ( from http://wpsites.org/how-to-make-oembed-videos-responsive-10520 ) to filter WordPress’s oEmbed to make YouTube videos responsive.

add_filter('embed_oembed_html', 'ct_wrap_embed_container', 10, 3);
 
function ct_wrap_embed_container($html, $url, $attr) {
        return "<div class=\"responsive-video\">".$html."</div>";
}

It works a treat in bbPress forum topic views, but it isn’t working on the BP site-wide activity feed.

This Codex page https://codex.buddypress.org/getting-started/embeds/ says that WP’s native oEmbed functionality is used since BP 1.5, so I would expect it to work.

Thanks

Attachments (1)

7395.01.patch (908 bytes) - added by r-a-y 3 years ago.

Download all attachments as: .zip

Change History (10)

#1 @DJPaul
4 years ago

Hi. What isn't working, exactly?

Are the videos appearing in the activity stream? If so, does your wrapper HTML appear around the activity item? If so, are you reporting this is basically a CSS/responsive issue?

#2 @henry.wright
4 years ago

Hi Paul

I think the solution would be for BuddyPress to apply filters attached to the WordPress hook embed_oembed_html?

#3 @r-a-y
4 years ago

  • Component changed from (not sure) to Core
  • Version changed from 2.7.2 to 1.5

BP doesn't use the 'embed_oembed_html' filter.

I originally did use this filter when implementing embeds into BuddyPress, but it was decided that we should prefix the filter name with 'bp_'.

Try the 'bp_embed_oembed_html' filter instead.

#4 @henry.wright
4 years ago

Try the 'bp_embed_oembed_html' filter instead.

And there we have it. Thanks r-a-y :)

#5 @DJPaul
4 years ago

  • Milestone changed from Awaiting Review to 2.9

@r-a-y How do you feel about calling this action in addition to ours? I ended up doing this for the email code with wp_mail, and I think it'd help more here, too.

#6 @r-a-y
3 years ago

@r-a-y How do you feel about calling this action in addition to ours? I ended up doing this for the email code with wp_mail, and I think it'd help more here, too.

The problem is the 'embed_oembed_html' filter doesn't quite have the same filter signature. The 'embed_oembed_html' filter has a fourth parameter used for the WP post ID, but we do not utilize the item ID in our 'bp_embed_oembed_html' filter -- we use the raw shortcode attributes instead.

In 01.patch, I've implemented the 'embed_oembed_html' filter, but for the fourth parameter, I've just passed integer 0 in its place.

I'll leave it up to you if we want to commit this or not as I don't really have any strong opinions about this ticket.

@r-a-y
3 years ago

#7 @r-a-y
3 years ago

  • Keywords has-patch added

#8 @hnla
3 years ago

  • Milestone changed from 2.9 to 3.0

Re-visit in 3.0 then.

#9 @DJPaul
3 years ago

  • Milestone 3.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Let's not do this per previous discussion between @r-a-y and I. Worried about breaking the function signature here, that's annoying to run into in someone else's codebase.

Note: See TracTickets for help on using tickets.