Skip to:
Content
Pages
Categories
Search
Top
Bottom

Quick Hack: Enable SyntaxHighlighter Evolved on Group Forums

Viewing 12 replies - 1 through 12 (of 12 total)
  • @lph2005

    Participant

    @nuprn1

    Something isn’t quite right on my attempt:

    Installed the plugin https://wordpress.org/extend/plugins/syntaxhighlighter/
    Added the add_filter to line 113

    Attempted to insert php code
    http://www.thechembook.com/groups/announcements/forum/topic/php-code-test/

    A single line number shows … but no code.

    I also see that it looks like you have something else installed in your forums. What did you do to get the editors showing?

    As always, thank you.

    Changed theme to default to see if something else is interfering … still no code.

    Any thoughts or suggestions?

    @nuprn1

    Participant

    I have markitup running in the textarea
    http://etivite.com/groups/buddypress/forum/topic/quick-tip-adding-markitup-to-group-forum-textareas/#topic

    Make sure you have 1.2.4.1 (due to this: https://trac.buddypress.org/ticket/2287)

    A few things changed since my first post above, I don’t know if this will work but here is what I have in syntaxhighlighter code (v2.3.8)

    add_filter( ‘bp_get_the_topic_post_content’, array(&$this, ‘parse_shortcodes’), 7 );
    add_filter( ‘group_forum_post_text_before_save’, array(&$this, ‘encode_shortcode_contents_slashed’), 1 );
    add_filter( ‘group_forum_topic_text_before_save’, array(&$this, ‘encode_shortcode_contents_slashed’), 1 );

    add_filter( ‘bp_get_the_topic_text’, array(&$this, ‘decode_shortcode_contents’), 1 );
    add_filter( ‘bp_get_the_topic_post_edit_text’, array(&$this, ‘decode_shortcode_contents’), 1 );

    I have all the the_content, comment and widget hooks filtered out. (since i only care about syntax within the forums)

    Which reminds me – I want to enable this on activity stream content as well. :P

    @lph2005

    Participant

    Thank you.

    I checked the trac and the fix by jjj is present. However, I wasn’t clear if your workaround was present – and I couldn’t figure out how you added your workaround … which file, etc.

    I’ll try adding more filters now.

    PS. I got the markitup! to work – except the one for adding php code doesn’t show … lol … :p

    @nuprn1

    Participant

    i modified the syntaxhighlighter.php plugin file (just easy for my case)

    @lph2005

    Participant

    Adding the new filters worked!!!!

    AWESOME. Thank you!

    http://www.thechembook.com/groups/announcements/forum/topic/php-code-test/

    Now it’s starting to look like it should .. wish this was added to this site because you can’t just copy/paste your add filters but had to change the ‘ …

    @nuprn1

    Participant

    sweet! i also dropped viper a note in that wp support thread over to here.

    yo @johnjamesjacoby – add it to the site too :P

    @lph2005

    Participant

    Agreed – @johnjamesjacoby – I just did this to a second site and took less than 3 minutes to get it working.

    1. Install plugin (https://wordpress.org/extend/plugins/syntaxhighlighter/)
    2. Insert add_filter statements around line 112 of the syntaxhighlighter.php file in the plugin directory

    Easy!

    @mercime

    Participant

    Thank you @nuprn1 – “bookmarking” it now :-)

    @thekmen

    Participant

    @nuprn1, i’m using your filters above but noticed when mixing php & css in the same forum post, the css code messed up.
    changing
    add_filter( ‘bp_get_the_topic_post_content’, array(&$this, ‘parse_shortcodes’), 7 );
    to
    add_filter( ‘bp_get_the_topic_post_content’, array(&$this, ‘parse_shortcodes_comment’), 7 );
    fixed the issue.

    Other than that, did you ever figure how to get it working on the activity stream?

    @gunju2221

    Participant

    @nuprn1, the filters listed, does not seem to work on custom theme…. or at-least from what I am using. I added the filters you listed in your second post to line 113, no success. I need this to work here, because I have a group on my site that is meant for a pastebin, and the code tags make it a absolute mess, pigpen!!!

    P.S…. a little help on the MarkItUp would be awesome too!

    Thanks!
    SVC

    @bobbel78

    Member

    It’ very easy to get the code highlighted via this plugin. But I have another problem: Backslashes are stripped out! Even a double backslash is stripped from forum view. In edit view it is still there…
    any idea?

    I’ll test here:
    1 backslash:
    2 backslahes: \
    3 backslashes: \

    //edit
    Ok, same problem here…

    @chouf1

    Participant

    Probably not the exact answer, but this could help you (it’s in french but php is in english)
    http://imath.owni.fr/2010/11/08/bp-forum-et-code-source/

    Personnaly i use this and it’s working:
    https://buddypress.org/community/groups/syntax-highlighter/

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Quick Hack: Enable SyntaxHighlighter Evolved on Group Forums’ is closed to new replies.
Skip to toolbar