Hacking the MU

Tagged


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.