Reply To: Hook for all Content posted (replies, topic creation)
I was familiar, just a brain freeze early on Monday 🙂
But please let me know what arguments I should pass that would get the outcome I am hoping for. I was wanting for “\r \n” in TinyMCE to be replaced with <br /> tags. The WordPress database was not saving those escaped characters or at the very least wasn’t displaying them back. Eerything was being shown in one line. Teeny and TinyMCE is enabled.
For the time being, I did find an alternative solution. Replaced the “\r \n” with <br /> for the posts and disabled the bbp_code_trick_reverse filter that was removing them later.
function bbp_convert_reply_breaks_to_tags($output, $args, $post_content){
$text = str_replace(array("\r\n", "\n", "\r"), "<br />", $post_content);
return $text;
}
function bbp_convert_topic_and_forum_breaks_to_tags($post_content){
$text = str_replace(array("\r\n", "\n", "\r"), "<br />", $post_content);
return $text;
}
add_filter('bbp_new_reply_pre_content', array($this, 'bbp_convert_reply_breaks_to_tags'), 10, 3);
add_filter('bbp_new_topic_pre_content', array($this, 'bbp_convert_topic_breaks_to_tags'), 10, 1);
add_filter('bbp_new_forum_pre_content', array($this, 'bbp_convert_topic_and_forum_breaks_to_tags'), 10, 1);
remove_filter('bbp_get_form_reply_content', 'bbp_code_trick_reverse');
remove_filter('bbp_get_form_forum_content', 'bbp_code_trick_reverse');
remove_filter('bbp_get_form_topic_content', 'bbp_code_trick_reverse');