WordPress.org

Ready to get started?Download WordPress

Forums

bbPress2 shortcode whitelist
[resolved] Auto support for other bbcodes or shor codes plugin (10 posts)

  1. phantom.omaga
    Member
    Posted 2 years ago #

    hi
    nice plugin great work .
    i wanted to know that can we make other bbcode or shortcode plugins so that the automatically work with bbpress2 shortcode whitelist and can be used in bbpress.
    for example i use this great plugin BBcode w editor which allows me to make or add bbcodes really easily so can i add some kind of support to this plugin so that it works automatically with bbPress2 shortcode whitelist without me manually adding the shortcodes or bbcdes in the bbPress2 shortcode whitelist filter through the admin page

    http://wordpress.org/extend/plugins/bbpress2-shortcode-whitelist/

  2. phantom.omaga
    Member
    Posted 2 years ago #

    and the things is i have customized the BBcode w editor plugin a bit to match my needs so i really want to use it.

  3. phantom.omaga
    Member
    Posted 2 years ago #

    i don't mean to bump here but can i get a quicker reply

  4. antonchanning
    Member
    Plugin Author

    Posted 2 years ago #

    Sorry I wasn't notified that their was a post here.

    To answer you, in the long term I can look into the BBcode w editor plugin to see if I can add support for that, or fork it to make it work with the whitelist properly. Some shortcode plugins allow their content to bypass the whitelist, allowing users to do something like [b][bbp-login][/b]. Not really bad but I have noticed doing that without the whitelist enabled ends a thread so no more posts can be made on it.

    If you can edit that plugin yourself, all the info you need to make it work with the whitelist is in the readme.txt

    If you aren't that bothering in the short term, you can always add the codes manually in the whitelist settings.

  5. antonchanning
    Member
    Plugin Author

    Posted 2 years ago #

    From the FAQ:

    Q. I'm a shortcode plugin developer. How do I make my shortcodes safe?
    A. If your shortcodes contain no calls to do_shortcode($content), then they are probably already safe as far as I'm aware. If they do contain calls to do_shortcode($content), then you can make them safe by creating a function or class method in your plugin similar to:

    function yourplugin_do_shortcode($content) {
    if(function_exists('bbp_whitelist_do_shortcode')) {
    return bbp_whitelist_do_shortcode($content);
    } else {
    return do_shortcode($content);
    }
    }
    And then replace calls to do_shortcode($content) inside your shortcode handlers with calls to this new function.

  6. antonchanning
    Member
    Plugin Author

    Posted 2 years ago #

    Also from the FAQ:

    Q. I'm a shortcode plugin developer. How do I self-declare my plugin?
    A. To self-declare your plugin to the shortcode whitelist plugin, include the following code somewhere in your plugin, changing the names, unique identifier and the array of safe to use in the forums shortcodes that your plugin provides:

    function yourplugin_get_shortcode_whitelist() {
    $plugin_name = 'Your Plugin Name';
    $plugin_author = 'Plugin Author Name';
    $shortcodes = array('test','test2'); //array of safe shortcodes the plugin provides.

    return array('name'=>$plugin_name,'tag'=>'your-plugin-unique-identifier','author'=>$plugin_author,'shortcodes'=>$shortcodes);
    }

    if(!isset($bbpscwl_selfdeclared_plugins)) $bbpscwl_selfdeclared_plugins = array();
    $bbpscwl_selfdeclared_plugins[] = yourplugin_get_shortcode_whitelist();

  7. antonchanning
    Member
    Plugin Author

    Posted 2 years ago #

    In the case of a plugin that can add custom bbcodes, you probably need to amend the function 'yourplugin_get_shortcode_whitelist()' described above to get your list of shortcodes from your settings rather than just hardcoding them. But otherwise, its as simple as that.

  8. phantom.omaga
    Member
    Posted 2 years ago #

    ok thanks for your time on this i will try that and if em not successful i can always use the manual method.

  9. antonchanning
    Member
    Plugin Author

    Posted 2 years ago #

    I'm planning to improve the interface for adding and removing manual additions to the whitelist at some point, so I may be able to do some detection for this plugin then. It just sounds like a potential case where the admin doesn't want an all shortcodes or none option.

  10. phantom.omaga
    Member
    Posted 2 years ago #

    that sounds really good

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic