bbPress

Simple, fast, elegant

bbPress Plugin Browser »

Admin Can Post Anything (0.1.0)

Download

Version: 0.1.0

Last Updated: 2008-12-12

Requires bbPress Version: 0.8 or higher

Compatible up to: 0.8.2.1

Author Homepage »

Plugin Homepage »

Donate to this plugin »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(5)

Your Rating

Author: _ck_

With this plugin, keymaster/administrators may include any markup in their posts.
All checks are removed for content while some light formatting is still applied. For example, you could post youtube embed code without bbPress stripping it.


  1. anducampu

    Inactive

    How exactly does this plugin work? I activated and when i post anything, all the code appears in the post. Which means the tags are converted somehow.

    Posted: 2 years ago #
  2. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    Please try version 0.05 and see if that changes anything for you.
    You must be logged into your forum as a keymaster or administrator.

    Posted: 2 years ago #
  3. IzzyPop

    Inactive

    When trying to post content from panjea.com I get a

    "cannot modify header information" error

    bbpress 0.8.2.1
    no other plugs running

    Any advice?

    Posted: 2 years ago #
  4. I have the same problem as anducampu, I'm using the version 0.05 and still can't put embed youtube video to the post.

    Posted: 2 years ago #
  5. I just played around with this again and adding the following works perfect for me:

    <object width="425" height="350">
    <param name="movie" value="http://www.youtube.com/v/7XquB6881tk"></param>
    <param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/7XquB6881tk" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

    Trent

    Posted: 2 years ago #
  6. I must be missing something but I can not get this plugin working.
    I use standard img tags <IMG src="http://blaa.blaa.bb/blaa.jpg" align="left" border="0">

    No errors, nothing... img tags are displayed as text.

    Do I need to edit some other files to get it working?
    bbpress has no plugin activation, so what is the meaning of :

    Add the admin-can-post-anything.php file to bbPress' my-plugins/ directory. Activate .

    I use bbpress 0.8.2.1.

    Posted: 2 years ago #
  7. Looks like I had a different problem. My user admin was no longer a keymaster.

    Thanx for the plugin!

    Posted: 2 years ago #
  8. The only problem I have is with single quotes.....anything with single quotes around it will make this plugin cough out errors and not add the entry. I am using the 0.5 version. Any ideas?

    Posted: 2 years ago #
  9. I get exactly the same problem with the single quotes as Trent. Any update on this is greatfully appreciated. Is there a way to add javascript code to a post without this plugin?

    Posted: 2 years ago #
  10. I get the single-quote error too. I think simply changing all single quotes to &apos;.

    Posted: 2 years ago #
  11. Add the following code to get the single-quote error fixed. It works for me.
    $text = str_replace("'", "&apos;", $text);

    Posted: 2 years ago #
  12. I love this plugin. I use it a lot to help my members encode youtube videos and other things they want to post into topics.

    My problem with it is:

    I can't post normally without getting a MySql syntax error. This will eat my post, report an error, and show that there's a new post by me.

    In order to post normally (nothing special, just words) I have to go an turn off the plugin.
    Then I can post fine.

    Seems a little strange.

    Has anyone else had this trouble with this plugin?

    Posted: 2 years ago #
  13. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    I intend to revisit this plugin and try to make it work better. Please remind me if I forget...

    Posted: 1 year ago #
  14. It's time to remind u. I've got "Warning: Cannot modify header information - headers already sent" I am using 0.9.0.2

    Posted: 1 year ago #
  15. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    Ah thanks for the reminder.
    I think I know how to fix a few issues.

    Posted: 1 year ago #
  16. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    Okay here's an experimental new version that approaches this differently - it allows bbPress to do whatever the heck it does and write the post to the db the first time, then re-writes the post with what you actually sent with a minimum of filters.

    I've made the ability optional with the default off, you'll notice at the bottom of the new/edit post form there is a checkbox to override restrictions.

    Replace this in your plugin and give it a shot. If it works for a few people I'll put it as an official update to the plugin.

    <?php
    /*
    Plugin Name: Admin Can Post Anything
    Plugin URI: http://bbpress.org/plugins/topic/55
    Description: allows administrators to post any content regardless of member restrictions, including javascript and flash video embed
    Author: _ck_
    Author URI: http://bbShowcase.org
    Version: 0.1.0
    */
    
    add_action( 'bb_update_post', 'bb_admin_post_anything',9999);
    add_action( 'bb_new_post', 'bb_admin_post_anything',9999);
    add_action('edit_form','bb_admin_post_anything_form',9);
    add_action('post_form','bb_admin_post_anything_form',9);
    
    function bb_admin_post_anything($post_id) {
    	if (empty($_POST['admin_post_anything']) || !bb_current_user_can('administrate') || empty($post_id)) {return;}
    
    	global $topic,$topic_id, $bbdb;
    	if (empty($topic_id)) {if (!empty($topic->topic_id)) {$topic_id=$topic->topic_id;}}
    	elseif (!$topic_id=$bbdb->get_var("SELECT topic_id FROM $bbdb->posts WHERE post_id=$post_id LIMIT 1")) {return;}
    
    	remove_filter('pre_post', 'bb_encode_bad');
    	remove_filter('pre_post', 'bb_code_trick');
    	remove_filter('pre_post', 'force_balance_tags');
    	remove_filter('pre_post', 'stripslashes', 40);
    	remove_filter('pre_post', 'bb_filter_kses', 50);
    	remove_filter('pre_post', 'addslashes', 55);
    	remove_filter('pre_post', 'bb_autop', 60);
    	remove_filter( 'pre_post', 'allow_images_encode_bad', 9 );
    	remove_filter( 'pre_post', 'allow_images', 52 );
    
    	$text=stripslashes(trim($_POST['post_content']));
    	$text = preg_replace("/<(script|noscript|object|param|embed|noembed|style)(.*?)<\/\\1>/se", 'str_replace(array("\r\n", "\r", "\n"), "<ADMINPreserveNewline>", "\")', $text);
    	if (!$text = apply_filters('pre_post', $text, $post_id, $topic_id)) {return;}
    	$text=nl2br($text);
    	$text = str_replace('<ADMINPreserveNewline>', "\n", $text);
    
    	// $text = preg_replace( '/\\\\/u', '\\\\\\\\', $text );
    	$text = mysql_real_escape_string($text);
    	// $text = preg_replace( '/([%_])/u', '\\\\$1', $text);	   	
    
    	$bbdb->query("UPDATE $bbdb->posts SET post_text='$text' WHERE post_id=$post_id LIMIT 1");
    }
    
    function bb_admin_post_anything_form() {
    if (!bb_current_user_can('administrate')) {return;}
    echo "<label><input style='margin:0.5em 0;vertical-align:middle;' name='admin_post_anything' type='checkbox' value='1'> "._("override posting restrictions?")." </label>";
    }
    ?>
    Posted: 1 year ago #
  17. It doesnot works. Previous version can post what i want, but new one cannot override filtered version. Both returns me hdr sent error.

    Posted: 1 year ago #
  18. _ck_

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Moderator

    Make sure when you copy the new version into the old file that you do not leave any whitespace after the ?> or before the <?php (no spaces and no newlines).

    "headers already sent" is a second error caused by another error - after you check for whitespace, if you get that error, do a "view source" on the webpage with the error and look further up the page for the real error - see if you can tell me what it is. I don't get the error on my test sites.

    (also try deactivating the plugin and see if you still get that error to be certain)

    Posted: 1 year ago #
  19. hm...I am sure that problem is caused by this plugin, cause it's only one installed

    I fixed "header send" error,
    but I have "Parse error: syntax error, unexpected $end in /home/***/bb-plugins/acpe.php(33) : regexp code on line 1

    Fatal error: preg_replace() [function.preg-replace]: Failed evaluating code: str_replace(array("\r\n", "\r", "\n"), "<ADMINPreserveNewline>", "\") in /home/***/bb-plugins/acpe.php on line 33" when I post "<script>alert('boo!')</script>" (w/o quotes). But I can post such things as "<marquee>lorem ipsum</marquee>" or "</div>"

    Posted: 1 year ago #

RSS feed for this topic

Add a Comment »

You must log in to post.

Code is Poetry.