Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 12 years ago

#4051 closed defect (bug) (fixed)

using shortcodes in activity stream always result in [Read more] links if shortcode filter priority is wrong

Reported by: magnus78's profile magnus78 Owned by:
Milestone: 1.6 Priority: normal
Severity: normal Version:
Component: Activity Keywords:
Cc: boonebgorges, magnus.melin@…

Description

If I use shortcodes in the activity stream I always get [Read more] links inserted.

This is due to the fix for #3452, specifically the if ( $excerpt != $text ) check in bp_activity_truncate_entry

Attachments (1)

bp_shortcode_exerpts_bug.patch (767 bytes) - added by magnus78 13 years ago.
proposed fix

Download all attachments as: .zip

Change History (7)

@magnus78
13 years ago

proposed fix

#1 @DJPaul
13 years ago

  • Milestone changed from Awaiting Review to 1.6

Moving to 1.6 for review. Do you mean any type of activity item, or only those from blog posts?

#2 @magnus78
13 years ago

  • Cc magnus.melin@… added

Turns out this happened to me because of an action priority problem. I had it for all activity items.

I think the fix is still correct though. If shortcodes are stripped you will always get the more link since texts obviously aren't the same anymore - and typically not because a length is exceeded.

If shortcodes are expanded before the code in question runs it doesn't matter of course (this is the normal scenario).

#3 @DJPaul
12 years ago

magnus78, was the action priority problem in your code/plugin, or was it in BuddyPress? Can you name names?

#4 @magnus78
12 years ago

  • Summary changed from using shortcodes in activity stream always result in [Read more] links to using shortcodes in activity stream always result in [Read more] links if shortcode filter priority is wrong

The action priority problem was in my own plugin.

#5 @boonebgorges
12 years ago

Problem confirmed.

Since we are currently stripping shortcodes in the stream, we should continue to do so. Instead, let's also strip the shortcodes from the $text we're comparing against.

#6 @boonebgorges
12 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6095]) 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

Note: See TracTickets for help on using tickets.