Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

#3697 closed defect (bug) (fixed)

bp_blogs_record_post() not stripping caption shortcode correctly

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: 1.6 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch needs-testing 2nd-opinion
Cc:

Description

Steps to reproduce:

  • Create new post
  • First thing in the post, insert an image. Make sure it has a caption, and is NOT a link to anything.
  • Publish
  • Look at activity stream. The excerpt has the caption shortcode closer leaking through.

Attachments (1)

3697.01.patch (704 bytes) - added by boonebgorges 11 years ago.

Download all attachments as: .zip

Change History (8)

#1 @boonebgorges
11 years ago

OK, I've traced down the problem, but don't have a fix yet.

In bp_blogs_record_activity(), the activity content is piped through bp_activity_thumbnail_content_images(), which strips inline images and appends a single inline image, taken from the post, right at the front of the activity item. But the method we're using isn't checking for the presence of the [caption] shortcode. As a result, the image is successfully being pulled out of the shortcode, but the shortcode is being left with no content. As a result, the regex in strip_shortcodes() is failing (because it requires .+? instead of .*?)

#2 @boonebgorges
11 years ago

  • Keywords has-patch needs-testing 2nd-opinion added

One kinda crummy fix is, in bp_activity_thumbnail_content_images(), to replace the old image tags with a space character.

Another is to rewrite that regex so that the optional [caption] shortcodes are stripped as well. See 01.patch. It's off the top of my head and I am crummy at regex, so please examine carefully.

#3 @rossagrant
11 years ago

I've implemented the patch and it solves the problem as far as I can tell. Might need double checking as I'm not a developer but the issue has stopped with the patch applied. Thanks :)

#4 @boonebgorges
11 years ago

  • Milestone changed from 1.5.2 to 1.6

I've tested it again, and it seems to be working fine, so I'm going to go ahead with it.

Moving to 1.6 as this is not a regression.

#5 @boonebgorges
11 years ago

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

(In [5351]) Strips caption shortcode in blog post activity items. Fixes #3697

#6 @johnjamesjacoby
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening pending incoming feedback on how to duplicate this same thing with a blog search.

#7 @johnjamesjacoby
11 years ago

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

False alarm.

Note: See TracTickets for help on using tickets.