Skip to:
Content

BuddyPress.org

Changeset 6095


Ignore:
Timestamp:
06/14/2012 06:06:46 PM (13 years ago)
Author:
boonebgorges
Message:

Strip shortcodes from comparison text before adding [Read More] link in activity stream

We test to see whether a 'Read More' link should be added to activity items
in the stream by comparing the excerpted version against the unprocessed text.
Since the excerpt is created using bp_create_excerpt() with the
'filter_shortcodes' flag set to true, we must also strip shortcodes on the
unprocessed text to get an accurate comparison for length.

This prevents the [Read More] link from being appended erroneously when
shortcodes are present in activity updates.

Fixes #4051. Props magnus78

File:
1 edited

Legend:

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

    r5929 r6095  
    327327
    328328    // If the text returned by bp_create_excerpt() is different from the original text (ie it's
    329     // been truncated), add the "Read More" link.
    330     if ( $excerpt != $text ) {
     329    // been truncated), add the "Read More" link. Note that bp_create_excerpt() is stripping
     330    // shortcodes, so we have strip them from the $text before the comparison
     331    if ( $excerpt != strip_shortcodes( $text ) ) {
    331332        $id = !empty( $activities_template->activity->current_comment->id ) ? 'acomment-read-more-' . $activities_template->activity->current_comment->id : 'activity-read-more-' . bp_get_activity_id();
    332333
Note: See TracChangeset for help on using the changeset viewer.