Allow HTML from users
-
What’s the best way to allow users to paste and use HTML? The problem is that there are still issues with the Visual editor, so can anyone help me allow them to use HTML?
Thanks ~
-
I’m using this, and it works fine:
if ( !function_exists( 'ja_filter_bbpress_allowed_tags' ) ) { function ja_filter_bbpress_allowed_tags() { return array( // Links 'a' => array( 'href' => array(), 'title' => array(), 'rel' => array() ), // Quotes 'blockquote' => array( 'cite' => array() ), // Code 'code' => array(), 'pre' => array(), // Formatting 'em' => array(), 'strong' => array(), 'del' => array( 'datetime' => true, ), 'span' => array( 'lang' => array(), 'style' => array() ), 'p' => array( 'dir' => array(), 'style' => array() ), 'div' => array( 'class' => array() ), // Lists 'ul' => array(), 'ol' => array( 'start' => true, ), 'li' => array(), // Images 'img' => array( 'src' => true, 'border' => true, 'alt' => true, 'height' => true, 'width' => true, ) ); } } add_filter( 'bbp_kses_allowed_tags', 'ja_filter_bbpress_allowed_tags' );
Is there anyone else who hasn’t gotten this code to work for them? I have tried everything and am still getting the issue of HTML showing up in quotes with quotes in them. I’ve copied this code to my includes/common/formatting.php and have seen zero change.
(I’m using GD BBPress Tools for my quote functionality)
@richkraetsch I expect this to be more of an issue with the GD BBPress Tools plugin rather than bbPress, they should have support in that plugin for the custom HTML tags it is using.
You can also try this plugin (and remove that custom code you added), I just added
div
and sub elementclass
to this and it should work for you, you will need to double check and modify it to remove any HTML tags you do not need, also the next release of bbPress includes some more changes to the allowed KSES HTML tags so you’ll need to update and possibly make some more changes once bbPress 2.6 is released.As of ~2.3, the “allowed tags” are filterable within bbPress.
Look for the filter bbp_kses_allowed_tags. It’s in includes/common/formatting.php.
@jaredatch , thank you so much man!! been able to allow some extra tags.. and been looking for this long time ago, until i gave up -(
appreciated 😀Hello guys.
I had the same issue. I read all the topics and i managed to fix almost everything thanks to your posts
btw thans Edgar you saved my with your plugin.
My only issue is this: i have activated the video button on tinymce so peoepl can add video using the youtube or vimeo url.
I know that just pasting the link it will embed it but the issue is that you cant arranged width and height.
Although i tried and added more things to Edgar’s plugin when i try to add iframe code it nothing appears on the post
The code i added is:
// iframe
‘iframe’ => array(
‘src’ => true,
‘style’ => true,
‘width’ => true,
‘height’ => true,
‘scrolling’ => true,
‘marginwidth’ => true,
‘marginheight’ => true,
‘frameborder’ => true,
),any help is welcome.
Thanks in advance,
atsoufjust use autoembed links in settings > forums
when the user places the link in the reply content area that link will automatically become a video when posted.
How can I add customer user tags? I want them to be able to use a certain custom div class and blockquote in the forums
- You must be logged in to reply to this topic.