aliforty (@aliforty)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

  • aliforty
    Participant

    @aliforty

    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');

    aliforty
    Participant

    @aliforty

    Or I am I misinformed? I will look into trying out apply_filters in my functions.php


    aliforty
    Participant

    @aliforty

    Hey Robin,

    I appreciate the reply! But the apply_filters command allows me to run all the filters and then returns the output. I’m wondering if there is a filter that is similar to bbp_new_reply_pre_content, but for all content that is displayed, edited, or saved.

Viewing 3 replies - 1 through 3 (of 3 total)