Skip to:
Content

Opened 6 years ago

Last modified 6 years ago

#2301 new defect

bbPress Forms Should Display Unfiltered Data

Reported by: alex-ye Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.2.3
Component: Tools - Code Improvements Keywords: reporter-feedback
Cc:

Description

Some bbPress forms like topic-form,reply-form and forum-form display some filtered data, This cause the forms to display worng info.

To reproduce this bug:

1- Filter the bbp_get_topic_title and add a any string to the original title.

2- Edit the topic you filtered, You will see that the topic title input display the string you have added in the filter.

after debug seems like the bbp_template_include_theme_compat() function using bbp_get_topic_title() to reset the post title, I can't say that is a wrong way, but it has a side effect.

Change History (2)

#1 follow-up: @johnjamesjacoby
6 years ago

  • Component changed from Topics to Code Improvement
  • Keywords reporter-feedback added; needs-patch removed
  • Milestone changed from Awaiting Review to Future Release

The forms traditionally use some equivalent function, in this case: bbp_form_topic_title() && bbp_get_form_topic_title().

The form functions work a little differently, in that they are used specifically for returning form field data.

In this specific case, it's probably related to editing a topic, and it using: bbp_get_global_post_field()

In your filter, you'll probably want to add a bbp_is_topic_edit() check, and only apply your filter when not editing.

It's possible this is a bug, or just more confusing than it needs to be, so there may be room for improvement. Moving to Future Release for more discussion.

#2 in reply to: ↑ 1 @alex-ye
6 years ago

Replying to johnjamesjacoby:

The forms traditionally use some equivalent function, in this case: bbp_form_topic_title() && bbp_get_form_topic_title().

The form functions work a little differently, in that they are used specifically for returning form field data.
In this specific case, it's probably related to editing a topic, and it using: bbp_get_global_post_field()

The forms functions should display unfiltered values, or they should have another filters , This is what bbPress really do and what bbp_get_global_post_field() docs said.

but as you see the IDs/Titles/Status/AuthorID filtered out even before the bbp_get_global_post_field() function work, Maybe it make sense in some locations like IDs but I can't see any reason for the rest.

However, using a non-filtered data in bbp_theme_compat_reset_post() it could case a bugs too, So as an idea I think it could possible to save a two instances in bbp_template_include_theme_compat() one for the display and one for the edit, and the forms functions should get their data from the unfiltered instance.

In your filter, you'll probably want to add a bbp_is_topic_edit() check, and only apply your filter when not editing.

It is possible but not perfect :) at least for my use.

It's possible this is a bug, or just more confusing than it needs to be, so there may be room for improvement. Moving to Future Release for more discussion.

I hope to see more discussion about this soon :)

Note: See TracTickets for help on using tickets.