Skip to:
Content

bbPress.org

Opened 5 years ago

Closed 5 years ago

#3371 closed defect (bug) (fixed)

Clickable actions for bbp_make_clickable are broken

Reported by: gdragon's profile GDragoN Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.6 Priority: high
Severity: critical Version: trunk
Component: API - Actions/Filters Keywords: has-patch needs-testing close
Cc: danielbachhuber

Description

So, I have found that clickable functions are very wrong in some cases. The first screenshot shows the content of the topic, including email as a plain text, and the second one includes email inside the [email] shortcode that takes that email and turns it into the clickable link with mailto: included. Second screenshot shows the rendered content, and thrid one is actual HTML produced after all this.

The problem here is that forum has a user with username 'dev4press', so the @dev4press triggers the clickable action for mentions.

None of these clickable filters should be triggered when dealing with HTML tags, they only should work with the plain text. And, when running one after the other, they need to be aware that the content is changed: 'bbp_make_emails_clickable is run first, and it turns email into HTML tag after that 'bbp_make_mentions_clickable' is run, and now the content is with HTML tag, but the 'bbp_make_mentions_clickable' doesn't check for that, and it messes everything up.

Attachments (4)

scr_1__content_before_clickable_actions.png (10.6 KB) - added by GDragoN 5 years ago.
scr_2__content_rendered_after_clickable_actions.png (21.0 KB) - added by GDragoN 5 years ago.
scr_3__actual_html_rendered_mess_after_clickable_actions.png (31.9 KB) - added by GDragoN 5 years ago.
3371.patch (2.2 KB) - added by johnjamesjacoby 5 years ago.

Download all attachments as: .zip

Change History (11)

#1 @danielbachhuber
5 years ago

  • Cc danielbachhuber added

#2 @johnjamesjacoby
5 years ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 2.6.5
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

Initial patch attached:

  • Updates the regular expression to use an approach similar to WordPress _make_ callbacks
  • Adds some preliminary safeguarding against malformed values
  • Separates classes from filter
  • Adds user object to filter
  • Avoids a potentially empty class="" attribute if filters remove all classes
  • Adds a bit more inline documentation

#3 @johnjamesjacoby
5 years ago

In 7082:

Formatting: tweak regular expression for @ mentions.

This commit fixes a bug causing usernames to be made clickable even after they were already made clickable previously by the email address filter.

In 2.6 branch, for 2.6.5.

See #3371.

#4 @johnjamesjacoby
5 years ago

In 7083:

Formatting: tweak regular expression for @ mentions.

This commit fixes a bug causing usernames to be made clickable even after they were already made clickable previously by the email address filter.

In trunk, for 2.7.0.

See #3371.

#5 @johnjamesjacoby
5 years ago

  • Keywords close added

Committed my patch so that we could more easily see it in action, specifically across WordPress.org.

@GDragoN I'd love your eyes on this, especially with your [email] shortcode use case. And thank you for reporting this and for the screenshots! 👍

#6 @johnjamesjacoby
5 years ago

  • Milestone changed from 2.6.5 to 2.6.6

#7 @johnjamesjacoby
5 years ago

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

Marking as fixed. It appears to be working much better – correctly, even!

Note: See TracTickets for help on using tickets.