WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

bbPress Post Toolbar

Post toolbar for bbPress 2.0.

To Do

  • Go to sleep.
  • Clean some things.
  • Other things that I can't figure out yet.
  • Relax and have a cup of hot chocolate.

Custom Buttons

The following is about standard push buttons, not panel opening buttons. To see how a panel opening button works just view the bbpress-post-toolbar.php source.

Adding custom buttons to the toolbar is done using by making a plugin and adding a filter to hook into the button. My example below is how I added the Spoiler button to the toolbar, which is my modification of the Tiny Spoiler plugin.

Note: This isn't my only modification to Tiny Spoiler. I had to also build a function to parse the [spoiler] shortcode inside a bbPress post.

function bbp_5o1_spoiler_add_to_toolbar($items) {
    $javascript = <<<JS
function(){ insert_shortcode('spoiler') }
JS;
    $items[] = array( 'action' => 'api_item',
        'inside_anchor' => '<img src="'. site_url() . '/wp-content/plugins/tiny-spoiler/spoiler_btn.png" title="Spoiler" alt="Spoiler" />',
        'data' => $javascript);
    return $items;
}
add_filter( 'bbp_5o1_toolbar_add_items' , 'bbp_5o1_spoiler_add_to_toolbar' );

Available JavaScript Functions

Really, just look inside toolbar.js

  • Insert an HTML tag: insert_data('tag')
  • (returns , potentially wrapped around text)
  • Insert a shortcode tag: insert_shortcode('tag')
  • (returns [tag][/tag], potentially wrapped around text)
  • Insert a smiley: insert_smiley(':)')
  • Insert a color: insert_color('red')
  • Insert a size: insert_size('5pt')
  • testText(tag_s, tag_e) can be used to try to wrap a start- and end-tag around selected text. If there is text selected then the tag will be applied at the end of the post content wrapped around a single space.

Available Action/Filter hookers

These are filters or actions that I have made to make buttons populate the bar:

  • apply_filters( 'bbp_5o1_toolbar_add_items', array() );
  • do_action( 'bbp_5o1_toolbar_css' );
  • ...

Requires: WordPress 3.1+ and bbPress 2.0+ or higher
Compatible up to: 3.2.1
Last Updated: 2011-11-4
Downloads: 13,880

Ratings

3 stars
3.9 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 50,2,1 50,2,1 0,2,0 100,2,2 100,1,1 67,3,2 100,10,10 100,1,1 75,4,3
0,2,0
50,6,3
100,1,1
100,1,1
50,2,1
0,1,0