Info
- 19 posts
- 4 voices
- Started 4 years ago by _ck_
- Latest reply from HowToGeek
- This topic is not resolved
Plugin: Admin Post Anything
-
- Posted 4 years ago #
Been meaning to do this for awhile, didn't realise how easy it was. This makes bbPress behave more like WordPress in that admin (keymasters/administrators) can post any content regardless of tag restrictions for the rest of members. This includes images, javascript, objects like flash video player, etc.
<?php /* Plugin Name: Admin Post Anything Plugin URI: Description: allows keymaster/administrators to post any content regardless of tag restrictions Author: _ck_ Author URI: http://CKon.wordpress.com Version: 0.02 */ function bb_admin_post_anything($text) { if (bb_current_user_can('administrate') ) { remove_filter( 'pre_post', 'encode_bad' ); remove_filter( 'pre_post', 'bb_encode_bad' ); remove_filter('pre_post', 'bb_filter_kses', 50); $text=addslashes($text); $text=bb_autop($text); } return $text; } add_filter('pre_post', 'bb_admin_post_anything',9); ?> -
- Posted 4 years ago #
Minor change to force autop to run even with the removed filters
(so admins still get paragraph formatting). -
- Posted 4 years ago #
I tried a YouTube embed and it wouldn't do it. Is there anymore restrictions?
Trent
-
- Posted 4 years ago #
Hmm, the adding and removing of slashes may be messing with things. I'll have to test it some more. I know it works for any regular html tags.
-
- Posted 4 years ago #
Just tested a youtube embed copied right from their site and it works tested in IE and Firefox.
I don't use the default bbpress template however, I wonder if that is affecting it somehow.
Are you using the updated v0.02 that I posted, not v0.01 ?
If it still doesn't work, can you view source on the outputed page and copy just the part with that one post with full html here (between code tags obviously) so I can see what it is doing?
-
- Posted 4 years ago #
I dug around on your forum until I found your test post.
Apparently something is yanking out object tags.There might be a third party plugin that's interfering with it and adding the filters back in.
I have to think about how to handle that situation... not sure if it's even possible... I gotta figure out what's happening in more detail somehow.
-
- Posted 4 years ago #
I tested it on my onvertigo.com site which is not using the default template either. It doesn't work for me with any themes!
http://onvertigo.com/topic/media-types-played-in-this-forum?replies=12#post-38
Strange.....using:
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/2G_AHHxSctE"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/2G_AHHxSctE" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>Trent
-
- Posted 4 years ago #
Weirdness. I will have to explore and test some more.
Can you tell me what other plugins you are using that are common to both sites? It almost has to be a plugin conflict at this point.
Does it let you post other forbidden html like <hr> ?
-
- Posted 4 years ago #
Turns out it doesn't like the 'allow images' plugin by mdawaffe. Strange. Turned it off and it works great.
Trent
-
- Posted 4 years ago #
-
- Posted 4 years ago #
I will look at the code for allow images but I suspect it's because they must run one of the three bad filters after my filter runs.
I think I tried adding to the repository and nothing happened but I'll try again.
-
- Posted 4 years ago #
Okay by adding these to the remove_filters list, you can also run allow images:
remove_filter( 'pre_post', 'allow_images_encode_bad', 9 ); remove_filter( 'pre_post', 'allow_images', 52 );It may also be necessary to increase my filter priority to 8, ie.
add_filter('pre_post', 'bb_admin_post_anything',8);Since I can't edit my first post I will try to add it to the repository with the changes?
-
- Posted 4 years ago #
If you email me the code, I can change your first post as we go.
trent dot adams at gmail dot com
Trent
-
- Posted 4 years ago #
I posted v0.03 on my wp blog
http://ckon.files.wordpress.com/2007/07/admin-can-post-anythingphp.doc
(rename to *.php)Let me know if the allow images hack works?
-
- Posted 4 years ago #
Fourth time is the charm? Ugh. Sorry!
<?php /* Plugin Name: Admin Can Post Anything Plugin URI: Description: allows keymaster/administrators to post any content regardless of tag restrictions Author: _ck_ Author URI: http://CKon.wordpress.com Version: 0.04 */ function bb_admin_post_anything($text) { if (bb_current_user_can('administrate') ) { remove_filter('pre_post', 'encode_bad' ); remove_filter('pre_post', 'bb_encode_bad' ); remove_filter('pre_post', 'bb_filter_kses', 50); remove_filter('pre_post', 'addslashes', 55); remove_filter('pre_post', 'bb_autop', 60); $text=bb_autop(addslashes($text)); // I don't completely understand why this is necessary here but it is // the following two lines are untested code to allow compatibility with the allow images plugin // it's safe to remove it's filters because this only happens if admin are trying to post remove_filter( 'pre_post', 'allow_images_encode_bad', 9 ); remove_filter( 'pre_post', 'allow_images', 52 ); } return $text; } add_filter('pre_post', 'bb_admin_post_anything',8); ?> -
- Posted 4 years ago #
This plugin now has an official page in the plugin browser:
http://bbpress.org/plugins/topic/55
so check there for latest version. -
- Posted 4 years ago #
Coolio cheers. Ripped the filters to remove for my own nefarious porpoises in bbSync.
-
- Posted 4 years ago #
Updated to v0.05 with important improvements to make sure admin posts are filtered correctly, please upgrade if currently using:
http://ckon.wordpress.com/files/2007/08/admin-can-post-anything.txt?v005
(also in the svn shortly) -
- Posted 4 years ago #
Sweet! Going to test shortly...
-
You must log in to post.