Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: [p] showing up in group forums and activity, with bp 1.0.2 and latest php+libxml


plrk
Participant

@plrk

The hack:

<?
// Fulhack for fixing obscure [p] bug: see
// https://buddypress.org/forums/topic/p-showing-up-in-group-forums-and-activity-with-bp-102-and-latest-phplibxml

function fulhack_for_fixing_p_bug($string) {
$string = preg_replace("#\[a href=\"([^<]+)\"\]([^<]+)\[/a\]#i", "<a href=\"\\1\" target=\"_blank\">\\2</a>", $string);
$string = str_replace("[p]", "<p>", $string);
$string = str_replace("[/p]", "</p>", $string);
$string = str_replace("[ol]", "<ol>", $string);
$string = str_replace("[/ol]", "</ol>", $string);
$string = str_replace("[ul]", "<ul>", $string);
$string = str_replace("[/ul]", "</ul>", $string);
$string = str_replace("[li]", "<li>", $string);
$string = str_replace("[/li]", "</li>", $string);
$string = str_replace("
", "<br />", $string);
return $string;
}
add_filter( 'bp_get_the_topic_post_content', 'fulhack_for_fixing_p_bug' );
?>

Skip to toolbar