Mini-Site Strategy

I’m working on a project to allow a number of mini-sites within a WordPress multisite installation. Here’s how it’s supposed to function:

The client has a large number of individual locations, each of which has their own website. All of these websites are sites within a large WordPress network to allow for centralized user and site maintenance. This part is working already.

Read More

But each location has any number of clients and wants each client to have their own “mini-site” within the network. Essentially a new WordPress site, but housed underneath the location’s site, URL, and administrator list.

Users of the mini-site should only be able to use that mini-site, not the parent site, and not any other site on the network.

As I’ve been working on this, I’ve come across two different ways to set this up. Both are somewhat complex:

Multi-network Installation

WordPress allows you to install several standalone networks with one codebase. It’s like multisite, but on steroids. My first attempt at solving the above problem was to bury a bunch of multi-network functionality in the system. When you added a new client mini-site, you were actually adding a new site to a network “owned” by the parent site.

This half-worked. You could create the sites just fine, but without deeper control over the server (my client asked for a plugin, something they can drop on the server without needing to give me SSH access) it was difficult to get the routing to work in Apache. Some of the new mini-sites would load, others would 404, others would redirect back to the parent site.

The other problem was management. Though you could create as many mini-sites as you wanted (and could verify through phpMyAdmin that they existed), I had difficulty reading back out a list of the sites that were available.

The other problem was database management. Every time you create a new site, you create 10+ new tables in the database. If the site will only ever have 1 or 2 posts/pages, this is overkill.

Custom Post Type with Theme Override

My new approach is to set up the clients as a custom post type. Then, users of the parent site can write new posts and check a field in a meta box to associate the content with a client (using a post-to-post relationship scheme).

When you visit the page for the custom post type, WordPress overrides the display and presents a custom theme (a mod of P2) displaying posts associated with the custom post type.

Not as many problems with scalability here, just in content management. I haven’t quite figured out a way to allow filtering of content from one client to another (remember, content is associated with a CPT based on a meta field, so unless I build out another post management screen, it’s hard to view “all posts for client-x”).

My question:
Which of these approaches is the best? Is there another approach I should consider that might be easier for the end user to work with?

Related posts

Leave a Reply

1 comment

  1. Sounds to me like you are making it more complicated than it needs to be. You already have the author/user as the client – no need to create another concept to represent that.

    Requirements:

    wp network where each subsite has many users (clients)
    Each client wants to have a single page which they can edit and control. (One page only? no posts?)

    so their url is something like:

    network.com/minisite/clients/clientx (subfolder)

    or

    minisite.network.com/clients/clientx (subdomain)

    How to do:

    Use a member/role plugin like Justin Tadlocks free member plugin to create a tailored client role
    with capability to edit page, but not create posts etc (or with php)

    On client registration, add action on ‘user_register’ :

    1. create a client subpage ‘clientx’ under ‘clients’ with client x as
      author name could be based on their details entered or use a
      registration custom field to ask them what they want the name to be.

    Add actions/filters (maybe to look in wp code to find best hooks)

    1. remove add_new from the menu (google wordpress remove menu – I’ve done, just cannot remember now which action)
    2. check if 1 page already created, do not allow more (in case they
      find a way even with menu (WP I don’t think has a create-page
      capability distinct from edit-page, but it may be coming see
      http://core.trac.wordpress.org/ticket/16714
    3. ensure everyone can only see their own pages from the edit-pages list

    Possibily (if there is to be a standard template for client pages):

    1. make the auto created pages have a client template that maybe adds
      in their details from their profile etc. You could even have a
      variety of templates that they could use from the edit page dropdown
      to offer them a choice of layout of details wrt content they type in

    My interest:

    I’m thinking of doing something like this myself and could make it a plugin, so interesting to hear the diffferent requiremenbts that people may have.

    I think the approach above would keep it fairly clean and simple (always a good idea).