Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Allow image plugin in forums


5283373
Inactive

@tcesco

The best way is to create a file in the plugin directory (/wp-content/plugins), call it as you want (mine is custom.php) and put the code in it.

Here is mine (with a bonus code to modify the admin bar, removing the blog menu and the visit menu):

<?php

function my_alter_bp_adminbar(){

remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6);

remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_random_menu’, 100);

}

add_action(‘wp_footer’,’my_alter_bp_adminbar’,1);

function gs_bp_forums_add_allowed_tags( $allowedtags ) {

if ( bp_is_group_forum_topic() ) {

$allowedtags[‘img’] = array( ‘src’ => array() );

$allowedtags[‘del’] = array();

$allowedtags[‘p’] = array();

$allowedtags[‘br’] = array();

$allowedtags[‘cite’] = array();

$allowedtags[‘blockquote’] = array();

$allowedtags[‘h3’] = array();

$allowedtags[‘strong’] = array();

$allowedtags[’em’] = array();

}

return $allowedtags;

}

add_action( ‘plugins_loaded’, ‘gs_configure_forum_filters’ );

function gs_configure_forum_filters() {

remove_filter( ‘bp_get_the_topic_post_content’, ‘attribute_escape’ );

remove_filter( ‘bp_get_the_topic_post_content’, ‘convert_smilies’ );

remove_filter( ‘bp_get_the_topic_post_content’, ‘convert_chars’ );

add_filter( ‘edit_allowedtags’, ‘gs_bp_forums_add_allowed_tags’ );

}

?>

Skip to toolbar