| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | // NOTE: this works just fine by sticking this chunk of code into bp-custom.php |
|---|
| 4 | |
|---|
| 5 | add_filter( 'bp_get_activity_content', 'bp_forums_filter_decode' ); |
|---|
| 6 | add_filter( 'bp_forums_new_post_text', 'bp_forums_filter_encode' ); |
|---|
| 7 | |
|---|
| 8 | add_filter( 'bp_get_the_topic_post_content', 'bp_forums_filter_decode' ); |
|---|
| 9 | add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_decode' ); |
|---|
| 10 | |
|---|
| 11 | function bp_forums_filter_encode( $content ) { |
|---|
| 12 | $content = htmlentities( $content, ENT_COMPAT, "UTF-8" ); |
|---|
| 13 | $content = str_replace( '&', '/amp/', $content ); |
|---|
| 14 | |
|---|
| 15 | return $content; |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | function bp_forums_filter_decode( $content ) { |
|---|
| 19 | $content = str_replace( '/amp/', '&', $content ); |
|---|
| 20 | $content = @html_entity_decode( $content, ENT_COMPAT, "UTF-8" ); |
|---|
| 21 | $content = str_replace( '[', '<', $content ); |
|---|
| 22 | $content = str_replace( ']', '>', $content ); |
|---|
| 23 | $content = stripslashes( wp_filter_kses( $content ) ); |
|---|
| 24 | |
|---|
| 25 | return $content; |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | ?> |
|---|