Featured: Pink for October

Sillyness, werd


Entry: Hacking the MU


 

Meta & Errata


So yeah, I bet you didn’t see this one coming. I am back with a new series on hacking WordPress. This time we are going to focus on WordPress MU. Fasten your safety belts people, it may be a bumpy ride.

Setting the stage

So, while I have left behind WordPress in favor of Habari for my personal sites, I still use WP in some of my professional endeavors. I have found that WordPress MU specifically is a great platform to build on for a number of situations.

For instance last year I used WPMU as the basis for a multi-blog social network that catered to Realtor type people, and this year I used it to revamp the online presence of a major player in College Loan servicing in Texas.

When leveraged properly there isn’t much you can’t do with it. Well Guess what… in the next couple of weeks we are going to be looking at novel ways to hack the crap outta WPMU, complete with working code.

You know you love me, just admit it.

First, some theory

So all great endeavors must begin with some background information, theory if you will, that will allow us to delve into solving practical problems in the most efficient way. For the first tutorial, we will be looking at how WPMU handles multiple blogs, and use that knowledge to create an “aggregated view” of recent activity, across all blogs hosted by a single instance of WPMU.

WPMU creates distinct tables for each blog that is activated. They follow a very simple pattern, prefix_n_posts for example, where prefix is the unique prefix you supplied when installing WPMU, and n corresponds to a blog id. The list of tables that follow this pattern are:

  • categories
  • comments
  • links
  • link2cat
  • options
  • post2cat
  • postmeta
  • posts

These are the core tables that are created every time a new blog is added to WPMU. There are a number of tables that hang out and hold data for the entire shebang, like prefix_users, prefix_blogs and prefix_site. We will talk a little about them at a later time. For now lets take a moment and outline what we want to accomplish in the first tutorial.

Be goal oriented

I like having clear cut goals laid out when starting a project like this; it helps minimize the rabbit trails, and keep you on task. Here are my goals for our first foray into hacking the MU:

  1. Stay away from hacking core code.
  2. Leverage the plugin and theme systems.
  3. Utilize some of the shiny-ness to be found in PHP 5 and mySQL 5.

I realize that some of you out there might not be so keen on grappling with the big, bad 5’s, so I will also provide some variant code and instruction for the 4’s. But it is muuuch cooler to use the 5’s people. You’ll see.

Well that’s it for this little introduction. Tune in Next Monday (July 30th) for the first tutorial. I hope to also have an outline of the other parts of this series for you, so you can properly drool in anticipation. See you then.

 

Comments & Pontifications


  1. personal avatar David Yeiser
    Stroll on over and visit David Yeiser
    July 23, 2007

    Woohoo! I’m excited, I plan on hacking WPMU in the near future for a personal project so these tutorials will be a great resource I’m sure!

    On a side note, I’ve visited your blog on and off for the past few years. I live in Louisville, KY, so I’m not too far from you; and I grew up in Paris, KY.

    Lastly, I really like the pale yellow titles on the dark blue background.

    Looking forward to the tutorials!
    -David


  2. personal avatar Evan Walsh
    Stroll on over and visit Evan Walsh
    July 23, 2007

    I will keep an eye on this for sure.


  3. personal avatar Chris J. Davis
    Stroll on over and visit Chris J. Davis
    July 23, 2007

    Hey David.

    That is great to hear (both using WPMU and living in the ville)! Maybe the next time I am in that area, we can meet and have some coffee.


  4. personal avatar David Yeiser
    Stroll on over and visit David Yeiser
    July 23, 2007

    Sure, sounds great. That’s actually going to be the focus of my little project — local coffeeshops in Louisville.


  5. personal avatar ob81
    Stroll on over and visit ob81
    July 23, 2007

    hmmm. Seems like I need to keep my eyes open to this. Bookmarked!


  6. personal avatar kobak
    Stroll on over and visit kobak
    July 23, 2007

    I’m excited too. :-)


  7. personal avatar Timothy Diokno
    Stroll on over and visit Timothy Diokno
    July 24, 2007

    Ummm.. this is a little off topic but may you pont me to the Sillyness archives? Can’t seem to find it. I tried typing the URL then “/archives” but it just gave me a description.

    By the way, good luck on that MU hack!


  8. personal avatar Chris J. Davis
    Stroll on over and visit Chris J. Davis
    July 24, 2007

    Hmm, archives. Yeah I should really set something up to do archives, eh?

    I will try to write something in the next day or so to get archives going.


  9. personal avatar XIII
    Stroll on over and visit XIII
    July 28, 2007

    Sweet, I can’t wait to see what comes next. I always lose track whenever I try and find some info on the MU ‘forums’, so this’ll be perfect.


  10. personal avatar Optimize
    Stroll on over and visit Optimize
    August 1, 2007

    David, do you think you could do some information regarding Wild Card sub-domains and WordpressMU so it can run as myblog.chrisdavis.org automatically as the user creates their blog?

    Or is this outside the scope of your tutorials. I had a crack at it with the info i “did” find but failed miserably.

    Thanks, Carly.


  11. personal avatar Peter Kwong
    Stroll on over and visit Peter Kwong
    August 1, 2007

    Hi Chris

    Trying to send you details abou a new project - having no joy with your forms can you please email me at and I’ll tell you more

    Thanks

    Peter


  12. personal avatar Chris J. Davis
    Stroll on over and visit Chris J. Davis
    August 17, 2007

    Just an update here guys. I am still planning on having this tut up soon. Have no fear!


  13. personal avatar Vision
    Stroll on over and visit Vision
    July 15, 2008

    Chris how did this turn out? I believe I had seen something about this on a MU forum a while back.

Leave a Reply