Virtual Multiblog for WordPress

<?php echo "Hello Again, World!"; ?>

Note: If upgrading to VMB 2.5 from a previous version, please read the upgrade instructions.

Greetings and salutations.

This is my second blog, which is here to serve as a repository for the really die-hard geekery that I feel just doesn’t belong in my regular blog. When I realized the need for a second blog, installing it ended up being a longer process than i anticipated, and I thought I would share the fruits of my experience.

Let me step back for a moment. I am a true hacker at heart, in the traditional sense: I love to pull things apart and take a look. To see how they work and how they might work better. I’m also an avid Mac-head, and since the rise of OS X, I’ve been learning the ins and outs of its Unix-like underbelly.

In a nutshell, my computer is highly customized.

A few years back I got a second computer — a laptop — and quickly discovered that while keeping one computer tweaked to prime operation just the way I like it is kind of fun, trying to keep two computers in such a state, and relatively synchronized, is a frustrating exercise in futility.

I also know a good bit of web coding. As I’ve been working with WordPress for a couple years now, I’ve come across a number of good plugins and expansions along the way. Beyond issues involved with installing them, (which is admittedly pretty easy, usually) over time I have to keep up with updates to these — not to mention updates to WordPress itself. From time to time I even delve into the plugin files myself and make improvements….

And I want to put in a second blog? Am I nuts??? Thinking of what a pain it would be to maintain two copies of WordPress, I started looking into the various multi-blog solutions people have come up with. Most of them involve a lot of weird modifications to several files and basically comprise major modifications to large swaths of the WordPress code that are fundamentally incompatible with the regular version.

I am a great fan of what I consider “elegant” coding, which means that the designer does his job with the simplest and most straightforward methodology possible. And I found a very elegant solution to the “multiple blog on one install” question. Allan Mertner came up with something that blew me away with its simplicity and power.

WordPress holds all of its data in a MySQL database, and there is a single file called wp-config.php that holds the database login information. Allan looked at this and realized that if you can change that one file, you can completely replace the blog. With this key realization he came up with a cunningly straightforward multi-blog system:

  1. Replace the standard wp-config.php file with a new version that calls a different configuration set depending on what directory it’s in.
  2. Set up symbolic links that serve as “virtual directories” that all point to the WordPress directory.

Using the example of this site, I have an install of WordPress in the root web directory, and a symbolic link called “nerdaphernalia” (that’s right, you’re soaking in it!) that points back to the root. The modified wp-config file points to either the default or nerdaphernalia config file, depending on which of those two directories it thinks it’s in.

So other than a happy user, where do I come in in all this? Well, I made a number of improvements. First, Allan’s system was great, but it required us to install various files in and around the core WordPress files, which for me at least defeats part of the purpose of using a multiblog system in the first place. I’m trying to make updates easier, remember? Updating WordPress generally involves deleting everything but the wp-config.php file and the wp-content folder, and then dropping in the new versions of everything else; but if there are important but non-standard files strewn about, I can’t just do that. I have to remember to go through and preserve those files, and then replace them when they’re done. Add in a few plugins that work the same way, and we have a real hassle.

So first off, I tucked all the files, except for the one modified wp-config.php, into a folder in a safe place. Next, I greatly streamlined the install process. At a minimum, the user only need edit a single configuration file, autoconfig.php. If desired, the various blogs can each have individual config files, but it’s no longer necessary.

I’ve added user-accessible functions (and the really handy VUSER constant) that can be used in themes and plugins. I’ve added the ability to customize the location of the configuration files, so the security-conscious can move them entirely out of the Web directories if they wish. Overall, we are left with a easy but powerful system for running virtually any number of blogs off a single install of WordPress.

Install instructions are included with the download. Still have questions? Check out the readme and the FAQ. (Note: Sometimes the readme will list a higher version than the download. That happens if I have a development version installed.)

User “JZ” is selling written instructions for installing the system. (Please Note: I have not even seen his instructions, I’m just letting you all know.) More info in this comment.

…And if the directions are worth money to you, perhaps the actual software is worth something as well?

Download

Here’s what you’re really looking for: the download link. Have at it!

Virtual Multiblog v2.6.2

History/ Acknowledgements

For a detailed history, please see the readme file in the download.

Many of the improvements to version 2 were based upon or inspired by commenters to my blog. To them, and to everyone who has sent comments, I am grateful.

Good luck. Have fun.

684 Comments

Pages: « 125 26 27 28 29 30 31 32 [33] 34 35 » Show All

  1. #641 | Posted December 21, 2009 at 5:34 am

    Hi.
    I’ve been using VMB for while but only recently i setted up one site to a different root. It took me a bit as styles would not show so I would just suggest you clarify with some additional comments on site configs that would perhaps be of help.

    At site level I’ve have:

    // In WordPress 2.6+ you can change the location of wp-content and/or plugins
    $vmb_const['WP_CONTENT_DIR'] = ABSPATH .’/wp-content-site’;
    //this is relative to site root URL so start with a backslash
    $vmb_const['WP_CONTENT_URL'] = ‘/wp-content-site’;

    I also added ABSPATH. to it.

    As for the main config.php I moved the multiblog to the root (probably makes sense if this feature is supported) and did:

    define( ‘VMB_DIR’, ‘multiblog/’ );
    define( ‘VMB_URL’, ‘multiblog/’ );

    // Set the location of the VMB blog config files if you don’t want them
    // in the multiblog folder. They can be located outside the web root folder
    // for security.

    //configs at new path on root.
    define( ‘VMB_CONFIG_DIR’, ABSPATH .’/multiblog/config’ );

    Not sure if its correct but is working for me and hopefully might help anyone. Using WP 2.8.6

    By the way…we should all buy you buy you a forum to keep this threads… as you’ll soon be reaching 40 pages!!!!

    Many thanks.

  2. #642 | Posted January 4, 2010 at 5:58 pm

    I’m a complete beginner and utterly non-technical. I want to create a website that displays on its home page two seperate blogs and a range of other bits of information. WordPress seems to fit the bill – apart from the ‘two seperate blogs’ bit. Is that what you’re plug-in (is it?) does? I’m so untechnical I’m not sure from the above account whether this is what it does or not — let alone if I could make it work! So here’s hoping…

    Jon

    PS

    I have got far enough to be sure that ‘categories’ is not what I’m after. Basically I want these two:
    theextollager.blogspot.com
    and
    joncannonschurches.blogspot.com
    … to present themselves to every visitor to my webpage, as well as some other more static bits and pieces. If I can set this up in WordPress I’ll move these two nascent blogs over there.

  3. #643 | Posted January 4, 2010 at 7:06 pm

    Virtual Multiblog will not give you two blogs on a single page, which is what you describe. The best I can think of is in fact categories, with a custom Theme to split them out. In any case, if you’re not a coder you would need one to customize things for you.

  4. Henry
    #644 | Posted January 4, 2010 at 8:50 pm

    If I understand you correctly (not always a given) then, as Stephen says, that’s not what VMB does. You have two existing blogs and you want to create a third website that aggregates the posts from those two sites. Is that right?

    If so, then you might want to look into something like the Planet Feed Reader: http://www.planetplanet.org/

    There are others, of course, and I have no idea if Planet is better or worse then those others. I installed it once to mess around with but decided it wasn’t all that useful for me. Your mileage may vary.

  5. #645 | Posted January 6, 2010 at 3:49 am

    @Jon You might consider using WordPress with the Lifestream plugin, which can pull in RSS feeds from other blogs, Twitter etc, and show them on your homepage (or any other page/post) as a single combined stream or individual streams, or both, with various tweaks available for each stream. I use it currently at greeningbrum.org.uk

  6. #646 | Posted January 11, 2010 at 11:03 pm

    I wrote how to manage multiple blogs with small changes.
    This approach need only 10 lines of code modification.

    http://matsu.tymy.net/enblog/2010/multiple-wordpress-bl...

  7. #647 | Posted January 15, 2010 at 10:52 pm

    [...] have a Linode (VPS) set up at http://www.linode.com/ with Apache 2.x, WordPress 2.8, Virtual-Multi-Blog plug-in (which really isn’t a plug-in – but rocks), Rails, Git, and a few other [...]

  8. #648 | Posted January 25, 2010 at 5:51 pm

    Hi. After sometime using VMB I am suddenly having some issues with various plugins (i.e. Contact Form 7) on blogs where I have specified specific content folders via $vmb_const['WP_CONTENT_DIR'].
    Tracking the issue on certain plugins WP functions like:
    plugin_basename( __FILE__ ) returns the plugin’s full path instead of the relative one as stated in the WP codex: http://codex.wordpress.org/Function_Reference/plugin_ba...

    This causes errors on includes as docs full path gets repeated. This won’t happen if the VMB blog does not have its own WP_CONTENT_DIR.

    Out of ideas for now, so any help appreciated.

  9. #649 | Posted January 26, 2010 at 2:49 am

    To clarify my previous entry… having the blog at its own $vmb_const['WP_CONTENT_DIR'] does not directly cause a problem as long as $vmb_const['WP_PLUGIN_DIR'] points to the default WP (wp-content/plugins). The error appears when it points to its own plugin directory (wp-options-blog/plugins) directory or if I don’t set it up and use a symlink to plugins within its contents folder.

    So
    $vmb_const['WP_CONTENT_DIR'] = ABSPATH .’wp-content-vmblog’;
    $vmb_const['WP_CONTENT_URL'] = ‘/wp-content-vmblog’;
    $vmb_const['WP_PLUGIN_DIR'] = ABSPATH .’wp-content/plugins’;
    $vmb_const['WP_PLUGIN_URL'] = ‘/wp-content/plugins’;

    is ok, but this causes the error with some plugins
    $vmb_const['WP_CONTENT_DIR'] = ABSPATH .’wp-content-vmblog’;
    $vmb_const['WP_CONTENT_URL'] = ‘/wp-content-vmblog’;
    $vmb_const['WP_PLUGIN_DIR'] = ABSPATH .’wp-content-vmblog/plugins’;
    $vmb_const['WP_PLUGIN_URL'] = ‘/wp-content-vmblog/plugins’;

    Hope it helps improve future versions. I’ve for now changed the problematic plugins itself, or point to the main plugins folder on other blogs.

  10. hbp ham
    #650 | Posted January 26, 2010 at 1:20 pm

    Hi,

    This might be a noob question but I’m trying to move from one domain into a new domain but can’t get it to work. The table names are all prefixed with the original domain. Any help is appreciated.

    Thanks!
    -hbp

  11. Henry
    #651 | Posted January 26, 2010 at 1:49 pm

    HBP Ham:

    Two things off the top of my head…

    You could change the names of the tables or in your config file change the value of $table_prefix to the old prefix.

    The second option is by far the easiest but the first is “cleaner” in that it gets rid of reference to the old domain name.

  12. #652 | Posted January 27, 2010 at 3:51 am

    hbp ham:
    This is a bit offtopic to do with WP than VMB but just in case if you’ve transfered your database, have you changed the domain references in your options table of WP? They include domain and WP will always redirect to that.

    Also as I am at it… how are the experiences so far with WP 2.9? Specially regarding plug-ins… with the latest issues I had I am planning to wait another few weeks, but would be good to know others experience.

  13. #653 | Posted February 14, 2010 at 9:37 pm

    [...] Go here to read the rest: Virtual Multiblog for WordPress – Nerdaphernalia [...]

  14. j
    #654 | Posted February 17, 2010 at 12:16 am

    Hi

    I am a newbie looking for a solution to similar problem.
    A while ago I came across Wp-MU (multi user).
    Could you please tell me what is the difference between both options and which is better.

    Thanks

    J.

  15. #655 | Posted February 17, 2010 at 9:31 am

    The most basic difference is that WordPress MU has a single admin for all the different blogs; while Virtual Multiblog creates completely separate blogs with separate admin section, users, etc.

    Also, I have heard that in MU it is sort of difficult to add a new blog later after initial setup. In VMB it is quite easy.

  16. #656 | Posted February 23, 2010 at 5:47 pm

    [...] since they are merging the cores of WordPress and WordPress MU. This blog currently uses the Multiblog plugin (well, it’s not really a plugin, but rather a script to allow for multiple blogs under [...]

  17. #657 | Posted March 1, 2010 at 11:09 am

    Hi Stephen. Just made a small donation towards your excellent work. Let me know if you don’t get it as it definitely got sent.

    I’m having trouble with vuser determination – my top vuser blog keeps showing.

    My domains are all pointed using <A> records straight to my server’s IP. I’m using a catch-all virtualhost to direct all my VMB WP domains to the WP directory (to separate VMB blogs from standard flat sites).

    Some domain names (subdomain.domain.com and domain.com) work fine. Newer additions just don’t seem to find their way past default. I’m not using domain.com/blog.

    I’ve tried setting up individual virtualhosts for each domain (no success).

    If I move domains about in the vuser stack, I can get them all to show, but only by making them the default.

    Anyone got any ideas? I’ll keep playing and if I work out why it’s happening or how to fix/workaround, I’ll post back. Maybe I need to use the advanced setup and create domain-specific config files?

    Setup:
    VMB 2.5
    WP 2.9
    Running on a WAMP stack – Windows 2003 Server

  18. Pete
    #658 | Posted March 2, 2010 at 2:53 pm

    OMFG I toyed with this and it actually works. I cannot believe it. I just setup 30 blogs. It took me longer to find this information than to actually do it. I am so happy now. Thank you. This is truly the most important discovery I have made in the WP world since 2006. Thank you again.

  19. #659 | Posted March 2, 2010 at 3:43 pm

    Yes this stuff is great ;)

    It’s nearly 2 years that I’m using it.

  20. harris
    #660 | Posted March 11, 2010 at 6:04 am

    am so happy now. Thank you. This is truly the most important discovery I have made in the WP world since 2010
    —-mcse—-

Pages: « 125 26 27 28 29 30 31 32 [33] 34 35 » Show All

Post a Comment

Your email is never shared.

Subscribe without commenting