Set Up a Multi User Install of WordPress

Let’s say you’ve been rolling around the country bartering some light web work for whatever favor fancies you.  Several months later you find yourself in maintenance hell with a million wordpress installations that all need to be updated.  Let me help you.  Set up a multiuser install of WordPress and save yourself some headache.

Let’s start with a little thanks.  Good job WordPress and the guys over at Ottopress.  This was a little easier with the ground work you set.

Here’s a bit of a more condensed setup for the rest of us however.

  1. Backup Your Files
    You know you want to skip this.  Don’t.  Ok atleast back up your .htaccess and wp-config.php if you’re feeling lazy.
  2. Backup Your Database
    The multi-user install creates some tables.  If you want to do this a backup is handy.
  3. Disable Your Plugins
    TIP: Take note of what was enabled, because you will need to re-enable all your stuff later.
  4. Install WordPress MU
    Get your ftp or ssh client handy for this part.

    1. Edit your wp-config.php to include the following line
      /* Multisite */
      define( 'WP_ALLOW_MULTISITE', true );
      
    2. Mash the install button at Tools->Network
      Take a moment to grab a copy of their installation instructions after.  If you do them, and do them wrong, you won’t be able to grab what you need to modify again.
      TIP: The wp-config.php changes you need to make REPLACE the previous wp-config.php change you made in step 1.  I know it looks very similar but its not.  You’ll spend a lot of time searching on the internet as to why everything is borked if you think it is.
    3. Re-enable your plugins.
      Remember when I told you to take note of what was on?
      TIP: if you don’t re-enable your plugins you may end up spending a lot of time trying to make your blog look the way it used to.
    4. Test your site.

You may think you’re done at this point, and maybe you are.  But if you set up a bunch of blogs at different URLs for all your WordPress installs the people you were helping may be a bit dismayed that theirsite.com now has to live at the domain theirsite.yoursite.com.  Let’s install the Domain Mapping plugin to fix that.  But wait–the domain mapping plugin is not a wordpress plugin at all, despite the fact that you can search from it and install it in the plugins section.  If you do that, you will hose your site.

To install the Domain Mapping Plugin:

  1. SSH into your root web directory
  2. Run the following commands to pull the latest copy of the plugin from source control (highly recommended):
    mkdir wp-content/mu-plugins
    chmod 0775 wp-content/mu-plugins
    touch wp-content/mu-plugins/domain_mapping.php
    curl http://plugins.svn.wordpress.org/wordpress-mu-domain-mapping/trunk/domain_mapping.php >> wp-content/mu-plugins/domain_mapping.php
    touch wp-content/sunrise.php
    curl http://plugins.svn.wordpress.org/wordpress-mu-domain-mapping/trunk/sunrise.php >> wp-content/sunrise.php
    

    (Please note, replace >> with >> or use the plain text snippet of the above code — yey safe html)

  3. Add to your wp-config.php:
    //Domain Mapping
    define( 'SUNRISE', 'on' );
    
  4. Go to My Sites->Network Admin->Dashboard
  5. Go to Settings->Domain Mapping
  6. Drop your server IP into the text field.
    This is optional but will make the setup easier for your end users if they own their own domain.
  7. (Optionally) Install The Domain Mapping Autofill Plugin from the plugins panel in wordpress.
    If you are doing the domain setup yourself from the network admin config you can save your self a little runaround to find ids while setting up domain mappings.

Now all you need to do is import all the other blogs, which could be a bit of a time sync as well.

October 23, 2014 • Tags: , • Posted in: Technology

Leave a Reply