Skip to:
Content
Pages
Categories
Search
Top
Bottom

Want to use one of my WordPress plugin service in my bbpress install


  • technotip
    Participant

    @technotip

    To be precise:

    I’ve installed a wp plugin for displaying programming codes with numbering and coloring.

    we should write the code inside some tags.

    Now I want to use the same tag even in the forum and get the same effect. Is this possible ?

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

  • technotip
    Participant

    @technotip

    please help.. it’s critical form me #please


    Anointed
    Participant

    @anointed

    It kind of helps to know what plugin you are talking about.

    There are a couple of plugins that might help though:

    http://bbpressbbcode.chantech.org/

    http://bbpressbbcode.chantech.org/shortcode-whitelist/

    those allow you to use shortcodes in bbPress, and also choose which ones you allow users to use.

    *allowing all shortcodes for users is dangerous, asking for trouble.

    **I didn’t write the plugins, and don’t know much about them other than I tried them once and they worked. Just trying to help


    technotip
    Participant

    @technotip

    Thanks a lot, but once I install that plugin, my forum goes down :-(

    I’m using the plugin version of bbpress.


    I’m using WP-Syntax plugin to display some program codes on my blog.

    It uses this syntax:

    “Syntax highlighting using GeSHi supporting a wide range of popular languages. Wrap code blocks with <pre lang=”LANGUAGE” line=”1″> and where LANGUAGE is a geshi supported language syntax. The line attribute is optional.”

    I want to use the same syntax even on my forum.


    Anointed
    Participant

    @anointed

    Yeah, I’m not sure how to get it to work. I just tried it myself, and while I get no errors, I am not able to use shortcodes in my forum topics. Maybe JJ, or someone will jump in and let us know how to properly whitelist shortcodes.

    *I know I have my site setup correctly as I can use shortcodes in my other custom post-types. Best guess is that bbPress has some rather strong filtering going on or something. Which btw is not a bad thing, would just help to know what/why it’s happening.


    technotip
    Participant

    @technotip

    waiting for JJ to reply..


    technotip
    Participant

    @technotip

    waiting for ‘John James Jacoby’.. please help us. This is a critical thing for me. and most people would need this at some point of time.

    I would love an answer to this too.


    technotip
    Participant

    @technotip

    help..anyone ??


    technotip
    Participant

    @technotip

    :-(


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    If you can point me to a more specific problem, a plugin, a specific issue, I’m happy to help. :)


    technotip
    Participant

    @technotip

    I want to allow all my forum members to use this tag <pre name=”code” class=”cpp”> tag.

    Now only I (admin) can use it; but I want to allow any registered member to use it.

    I have some css + js files to make the code written inside this specific tag display differently.

    Hope you got it.

    Please help..


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    You’ll need to filter the kses filter on the_content to allow that set of tags. Do a google search for filtering the kses filter, and there should be lots of examples.


    technotip
    Participant

    @technotip

    I know about adding these tags..but not sure where the array() is in bbpress ?

    Can you point me to the file name where the empty array is present, where we can add our tags and its attributes.


    technotip
    Participant

    @technotip

    <b>Gautam Gupta</b> tried to help me with this code:

    global $allowed_tags;

    $allowed_tags=array('name','class','id');

    I pasted it inside function.php file; unfortunately its not working.

    I’m using https://wordpress.org/extend/plugins/google-syntax-highlighter/ plugin. and want my bbpress forum members to make use of pre tag and this plugin highlights the codes they post on the forum.

    It uses the following syntax: <pre name="code" class="c">

    please help.

    You can filter it using the bbp_get_allowed_tags filter bbPress provides.


    technotip
    Participant

    @technotip

    I’m not able to find the file, in which this bbp_get_allowed_tags is present..


    technotip
    Participant

    @technotip

    got something inside bbpressbbp-includesbbp-common-template.php file.

    /**

    * Output all of the allowed tags in HTML format with attributes.

    *

    * This is useful for displaying in the post area, which elements and

    * attributes are supported. As well as any plugins which want to display it.

    *

    * @since bbPress (r2780)

    *

    * @uses bbp_get_allowed_tags()

    */

    function bbp_allowed_tags() {

    echo bbp_get_allowed_tags();

    }

    /**

    * Display all of the allowed tags in HTML format with attributes.

    *

    * This is useful for displaying in the post area, which elements and

    * attributes are supported. As well as any plugins which want to display it.

    *

    * @since bbPress (r2780)

    *

    * @uses allowed_tags() To get the allowed tags

    * @uses apply_filters() Calls 'bbp_allowed_tags' with the tags

    * @return string HTML allowed tags entity encoded.

    */

    function bbp_get_allowed_tags() {

    return apply_filters( 'bbp_get_allowed_tags', allowed_tags() );

    }

    what should I do with it inorder to make pre tag allowable.

    I feel like, editing the core isn’t a good idea.

    Is there a way to handle this via my template ?

    Can you please give me the code that I must paste inside my function.php file to allow <pre name="code" class="c"> to my forum members.

    No you should not edit core (*ever*), you should use the filter that is available in the code you just posted bbp_get_allowed_tags.

    You need to look into filters https://codex.wordpress.org/Function_Reference/add_filter


    technotip
    Participant

    @technotip

    ok..

    as Guatam suggested, I added the following code to my function.php file

    add_action('bbp_init', '_bbp_allow_pre_tag', 10);

    function _bbp_allow_pre_tag() {

    global $allowedtags;

    $allowedtags = array( 'name', 'class', 'id' );

    }

    but still its not working.

    Can you please directly give me the code I need to paste into my function.php file ?

    I need to allow pre tag with following attributes to it name=”code” class=”c”

    so basically I must allow “pre” tags with “name” and “class” attributes.

    Sorry I do not have time to provide you with the exact code.

    However as jjj already said there are tons of examples on Google.

    http://ottopress.com/2010/wp-quickie-kses/


    technotip
    Participant

    @technotip

    thanks for the link. I understand.. will try my best to get it done myself.

    I’m not used to bbpress and wordpress coding.. will get used to it.

    Thanks a lot for all the help and guidelines.

Viewing 21 replies - 1 through 21 (of 21 total)
  • You must be logged in to reply to this topic.
Skip to toolbar