Skip to:
Content

bbPress.org

Opened 13 years ago

Closed 13 years ago

#1793 closed enhancement (duplicate)

Add Filters to Feedback Templates

Reported by: mordauk's profile mordauk Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: API - Actions/Filters Keywords:
Cc: stephen@…

Description

The feedback templates for "no topics found", "no forums found", etc, really need to have filters on them so that plugins can change the messages.

As an example of why the filters are needed, I'm building an add-on for one of my plugins that allows you to restrict bbPress forums amd topics to premium subscribers only. When a user does not have permission to access a forum, I'm modifying the query so that it doesn't display any topics, but then the message "Oh bother! No topics were found here" is displayed. This doesn't make sense. I'd much prefer that a "You do not have permission to view these topics" kind of message was displayed.

I've made the necessary changes and you can see them in the attached patch.

I did this in 2.0.2.

Attachments (1)

feedback_template_filters.patch (2.2 KB) - added by mordauk 13 years ago.
Patch for feedback filters.

Download all attachments as: .zip

Change History (9)

#1 follow-up: @jaredatch
13 years ago

Awesome, though I think there are a few missing (closing) parentheses. :)

@mordauk
13 years ago

Patch for feedback filters.

#2 in reply to: ↑ 1 @mordauk
13 years ago

Replying to jaredatch:

Awesome, though I think there are a few missing (closing) parentheses. :)

Bah, you're right. That's what I get for copying and pasting after testing one.

#3 @johnjamesjacoby
13 years ago

  • Milestone changed from Awaiting Review to 2.2

I'm not a fan of putting filters in the template files, since they are less likely to be seen in there, and more likely to be renamed and then forgotten about. Too much potential to break backwards compatibility.

I'll look into making a better API for feedback messages in 2.2.

Punting to 2.2.

#4 @mordauk
13 years ago

I can definitely see the reason for not putting filters in template files, but only if there is another way to change the message that is displayed.

The bottom line (at least in my eyes) is that there must be a way to change the messages. Hard coded text it never good.

#5 @netweb
13 years ago

  • Cc stephen@… added

#6 follow-up: @Mamaduka
13 years ago

@mordauk

You can use gettext filter, that might be easier that hooking into bunch filters, see example from Viper007Bond: http://www.viper007bond.com/2011/07/13/changing-core-wordpress-strings/

#7 in reply to: ↑ 6 @mordauk
13 years ago

Replying to Mamaduka:

@mordauk

You can use gettext filter, that might be easier that hooking into bunch filters, see example from Viper007Bond: http://www.viper007bond.com/2011/07/13/changing-core-wordpress-strings/

Yep, I've figured that out since this was submitted. Thanks.

#8 @johnjamesjacoby
13 years ago

  • Milestone 2.2 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

#1883 is a better description. Closing this, in lieu of that.

Note: See TracTickets for help on using tickets.