#2082 closed defect (bug) (fixed)
Content of BP activity items should not be texturized
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.2.3 | Priority: | normal |
Severity: | normal | Version: | 2.1 |
Component: | Extend - BuddyPress | Keywords: | needs-patch |
Cc: | boone@… |
Description
In the BP activity posting methods (BBP_BuddyPress_Activity::reply_create()
and BBP_BuddyPress_Activity::topic_create()
), the content
parameter for bp_activity_add()
is fetched using bbPress's template functions bbp_get_reply_content()
and bbp_get_topic_content()
. The return value of these functions is run through wptexturize()
. As a result, wptexturize()
d content is put into the BP activity stream. (Same goes for wpautop()
and other text display filters.)
This is problematic. For one thing, texturization should be done on the way out as a general rule. More specifically, in this case, the texturization is causing problems with plugins. In BuddyPress Group Email Subscription, we use the activity content to send a plaintext HTML email notification of the new activity item. But converted characters like the curly quote HTML entities don't play nice with HTML emails. There are probably other potential problems too (double encoding, etc).
A quick fix, which is ugly but maximally specific, is to remove and then readd the problematic filters at the time of creation:
remove_filter( 'bbp_get_reply_content', 'wptexturize', 3 ); // etc $reply_content = bbp_get_reply_content( $reply_id ); add_filter( 'bbp_get_reply_content', 'wptexturize', 3 ); // etc
Another possibility is to add a skip_filters
param to bbp_get_*_content
.
A third and similar possibility is to have a separate function for getting the raw content of a reply/topic, and possibly to make bbp_get_*_content()
a wrapper for that raw function.
I'm not providing a patch because I'm not sure what best suits your architecture, and it's an easy implementation anyway. Thanks for considering!
Change History (6)
#3
@
11 years ago
- Resolution set to fixed
- Status changed from new to closed
(In [4546]) BuddyPress Activity:
- When adding activity stream items, use raw values and trust BuddyPress to properly texturize output.
- Fixes #2082 (2.2 branch)
#4
@
11 years ago
(In [4547]) BuddyPress Activity:
- When adding activity stream items, use raw values and trust BuddyPress to properly texturize output.
- Fixes #2082 (trunk)
#6
in reply to:
↑ 5
@
11 years ago
Replying to boonebgorges:
Thanks!
Thanks for the report. Would have totally missed this for a while.
Confirmed. Using get_post_field() should be sufficient.