WordPress.org

Ready to get started?Download WordPress

Forums

WP-Syntax
[resolved] bbPress support? (12 posts)

  1. Arnan de Gans
    Member
    Posted 1 year ago #

    Any change you could add bbPress support that actually works?
    Some other plugins say they are compatible but it's dodgy at best.

    Perhaps you can do better on that end and save the day :)

    Thanks for your consideration!

    http://wordpress.org/extend/plugins/wp-syntax/

  2. shazahm1
    Member
    Plugin Author

    Posted 1 year ago #

    @Arnan de Gans

    Sure, I'll add it to my feature request. I could actually use that myself so it'll likely come sooner than later.

  3. shazahm1
    Member
    Plugin Author

    Posted 1 year ago #

    @Arnan de Gans

    For regular commentors or forum moderators only? I'm leaning to the moderators only.

  4. Arnan de Gans
    Member
    Posted 1 year ago #

    What I need is that it works for everyone, perhaps you can make a checkmark in settings to make it optional to create a sense of security/control.

    THanks for the quick replies!

  5. Arnan de Gans
    Member
    Posted 1 year ago #

    When do you think you can make an update?

  6. shazahm1
    Member
    Plugin Author

    Posted 1 year ago #

    @Arnan de Gans

    it's on my to do list for March.

  7. Arnan de Gans
    Member
    Posted 1 year ago #

    Oh right :) thanks!

  8. svcslzysh
    Member
    Posted 1 year ago #

    I'd love to see if for all forum members :)

  9. strangerstudios
    Member
    Posted 1 year ago #

    I added this code to functions.php/etc to turn backticks (just like used on the .org forums) into <pre lang="PHP">

    /*
    	Switch <code></code> with <pre lang="PHP"></pre>
    */
    function pmpro_code_wrap($content)
    {
    	$content = preg_replace("/<code>(.*)</code>/s", '<pre lang="PHP">$1</pre>', $content);
    
    	return $content;
    }
    add_filter("the_content", "pmpro_code_wrap", -1);

    I think it might not handle nested backticks properly, but is a start.

  10. strangerstudios
    Member
    Posted 1 year ago #

    Yeah, even WP.org choked on that.

    replace the code tags in the preg_replace line with backticks. I made a gist:
    https://gist.github.com/strangerstudios/5556801

  11. raduszeged
    Member
    Posted 1 year ago #

    strangerstudios thanks for the tip, but your code is not working :( I put it into wp-includes/functions.php, but wp-syntax highlighting still don't work in bbpress forum posts! Could you help me?

    I also didn't understand what did you mean with "functions.php/etc"... ?

    Thanks.

  12. raduszeged
    Member
    Posted 1 year ago #

    I figured it out!

    I inserted this to the end to my template's functions.php (if functions.php doesn't exist, create it):

    add_filter('bbp_get_reply_content', array("WP_Syntax", 'beforeFilter' ), 0);
    add_filter('bbp_get_topic_content', array("WP_Syntax", 'beforeFilter' ), 0);
    
    add_filter('bbp_get_reply_content', array("WP_Syntax", 'afterFilter' ), 99);
    add_filter('bbp_get_topic_content', array("WP_Syntax", 'afterFilter' ), 99);

    Plus, to the beginning of the file I copy'n'pasted the whole CUSTOM_TAGS block from the base functions.php of wordpress. Of course, with the modification at the pre tag:

    'pre' => array(
    			'width' => true,
    			'lang' => true
    		),

    If you need other paramters, you should add them.

    Now I have fully functional wp-syntax highlighting in bbpress replies, too!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.