Skip to:
Content

Opened 7 years ago

Closed 7 years ago

#683 closed enhancement (fixed)

Auto-Close Markup Tags

Reported by: Trent Owned by: mdawaffe
Milestone: Priority: normal
Severity: normal Version:
Component: Back-end Keywords:
Cc:

Description

I would think that I wouldn't be the only one here that would like it if we could have a filter check to autoclose tags used in posts and replies to make sure that the markup doesn't continue past a post if someone forgets to close a tag.

Trent

Change History (6)

comment:1 _ck_7 years ago

AHA! I found a bug. Finally I can contribute.

Wordpress does indeed auto-close tags and has a fantastic routine, using function balancetags.

HOWEVER - it was copied raw into BBpress and it won't work by default because it's looking for an option that will never be set because BBpress doesn't have it

`function balanceTags($text, $is_comment = 0, $force = false) {

if ( !$force && get_option('use_balanceTags') == 0 )

return $text;

`

See what I mean? There's no manual way to set use_balanceTags in BBpress.

So how do we force the filter on? I know it has to be balanceTags($text,1,1) to work.

comment:2 _ck_7 years ago

I discovered the use_balanceTags flag is not in BBpress, removed from WP.

Here's a workaround until it's fixed:

function force_balance_tags($text) { return balanceTags($text, true);}
add_filter('pre_post', 'force_balance_tags');

I was trying to use $bb->use_balanceTags=true but it wouldn't work because the option is not looked for in BBpress vs WP

comment:3 mdawaffe7 years ago

  • Owner set to mdawaffe
  • Status changed from new to assigned

Frankly, I think this is a bug in WordPress, not bbPress.

#WP4626

comment:4 fel647 years ago

Worth noting that an extra </ol> will break the page, too. Balancing tags should work both ways if it doesn't already.

comment:5 mdawaffe7 years ago

My mistake, it is a bbPress bug (that exists because the above problem with WP). I'm talking with some of the other WP devs now to get a solution that works well for both bb and WP.

comment:6 mdawaffe7 years ago

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

(In [908]) force_balance_tags() from [WP5805]. Deprecate balanceTags(). Fixes #683

Note: See TracTickets for help on using tickets.