thanks for the post
bbpress includes a version of the wordpress ‘after..parse_args’ which will let you do this so for
•File …/wp-content/plugins/bbpress/includes/common/template.php line 1735:
change ‘tinymce’ => false, into ‘tinymce’ => true,
•File …/wp-content/plugins/bbpress/includes/common/template.php line 1736:
change ‘teeny’ => true, into ‘teeny’ => false,
you could put this code into a functions file or plugin
//editor bbpress
function rew_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['teeny'] = false;
return $args;
}
add_filter( 'bbp_after_get_the_content_parse_args', 'rew_enable_visual_editor' );
and the ability to filter functions so for
•File …/wp-content/plugins/bbpress/includes/common/template.php line 1858:
Remove array_push( $buttons, ‘image’ ); to remove the ‘standard’ image insert button that asks for a full url to an image, since we are replacing this by the [photo] shortcode generator.
use this code in your functions file or plugin
function rew_remove_image_button ($buttons) {
if (($key = array_search('image', $buttons)) !== false) {
unset($buttons[$key]);
}
return $buttons ;
}
add_filter( 'bbp_get_teeny_mce_buttons', 'rew_remove_image_button' );
The you don’t need to alter bbpress files
Let me know if I can help further
Thank you, this works great!
One thing left: i can not find the filter to filter forum posts/replies, so i could do:
function my_process_shortcodes($content) {
return do_shortcodes($content);
}
add_filter( '...??...', 'my_process_shortcodes' );
where do you want that to put something – I presume in the content of a topic/reply? and what doe that shortcode do ?
Yes, in the content of the topic/reply. It makes from [photo 123]
the html to display photo with id=123 from plugin wp-photo-album-plus – instead of a photo from the wp media library – according to the settings in the settings page of that plugin; e.g link to lightbox, subtitle and possible social media buttons to share the image.
The button that opens the dialog to select the photo, and optionally upload a new one, is now working without mods to bbpress, but it shows ‘[photo 123]’ instead of the picture. If the content would be filtered by the standard wp content filters, it would display the image, like it does in a wp native page or post.
I think i ggot it:
Filters ‘bbp_get_topic_content’ and ‘bbp_get_reply_content’. They MUST run after wpautop, so i gave them priority 1000.
All of my code to get my plugin compatible with bbpress looks now:
/* We use bbPress */
// editor bbpress in tinymce mode
function wppa_enable_visual_editor_in_bbpress( $args = array() ) {
if ( wppa_switch( 'photo_on_bbpress' ) ) {
$args['tinymce'] = true;
$args['teeny'] = false;
}
return $args;
}
add_filter( 'bbp_after_get_the_content_parse_args', 'wppa_enable_visual_editor_in_bbpress' );
// remove insert wp image button
function wppa_remove_image_button_in_bbpress( $buttons ) {
if ( wppa_switch( 'photo_on_bbpress' ) ) {
if ( ( $key = array_search( 'image', $buttons ) ) !== false ) {
unset( $buttons[$key] );
}
}
return $buttons ;
}
add_filter( 'bbp_get_teeny_mce_buttons', 'rew_remove_image_button_in_bbpress' );
// enable processing shortcodes
function wppa_enable_shortcodes_in_bbpress( $content ) {
if ( wppa_switch( 'photo_on_bbpress' ) ) {
$content = do_shortcode( $content );
}
return $content;
}
add_filter( 'bbp_get_topic_content', 'wppa_enable_shortcodes_in_bbpress', 1000 );
add_filter( 'bbp_get_reply_content', 'wppa_enable_shortcodes_in_bbpress', 1000 );
Pleas be so kind to review this to see if i did it right or did oversee something.
From a read through looks ok to me, but just change
add_filter( ‘bbp_get_teeny_mce_buttons’, ‘rew_remove_image_button_in_bbpress’) ;
to
add_filter( ‘bbp_get_teeny_mce_buttons’, ‘wppa_remove_image_button_in_bbpress’) ;
to run your amended function
from a read through all looks ok except
add_filter( 'bbp_get_teeny_mce_buttons', 'rew_remove_image_button_in_bbpress' );
should read
add_filter( 'bbp_get_teeny_mce_buttons', 'wppa_remove_image_button_in_bbpress' );
Thank you for all your help.
You may close this topic.
no problem, glad I could help 🙂