Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying Code in Forum Posts

  • Avatar of tombot86
    tombot86
    Participant

    @tombot86

    I’m having a lot of trouble finding an answer to whether or not you can display code in a forum post.

    Can this be done?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    Hi @tombot86,

    of course ! You can use syntaxhighlighter evolved plugin.
    Because BP is stripping out some html in posts replies, you have to modify a line in
    bp-forums-template.php:1167 (or near these line)
    Replace by this:
    <code>`return apply_filters( ‘bp_get_the_topic_post_content’, wp_specialchars_decode( $topic_template->post->post_text, ENT_QUOTES ) );`</code>

    And in your child theme functions.php, add this:
    <code>`remove_filter( ‘bp_get_the_topic_post_content’, ‘bp_forums_filter_kses’, 1 );
    remove_filter( ‘bp_get_the_topic_post_content’, ‘wptexturize’ );`</copy>

    From now you can use the different shortcodes provided by the plugin to insert code snippets into your group forums posts.

    Take care of quotes and backsticks by copy/pasting from here.

    Here’s an example of what you will see on BP 1.6.2 MS/ WP 3.5

    http://bp-fr.net/groupes/comment-faire-pour/forum/topic/des-icones-rondes/#post-5887

     

    Avatar of tombot86
    tombot86
    Participant

    @tombot86

    Thanks! I’ll get on that!

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

You must be logged in to reply to this topic.