Opened 13 years ago
Closed 13 years ago
#1793 closed enhancement (duplicate)
Add Filters to Feedback Templates
Reported by: |
|
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)
Change History (9)
#2
in reply to:
↑ 1
@
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
@
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
@
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.
#6
follow-up:
↓ 7
@
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
@
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.
Awesome, though I think there are a few missing (closing) parentheses. :)