Random thoughts on art, technology, stuff, and occasionally Real Estate: Real Coders Copy and Paste

Real Coders Copy and Paste

A couple months ago, I created some WordPress Mu (Multiple User) communities. 

( http://activerain.com/blogsview/851850/Installing-WordPress-MU-on-GoDaddy-Yes-It-Can-Be-Done

http://activerain.com/blogsview/888615/I-declare-it-is-done-enough-for-now-at-any-rate  )

Mu is a slightly different animal than stand-alone WordPress.org.  In fact, in several ways, it lacks some of the functionality of the stand-alone version.  Why? Because the developers of Mu figured there were security risks inherit in a public, multi-blog community .... and so some basic, simple functions such as embedding a video, or using iframes are disabled.

And enabling those simple functions is perhaps a little trickier than necessary.

1.  First attempt at a solution:  The Unfiltered MU plugin.  Unfiltered MU works great, when it works, but is temperamental and does not every time.

2.  Back to the Mu forums, its sounding as if I may need to hack the kses.php file.  Hmmmm.

http://mu.wordpress.org/forums/topic.php?id=9270

http://mu.wordpress.org/forums/topic.php?id=7851

3.  Then I find this plugin http://wpmudev.org/project/Allow-Embedded-Videos , but the writer of the plugin, Stuart Maxwell, only coded it to include embedded videos.  He says "If you look at the source code of the plugin you'll see how easy it is to add additional tags so that you could modify it to allow iframes, forms or whatever else you want."

4.  Okayfine.  So now I need to copy the iframe code from taiwanese's post here http://mu.wordpress.org/forums/topic.php?id=7851  and paste it into Stuart Maxwell's code.

Here's the final product which now resides in the plugin folder of one of my Mu communities:

<?php
/*
Plugin Name: Allow embedded videos
Plugin URI: http://wpmudev.org/project/Allow-Embedded-Videos
Description: Allows videos from Google, Flickr, Youtube to be embedded into Wordpress MU.  Iframe code added by CJ http://www.queenofkludge.com
Version: 1.0
Author: Stuart Maxwell
Author URI: http://stuart.amanzi.co.nz
*/

/*  Copyright 2008  Stuart Maxwell  (email : stuart@amanzi.co.nz)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

function az_add_tags(&$content) {
    $content += array(
        'object' => array(
            'width' => array(),
            'height' => array(),
            'data' => array(),
            'type' => array(),
            'classid' => array(),
            ),
        'param' => array(
            'name' => array(),
            'value' => array(),
            ),
        'embed' => array(
            'src' => array(),
            'type' => array(),
            'bgcolor' => array(),
            'allowfullscreen' => array(),
            'flashvars' => array(),
            'wmode' => array(),
            'width' => array(),
            'height' => array(),
            'style' => array(),
            'id' => array(),
            'flashvars' => array(),
            )

 

 'iframe' => array(
  'width' => array(),
  'height' => array(),
  'frameborder' => array(),
  'src' => array(),
  'frameborder' => array(),
  'marginwidth' => array(),
  'marginheight' => array(),
  )


       );
    return $content;
}
add_filter('edit_allowedposttags', 'az_add_tags');
?>

 

Please feel free to copy it to a text file, and upload to your own Mu community. 

File name should be  524507081_az-kses     (no dot anything at the end) 

Upload the file  to your mu-plugins folder

At least I have now made it easier for the next person who comes along.  :-)

5 commentsCheryl Johnson • February 19 2009 09:45AM

Comments

Wow... Cher, that is awesome. You ROCK bay-bay! Very, very cool indeed. :-)

Posted by C Tann-Starr (CarolynTannStarr.com TannStarr.net REMAX People Realty) about 1 year ago

I'm a dinosaur from the 80's; I jsut can't keep up with this stuff. But I try.

Posted by Terry Chenier (Homelife Glenayre Realty) about 1 year ago

C -- You know, the thing is, sometimes I have spent ~~hours~~ searching the internet for something like that. 

I've decided whenever I happen to stumble across a solution to a issue I've had to muddle through, I'll post it here, there and everywhere, so the next person who comes along with that same question can maybe find the answer with a little less grief.  :-)

Posted by Cheryl Johnson, Bob Taylor Properties, Inc., Los Angeles, CA about 1 year ago

Which is why I appreciate you so much and always look forward to reading your blog although I do not always comment. :-)

Posted by C Tann-Starr (CarolynTannStarr.com TannStarr.net REMAX People Realty) about 1 year ago

Cheryl,

YOU have a sharing spirit.  Thank you.  If you have taken the time to post and share the least I can do is feature this in the Epro group.

**  THIS POST IS FEATURED IN THE E-PRO INTERNET TECHNOLOGY GROUP**

Posted by Rebecca Levinson, Real Estate Marketing Consultant (Real Skillz-Clear Marketing for Your Real Estate Vision) about 1 year ago

This blog does not allow anonymous comments