WPMU Hacks for BDP RSS, Optimal, & YouTube

In my previous post I failed to detail how I hacked WPMU in order to include BDP RSS & Optimal in a static page and embed YouTube videos in posts. Sorry for this oversight, below you will find the play-by-play (soon to be ported over to bavawiki).

Integrating BDP RSS & Optimal into a WP Page
In a one-off WP install this would not be a hack because you could use the Exec-PHP plug-in to quickly and easily execute the requisite PHP code for BDP RSS and Optimal in a page or post. However, WPMU intentionally disables the Exec-PHP plugin, effectively forbidding the administrator from executing PHP in pages and posts. Therefore, we have to do some minor surgery. The way I got the PHP to work in a static page is by inserting it into a custom page template (one of several ways I am sure, and not necessarily the prettiest). Here’s how:

  • To create a new page template, copy the code from the page.php file in your theme directory. (Note: I am using K2 -this may be slightly different for other themes -but the logic should be similar.) Copy the code into a blank document in your favorite text editor and include the following line of code at the very beginning of your new template:

    <?php /*
    Template Name: Name your template here
    */ ?>

    In the space that says “Name your template here” name the template. For example, “John Smith’s English 101″.

  • Once you have done this, find the following lines of code in the file:

    <div class="entry-content">
    <?php the_content(); ?>
    <p><h2>Most Recent Posts</h2></p>

    And copy the BDP RSS php code on the line after this code. It should look like this for the K2 theme:

    <div class="entry-content">
    <?php the_content(); ?>
    <p><h2>Most Recent Posts</h2></p>
    <?php BDPRSS2::output(1); ?>

    Presto, that should paste the BDP RSS feeds into the page content, just save the file with the name of your choice with a *.php extension and copy it into your current themes directory. You can the select it from the “Page-Template” drop-down menu in the right-hand sidebar when creating a new page.

    Please note that you have to customize your own BDP RSS settings according to your own output logic.

  • I chose to put the Optimal plugin code in the sidebar, but have enabled the sidebar widgets, I can’t really customize this space as I would like, namely only have the optimal plugin display. So, I further hacked this template to only put the PHP code for the optimal plugin in the sidebar. Replace the code <?php get_sidebar(); ?> in this template with the following code:

    <div class="secondary">
    <h2> List of Class Blogs with posts</h2>
    <? OPMLRender('http://link_to_your_opml_file','14400', 'opmlSidebar', '0', '2'); ?>
    </div>
    <div class="clear"></div>

    A couple of notes here, I am using blogbridge (thanks to Darcy) to publish the OPML file for each class.

    Please note, once again, that you are going to have to customize your own link and settings for the optimal plugin.

  • Finally, I understand that such a process may be a tad bit laborious for a large number of classes as it stands now. But this is a work-around until there is a safe, manageable way to execute PHP code with pages and posts in WPMU. Until then, think of this as a shortcut to keep the testing and experimenting real time.

Integrating YouTube into WPMU

  • This one’s a little shorter, this hack was offered by the user malandry on the WPMU forums here. Warning: there are some potential security risks for allowing embed tags in a post, so if you don’t control who is using your blogs to some degree, I would highly recommend not including the YouTube hack for WPMU.

May the force be with you, and have fun!

Related posts

9 Responses to “WPMU Hacks for BDP RSS, Optimal, & YouTube”


  1. 1 Matt Feb 12th, 2007 at 1:54 pm

    Thanks so much for posting this, Jim — I had been having trouble getting the BDP Aggregation going without exec-php. Thanks to your post, I’ve got it working now.

    It seems to me that providing aggregation from student blogs in a WPMU installation is essential to making WPMU work. Ideally, this should be built into WPMU itself . . . perhaps it will be in future versions.

  2. 2 jimgroom Feb 12th, 2007 at 4:36 pm

    I whole-heartedly agree, Matt. ITDamager has created a WPMU sitewide feed, but it is only working with dynamic sub domain installs thus far, and we are not running that option just yet.

    I think playing with the feed possibilities right now is the next step to a larger system-wide integration. I am fairly certain, given my scouring of the forums, that more sophisticated feed capabilities will be in the near-future builds.

    Functionality I would love to see, that comes stock with WordPress.com sites, is the community tags. This could be extremely useful for feeding student content to specific courses, groups, organizations, etc. The digital five ring binder manifested!

    Also, isn’t time WordPress integrated with MediaWiki in more sophisticated ways? I can think of a million and one uses for this relationship.

  3. 3 Gardner Feb 13th, 2007 at 1:57 pm

    Blowin’ my mind. As always. Thanks, Jim.

  4. 4 Brian Feb 4th, 2008 at 6:18 pm

    Oh man oh man is this a timesuck… You are a brave and noble man, Ranger Jim.

  1. 1 “We aint one-at-a-timin’ here, we’re mass communicatin’!” at bavatuesdays Pingback on Jun 27th, 2007 at 11:37 pm
  2. 2 WPMu Smackdown: RSS, Autoblogs, Aggregators, o-matics, and more… at ELS Blogs Pingback on Jul 5th, 2007 at 5:46 pm
  3. 3 jimgroom » WPMu Smackdown: RSS, Autoblogs, Aggregators, o-matics, and more… Pingback on Jul 7th, 2007 at 11:14 pm
  4. 4 jimgroom » “We aint one-at-a-timin’ here, we’re mass communicatin’!” Pingback on Jul 7th, 2007 at 11:16 pm
  5. 5 Semiologic Test » Playing with SimplePie for WordPress Pingback on Jul 10th, 2007 at 7:58 am

Leave a Reply




EDUPUNK: DIY EdTech

dev.WPMuEd Contributor

about

bavatuesdays.com is an ongoing conversation about media of all kinds ...

Testimonials:

Generations from now, they won't call it the Internet anymore. They'll just say, "I logged on to the Jim Groom this morning.
-Joe McMahon
Everything Jim Groom touches is gold. He's like King Midas, but with the Internet.
-Serena Epstein

My understanding is that an essential requirement of the internet is to do whatever Jim Groom asks of you while you're online.
-James D. Calder

I am Jim Groom

Find out more about me here.

browse the bavarchive