Skip to:
Content

BuddyPress.org

Ticket #853: reenable-helper.txt

File reenable-helper.txt, 899 bytes (added by burtadsit, 16 years ago)
Line 
1<?php
2
3// NOTE: this works just fine by sticking this chunk of code into bp-custom.php
4
5add_filter( 'bp_get_activity_content', 'bp_forums_filter_decode' );
6add_filter( 'bp_forums_new_post_text', 'bp_forums_filter_encode' );
7
8add_filter( 'bp_get_the_topic_post_content', 'bp_forums_filter_decode' );
9add_filter( 'bp_get_the_topic_latest_post_excerpt', 'bp_forums_filter_decode' );
10
11function 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
18function 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?>