bbp_get_the_content( array $args = array() )

Return a textarea or TinyMCE if enabled

Description

Parameters

$args

(Optional)

Default value: array()

Return

(string) HTML from output buffer

Source

File: bp-forums/common/template.php

1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
    function bbp_get_the_content( $args = array() ) {
 
        // Parse arguments against default values
        $r = bbp_parse_args( $args, array(
            'context'           => 'topic',
            'before'            => '<div class="bbp-the-content-wrapper">',
            'after'             => '</div>',
            'wpautop'           => true,
            'media_buttons'     => false,
            'textarea_rows'     => '12',
            'tabindex'          => bbp_get_tab_index(),
            'tabfocus_elements' => 'bbp_topic_title,bbp_topic_tags',
            'editor_class'      => 'bbp-the-content',
            'tinymce'           => false,
            'teeny'             => true,
            'quicktags'         => true,
            'dfw'               => false
        ), 'get_the_content' );
 
        // If using tinymce, remove our escaping and trust tinymce
        if ( bbp_use_wp_editor() && ( false !== $r['tinymce'] ) ) {
            remove_filter( 'bbp_get_form_forum_content', 'esc_textarea' );
            remove_filter( 'bbp_get_form_topic_content', 'esc_textarea' );
            remove_filter( 'bbp_get_form_reply_content', 'esc_textarea' );
        }
 
        // Assume we are not editing
        $post_content = call_user_func( 'bbp_get_form_' . $r['context'] . '_content' );
 
        // Start an output buffor
        ob_start();
 
        // Output something before the editor
        if ( !empty( $r['before'] ) ) {
            echo $r['before'];
        }
 
        // Use TinyMCE if available
        if ( bbp_use_wp_editor() ) :
 
            // Enable additional TinyMCE plugins before outputting the editor
            add_filter( 'tiny_mce_plugins',   'bbp_get_tiny_mce_plugins'   );
            add_filter( 'teeny_mce_plugins''bbp_get_tiny_mce_plugins'   );
            add_filter( 'teeny_mce_buttons''bbp_get_teeny_mce_buttons'  );
            add_filter( 'quicktags_settings', 'bbp_get_quicktags_settings' );
 
            ?>
            <div id="bbp_editor_<?php echo esc_attr( $r['context'] ); ?>_content" class="<?php echo esc_attr( $r['editor_class'] ); ?>" tabindex="<?php echo esc_attr( $r['tabindex'] ); ?>">
                <?php echo $post_content; ?>
            </div>
            <input type="hidden" id="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" name="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" value="<?php echo esc_attr( $post_content ); ?>" />
            <?php
 
            // Output the editor
//          wp_editor( $post_content, 'bbp_' . $r['context'] . '_content', array(
//              'wpautop'           => $r['wpautop'],
//              'media_buttons'     => $r['media_buttons'],
//              'textarea_rows'     => $r['textarea_rows'],
//              'tabindex'          => $r['tabindex'],
//              'tabfocus_elements' => $r['tabfocus_elements'],
//              'editor_class'      => $r['editor_class'],
//              'tinymce'           => $r['tinymce'],
//              'teeny'             => $r['teeny'],
//              'quicktags'         => $r['quicktags'],
//              'dfw'               => $r['dfw'],
//          ) );
 
            // Remove additional TinyMCE plugins after outputting the editor
            remove_filter( 'tiny_mce_plugins',   'bbp_get_tiny_mce_plugins'   );
            remove_filter( 'teeny_mce_plugins''bbp_get_tiny_mce_plugins'   );
            remove_filter( 'teeny_mce_buttons''bbp_get_teeny_mce_buttons'  );
            remove_filter( 'quicktags_settings', 'bbp_get_quicktags_settings' );
 
        /**
         * Fallback to normal textarea.
         *
         * Note that we do not use esc_textarea() here to prevent double
         * escaping the editable output, mucking up existing content.
         */
        else : ?>
 
            <textarea id="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" class="<?php echo esc_attr( $r['editor_class'] ); ?>" name="bbp_<?php echo esc_attr( $r['context'] ); ?>_content" cols="60" rows="<?php echo esc_attr( $r['textarea_rows'] ); ?>" tabindex="<?php echo esc_attr( $r['tabindex'] ); ?>"><?php echo $post_content; ?></textarea>
 
        <?php endif;
 
        // Output something after the editor
        if ( !empty( $r['after'] ) ) {
            echo $r['after'];
        }
 
        // Put the output into a usable variable
        $output = ob_get_clean();
 
        return apply_filters( 'bbp_get_the_content', $output, $args, $post_content );
    }

Changelog

Changelog
Version Description
bbPress (r3586) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.