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.5

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.

419 Comments

Pages: « 111 12 13 14 15 16 17 18 19 20 [21] Show All

  1. Henry Hartley
    #401 | Posted December 12, 2008 at 10:11 am

    Any idea what will happen if I install the new version 2.7 of WordPress? I mean, I guess I could just try and see but it sounds like a big set of changes. Also, do you know if their “automatic update” feature will work with the multiblog setup?

  2. #402 | Posted December 12, 2008 at 10:16 am

    This site is running on WP 2.7 and Virtual Multiblog. No problems. The way VMB works, I would not commonly expect problems from WordPress updates.

    Oh, and automatic update works fine as well. When updating, WP doesn’t delete your config file, nor does it change things in your wp-content folder. VMB is pretty much contained in those two places. :)

  3. #403 | Posted December 14, 2008 at 5:08 pm

    [...] Nerdaphernalia » Virtual Multiblog for WordPress (tags: wp plugins multiple) [...]

  4. #404 | Posted December 15, 2008 at 10:52 pm

    [...] one fine day as I was surfing for plugins, I came across Nerdaphernalia’s Virtual Multi Blog that offers a script (originally used as a plugin) that lets you create multiple blogs using [...]

  5. #405 | Posted December 16, 2008 at 6:15 am

    Are the paged comments on your site working properly? I have been unable to access anything but the most recent few comments in Safari and Firefox.

  6. #406 | Posted December 16, 2008 at 12:23 pm

    Paged comments are working on this page, as you can probably see; but I’m not using the native WP 1.7 ones — I use the Pages Comments plugin. On my test server I’ve been testing out the “native” version, and getting a weird bug (When you post a comment, it takes you to a “comment page” that’s way too high — thus no comments showing.)

    I don’t believe it’s related to VMB, if that’s what your thinking about, but I haven’t fixed it yet — so can’t say absolutely.

  7. Timmy
    #407 | Posted December 16, 2008 at 9:26 pm

    Hi, I’m curious about how to handle other plugin upgrades. Say a plugin has a database change/addition in the upgrade. Most of the time you wouldn’t know if it does or not unless you read the change notes or look at the code. So, how would you handle upgrading a plugin with database changes for each blog after the first one(thinking it would only show as an old plugin once since you just replaced the master files)? Or am I mistaken and it will always show for each blog that you need to update?

  8. #408 | Posted December 16, 2008 at 9:56 pm

    When you upgrade a plugin, you are upgrading the same files seen by all the blogs. The plugin should be able to handle this though — I would be hard pressed to think of a plugin that makes you manually make changes to the database!

  9. Timmy
    #409 | Posted December 17, 2008 at 11:48 am

    Yes, but the database changes are done when you add the new files and run the upgrade in the admin. It would only change the database files that that blog is connected to. So all the files are indeed changed for all the blogs, but what about the database. I’m still not seeing how the database would get updated for blog #2, 3… when you only run the update on blog 1.

  10. #410 | Posted December 17, 2008 at 6:17 pm

    I guess I’m not sure what exactly you mean by database changes. Automatic Update basically deletes the plugin, and installs the new plugin files. That’s all. In VMB you do it for all blogs at once (because they’re all using the same files.)

    If you’re referring to the count of how many plugins have updates available, the other blogs figure it out pretty quickly.

    You can also update plugins at any time via FTP without going through the automatic update function. For other blogs, it’s no different than that — the files are suddenly different.

    Putting it another way — I’ve been using Virtual Multiblog on this site for years now (currently running WP 2.7), and have had no problems with plugin updates.

  11. Timmy
    #411 | Posted December 17, 2008 at 7:53 pm

    No you are missing the point. I’m not talking about the files. I’m talking about the database and any tables or entries the plugins make during installation and updating of plugins. Each blog is not using the same database.

    If a plugin has a table that it added during the initial installation of that plugin. Now that plugin has the 2nd version out and there the author added a field to the table structure. So the 2nd version is to update the table structure. Running the update will update the 1st database.

    How does the 2nd blog know to update its database? Will it show up in the admin of the 2nd blog that it still needs to update even though the files have been updated?

  12. #412 | Posted December 18, 2008 at 7:54 am

    Timmy — In all cases, including a plain vanilla install of WordPress (without VMB), the plugin must handle this itself.

    When you run auto-update on a plugin, all it does is delete the old files and replace them. If you update via FTP, you are deleting the old files and replacing them. (Note: Auto-update does *not* trigger the deactivate/activate hooks in the code.)

    So there is no difference between regular WordPress and running it on Virtual Multiblog, with regard to updates to plugins. If a plugin requires that you manually deactivate/reactivate it, then it will have issues with any of the above scenarios, including regular auto-update. That’s a bug in the plugin.

  13. #413 | Posted December 20, 2008 at 8:33 pm

    Actually, on this site I can only look at the last page of comments posted. The numbered links have no effect on what comments are being shown. (The “Show All” button does work, however.)

    Do you have any suggestions for the question I raised in comment #400? For now, I had to hand edit the VMB files to be specific to my install.

    Also, though I am subscribed to the entry, I never get notification of new comments.

  14. #414 | Posted December 29, 2008 at 2:55 pm

    Regarding pages comments — I’m using the Paged Comments plugin, and the most recent update seems to fix the problems.

    I have not yet gotten the new “WP standard” paged comments working with VMB on my test server, but I don’t know if it’s a bug in WP or VMB or something else entirely.

  15. #415 | Posted December 29, 2008 at 6:57 pm

    [...] Virtual Multiblog [...]

  16. #416 | Posted December 29, 2008 at 10:43 pm

    [...] Virtual Multiblog [...]

  17. #417 | Posted December 31, 2008 at 3:28 pm

    Hi–

    I’m trying to replace my current homepage with a blog. The backend works fine (http://bioquest.org/wp-admin I can build away) but when I try to view the home page it seems to go in an endless loop of loading the favicon.ico over and over again. access.log says this over and over:
    X.X.X.X - - [31/Dec/2008:16:15:34 -0500] “GET /index.php HTTP/1.1″ 301 - “-” “Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″
    X.X.X.X - - [31/Dec/2008:16:15:35 -0500] “GET /index.php HTTP/1.1″ 301 - “-” “Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″
    X.X.X.X - - [31/Dec/2008:16:15:36 -0500] “GET /index.php HTTP/1.1″ 301 - “-” “Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″

    while error.log reports this over and over:
    [Wed Dec 31 16:15:37 2008] [error] [client X.X.X.X] \n\tVirtual Multiblog v2.1.1 — Diagnostics\n\t\tABSPATH = /var/www/Documents/wordpress/\n\t\tVUSER = bioquest.org\n\t\tvmb_get_bloginfo( ‘vuser’ ) = bioquest.org\n\t\t$_SERVER['SERVER_NAME'] = http://www.bioquest.org\n\t\t$_SERVER['PHP_SELF'] = /index.php\n\t\t$_SERVER['HTTP_HOST'] = http://www.bioquest.org\n\t\t$_SERVER['SCRIPT_NAME'] = /index.php\n\t\t$_SERVER['DOCUMENT_ROOT'] = /var/www/Documents\n\tEnd Diagnostics\n\t
    [Wed Dec 31 16:15:38 2008] [error] [client X.X.X.X] \n\tVirtual Multiblog v2.1.1 — Diagnostics\n\t\tABSPATH = /var/www/Documents/wordpress/\n\t\tVUSER = bioquest.org\n\t\tvmb_get_bloginfo( ‘vuser’ ) = bioquest.org\n\t\t$_SERVER['SERVER_NAME'] = http://www.bioquest.org\n\t\t$_SERVER['PHP_SELF'] = /index.php\n\t\t$_SERVER['HTTP_HOST'] = http://www.bioquest.org\n\t\t$_SERVER['SCRIPT_NAME'] = /index.php\n\t\t$_SERVER['DOCUMENT_ROOT'] = /var/www/Documents\n\tEnd Diagnostics\n\t

    Any thoughts on what is going wrong or how to turn up the error log so that I can figure it out?

    Thanks much and HAPPY NEW YEAR!

    Stephen

  18. #418 | Posted January 7, 2009 at 11:01 pm

    [...] Virtual Multiblog [...]

  19. #419 | Posted January 8, 2009 at 9:55 am

    @Stephen — First off, try the latest version of Virtual Multiblog — it’s on 2.5 now. The diagnostic says you’re using VMB 2.1.1.

    Beyond that — without knowing anything about your setup (e.g. where are the actual WordPress files? What symlinks or other domains are you using?) there’s not much I can say from that. Something somewhere is doing a redirect. What’s in your .htaccess?

    (Hint — turn off “pretty permalinks”, comment the WP stuff out of .htaccess, and see what that does.)

Pages: « 111 12 13 14 15 16 17 18 19 20 [21] Show All

Post a Comment

Your email is never shared.

Subscribe without commenting