Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/07/2016 05:42:19 PM (8 years ago)
Author:
imath
Message:

Allow oEmbed discovery when WordPress version is 4.4+

WordPress 4.4 introduced Post embeds, allowing oEmbed discovery by default. We are using the same behavior for configs using at least WordPress 4.4 so that Post urls can be converted to Post embeds into the activity stream.

Props r-a-y

Fixes #6778

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-embed.php

    r10417 r10548  
    128128        $id = apply_filters( 'embed_post_id', 0 );
    129129
     130        $unfiltered_html   = current_user_can( 'unfiltered_html' );
     131        $default_discovery = false;
     132
     133        // Since 4.4, WordPress is now an oEmbed provider.
     134        if ( function_exists( 'wp_oembed_register_route' ) ) {
     135            $unfiltered_html   = true;
     136            $default_discovery = true;
     137        }
     138
    130139        /**
    131140         * Filters whether or not oEmbed discovery is on.
    132141         *
    133142         * @since 1.5.0
    134          *
    135          * @param bool $value Current status of oEmbed discovery.
     143         * @since 2.5.0 Default status of oEmbed discovery has been switched
     144         *              to true to apply changes introduced in WordPress 4.4
     145         *
     146         * @param bool $default_discovery Current status of oEmbed discovery.
    136147         */
    137         $attr['discover'] = ( apply_filters( 'bp_embed_oembed_discover', false ) && current_user_can( 'unfiltered_html' ) );
     148        $attr['discover'] = ( apply_filters( 'bp_embed_oembed_discover', $default_discovery ) && $unfiltered_html );
    138149
    139150        // Set up a new WP oEmbed object to check URL with registered oEmbed providers.
Note: See TracChangeset for help on using the changeset viewer.