All posts by Jon Mabe

A better way to host multiple domains on WordPress MU/Multi-Site

What am I talking about!?

Well, there is this thing called “Multi-Site” in WordPress 3.0. You can read official docs on it here: Create a Network. It used to be called WordPress Mu or WPMU. The Multi-Site platform is MEANT to allow you to host multiple blogs on one domain via either subdirectories or subdomains like:

http://www.somesite.com/joesblog

or

http://joesblog.somesite.com

But any savvy web dev knows that this is not far from being able to host say the following on the same WordPress Multi-Site platform/install:

http://joesblog.com

and

http://samsblog.com

That’s what this guide is for: to help you “hack” WordPress to get multi-domains to work. Now you can do this with some fancy redirection plugins. But I really don’t like these because they mask/redirect a subdomain which can complicate some plugins and who knows what else. That’s why I wrote this post so you can make this work without using a redirection plugin.

This is really only for smarty-pants web developers

It’s possible that one day WordPress will move/remove this code I’m modifying. They did it in 2.9 -> 3.0 and I had to go looking for that bit of code again. Sure I’ll probably update this post if they do, but for how long? As long as I’m managing a Multi-Site I suppose. You do the math. So that said, you’re probably going to want to be smart enough to debug this if I quit the internets, or you don’t bookmark my site, or monsters eat your homework, etc..

Additionally: I haven’t ran this by ANY wordpress experts. But I’ve been running this on “old” WPMU for years, and now “new” 3.0 Multi-Site, with no issues.

This is NOT for the faint of heart!

If you have a lot of sites you’re going to want to gauge heavily on how/when to do this. However in my opinion this is a LOT less janky than all the redirect plugins. Twice I reviewed my options and both times I came up using this method. Once it’s done: it’s great.

This is also the first draft.

I literally copy/pasted this from an email I just sent and made some modifications, so it may by a little rough. I’ll try to update it if people give me feedback or I do any modifications on my end.

My method is two-part

  1. changing 1 line of php (into 2)
  2. changing the “domain name” in the db for each blog to be the real domain instead of the subdomain

Part 1

note some further info/instruction can be found here on updating to new WP versions etc.: Installing/Updating WordPress with Subversion

We check out via svn on the 3.0.1 tag (note: this is the latest version as of this posting):

$ svn co http://core.svn.wordpress.org/tags/3.0.1 .

note: don’t worry about not being able to updated to new versions like 3.1 etc all you have to do to do so is: svn switch http://core.svn.wordpress.org/tags/3.1 you can see how to do that in that wp codex article I linked

once we’re checked out, we are able to make changes to the core and be able to still update from wordpress because updating from the remote repository will trigger a merge with our locally modified code. So we don’t have to fear our slight modification ever getting overwritten.

As for the code we changed, it’s very simple. WPMU is (obviously) only setup to work on subdomains and subdirectories. So it _always_ loads the basic info from the root domain name. So we only need to make a slight modification for when it does this:

Here is the .diff patch if you don’t want to do it manually: ds_wpmu.zip

file: wp-includes/ms-load.php
line: ~141

remove this line:

$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) );

replace with these lines:

$current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path ) );
$current_site->domain = $domain;

Part 2

Then you have to update each blog so that it’s domain name isn’t the subdomain and instead is the real domain. When I first set this up I had < 20 domain so I did it all manually, you may want to do it automagically if you already have a lot of sites via a big sql script or a mixed php/sql script or w/e your favorites are. Anyway these are the options that need to be updated in each blog:

  1. in [wp_blogs] each [domain] field (and possibly [path] if you’re using subdirectories)
  2. in each [wp_X_options] table, X being the blog’s ID the following fields:
  • siteurl
  • home
  • fileupload_url

Note: Instead you can update the domain manually in wp-admin when editing the site. You can check-box the “Update siteurl and home as well.” but it doesn’t update fileupload_url, so make sure to change tht too.

And that’s it.

Naturally these instructions come with no warranty, so don’t break your stuff, and make sure to back everything up before you do anything. I’m sure some of you are looking at me in horror, but meh, get over it.

Dungeons & Dragons Miniatures List [Nerd!]

Ever wondered what the heck each miniature was in those Player’s Handbook Miniature packs? Well, I’ve done your homework for you:

  • Wood Elf Ranger
  • Eladrin Fighter
  • Dragonborn Rogue
  • Male Dwarf Rogue
  • Male Tiefling Warlord
  • Female Eladrin Fighter
  • Male Dragonborn Warlord
  • Female Elf Fighter
  • Male Gnome Rouge
  • Female Human Warlord
  • Male Shifter Ranger
  • Male Tiefling Fighter

Series 1 – Arcane Heroes 1

  • Male Tiefling Warlock
  • Female Eladrin Wizard
  • Male Half Elf Bard
  • Human Male Wizard
  • Female Eladrin Sorcerer
  • Male Half-Elf Fighter/Warlock
  • Male Human Swordmage
  • Female Human Wizard
  • Warforged Artificer

Series 1 – Primal Heroes 1

  • Female Elf Druid
  • Male Goliath Barbarian
  • Male Human Barbarian
  • Male Human Druid
  • Male Halfling Barbarian
  • Female Human Barbarian

Series 1 – Divine Heroes 1

  • Male Dwarf Paladin
  • Female Halfling Cleric
  • Male Human Cleric
  • Warforged Cleric
  • Female Human Avenger
  • Male Human Paladin
  • Male Genasi Paladin
  • Male Human Invoker
  • Female Human Cleric

If you want a specific character you can find them at Miniature Market as well.

Carcassonne for iPhone out now, iPad coming soon [Games]

I fired up the App Store on my iPhone and I saw Carcassonne at the top of the list.  Not only does this game look beautiful, but it plays great, AND has multiplayer! MUCH more than can be said about the Catan game (phooey!). Additionally, according to the App Store page, if you buy the app now for $4.99, you’ll get the iPad upgrade free when it comes out (instead of paying the full $9.99).

Get it now! Carcassonne for iPhone

If you’re into euro games, you may also be into these iPhone/iPad games as well:

To Create? [Musings]

I’ve been plagued for roughly my entire youth and adult life with the desire to create. I found out quick I’m definitely not good at drawing or any like form, I’m decent at playing guitar and singing but I’ve never had the poetic streak to write halfway decent lyrics, I don’t really have an eye for photography, I haven’t tried my hand at motion film but I just don’t get the vibe, I can sorta write but not in a compelling way that will get you to read past page 10, and … hmm I think I ran out of art forms. Well what I’m mostly good at is taking a problem given an innumerable amount of variables, and perceiving the solution, then executing it. So what is that? It feels like creating, it’s not an art form I guess, but sometimes it feels that way. But what really is it, and how can I channel this creative bug I have through it?

From an early age I knew that what I was good at was something like what I now refer to as Sherlock-Holmes-Skills. And also early on I realized that the most logical career path for those skills was either software, mechanical, or electrical design. I mean, they have the word “design” in it, that should assuage my creative urge, right? But when you look up “List of artistic mediums” in wikipedia none of those things really fit. So I dabbled over the years in all those things I listed before. I was met with, not what I would call success, but barely something you would “put up on the fridge”. Early in my adult life I kind of “fell” into the website development industry. I didn’t wake up one day and say “I’m going to build websites!”, it just happened over the course of a couple years. I never finished school, mostly as a casualty of my successful career, so I effectively never gave myself the chance to really find that perfect niche for me.

I think though most people don’t find that niche. And if it seems like I loathe my job, I certainly don’t. I get to go into work every day and effectively put puzzles together. It’s quite enjoyable. But more often than not at the end of the day, as accomplished as I might feel, I often don’t feel like I’ve created something.

So, that’s a lot of words to say: I haven’t found that medium for myself yet. As crazy as websites get, I don’t think they’ll ever fulfill that creative need completely. A lot of me is saying it’s video games, to be a cog in the creative process of making games. If you asked me 6 years ago, I would have said “yes oh yes”. Ask me today, and I’m not so sure. I’ve got friends in the industry, and it seems like they worked so hard to get into that one company, or that one job, and now it’s all about making more money or working at a more plush company. Not many of them still have that passion. They complain about all the things I complain about in that it seems like my job is the same as their job.

Don’t get me wrong I really want to be part of that game-creation-machine. If I wasn’t so happily married to my current company, I would be taking pay cuts, going back to school, and even possibly moving my family, to land that first job at a game developer. But what I don’t know anymore is if video game development would really 100% satisfy that itch I have to create. I don’t know if it would be all that I think it would be. But maybe it is.

Board Games I Want [EuroGames]

We’ve been playing Pandemic and the expansion, On the Brink, like madness. But Robert brought over Power Grid: Factory Manager, and I’m really excited to play it. The problem is he’s taking it back to NYC in a couple weeks, so… I’m going to have to purchase me it. That got me thinking about all the other euro game stuff I want right now: