Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/16/2015 06:59:09 PM (10 years ago)
Author:
djpaul
Message:

Activity: improve blog post excerpts by showing rich media from the post.

Prior to this change, when we created excerpts for new/updated blog post activity items, we'd try to use any single image referenced in that blog post, and use it to decorate and bring interactivity to the activity stream item. This was inconsistently applied -- it was dependant on the length of the original post -- and ignored other possible media sources, such as oEmbeds and video/audio shortcodes.

Now, we use the media extractor (r9619) to extract comprehensive media information from a new/updated blog post, and use the information to build a much richer excerpt for blogs posts for activity items.

See #6177

File:
1 edited

Legend:

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

    r9475 r9621  
    387387 * Truncate long activity entries when viewed in activity streams.
    388388 *
     389 * This method can only be used inside the Activity loop.
     390 *
    389391 * @since BuddyPress (1.5.0)
    390392 *
     
    403405    global $activities_template;
    404406
     407    /**
     408     * Provides a filter that lets you choose whether to skip this filter on a per-activity basis.
     409     *
     410     * @param bool $maybe_truncate_text If true, text should be checked to see if it needs truncating.
     411     * @since BuddyPress (2.3.0)
     412     */
     413    $maybe_truncate_text = apply_filters( 'bp_activity_maybe_truncate_entry',
     414        ! in_array( $activities_template->activity->type, array( 'new_blog_post', ), true )
     415    );
     416
    405417    // The full text of the activity update should always show on the single activity screen
    406     if ( bp_is_single_activity() )
     418    if ( ! $maybe_truncate_text || bp_is_single_activity() ) {
    407419        return $text;
     420    }
    408421
    409422    /**
Note: See TracChangeset for help on using the changeset viewer.