Skip to:
Content

BuddyPress.org

Changeset 10838


Ignore:
Timestamp:
05/31/2016 07:29:30 AM (9 years ago)
Author:
r-a-y
Message:

Activity: Add Embeds support to single activity items.

Much like the Post Embeds feature introduced in WordPress 4.4, this commit
adds support for single activity URLs to be auto-discovered by oEmbed
consumers.

This allows activity URLs to be rendered into an embeddable format on
third-party websites.

Specifically, this commit:

  • Introduces the BP_Activity_oEmbed_Component class, which hooks into WordPress' oEmbed provider API via the BP_oEmbed_Component class.
  • Renders oEmbed requests for single activity items into a template suitable for embedding.
  • Introduces embed template parts into bp-legacy - /bp-templates/bp-legacy/buddypress/assets/embeds/

See #6772.

Location:
trunk/src
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-classes.php

    r10417 r10838  
    1414require dirname( __FILE__ ) . '/classes/class-bp-activity-feed.php';
    1515require dirname( __FILE__ ) . '/classes/class-bp-activity-query.php';
     16
     17// Embeds - only applicable for WP 4.5+
     18if ( bp_get_major_wp_version() >= 4.5 && bp_is_active( 'activity', 'embeds' ) ) {
     19    require dirname( __FILE__ ) . '/classes/class-bp-activity-oembed-component.php';
     20}
  • trunk/src/bp-activity/classes/class-bp-activity-component.php

    r10825 r10838  
    3333                'adminbar_myaccount_order' => 10,
    3434                'search_query_arg' => 'activity_search',
     35                'features' => array( 'embeds' )
    3536            )
    3637        );
     
    7172        if ( defined( 'AKISMET_VERSION' ) && class_exists( 'Akismet' ) && ( ! empty( $akismet_key ) || defined( 'WPCOM_API_KEY' ) ) && apply_filters( 'bp_activity_use_akismet', bp_is_akismet_active() ) ) {
    7273            $includes[] = 'akismet';
     74        }
     75
     76        // Embeds - only applicable for WP 4.5+
     77        if ( bp_get_major_wp_version() >= 4.5 && bp_is_active( $this->id, 'embeds' ) ) {
     78            $includes[] = 'embeds';
    7379        }
    7480
Note: See TracChangeset for help on using the changeset viewer.