The MU forums have moved to WordPress.org

Blog specific template (7 posts)

  1. tene
    Member
    Posted 16 years ago #

    I'm looking for suggested implementation approaches for a WPMU specific requirement I have - haven't seen anything similar on this forum.

    I would like to implement a form-based data collection page. For example, Make A Booking - enter name and booking requirements, then press Make Booking button. The form needs to be available to one (or possibly a few) WPMU blogs running on a particular theme (not all users of the theme). Initially it will collect data and the action will be to send an email, but later on it will need to support integration to a client specific merchant account (ie. make a booking and pay for it).

    I am thinking a page template is required (e.g. booking-abc.php).
    By creating a page with this template, the WPMU blog owner (of ABC blog) can use the custom booking template to create a page in their blog. But I wouldn't want this custom booking form appearing for all WPMU users for that theme. Creating a custom widget would not display the form in the main body of the page, and would also have the same availability problem (widget available for all).

    Integrating with a third party form builder is a possibility. Jotform and formlogix seem the main options. However copying/pasting form code has WPMU filtering issues, and Jotform - which has payment integration - uses iframes. Formlogix only seems to support email actions. Any tips about using a 3rd party form builder within WPMU blogs would be appreciated.

    Another approach might be to create a custom template, but modify the lookup function for templates to restrict the choice. (e.g. refer to a blog::template relations table, so an entry for blog_id=56 and template='booking-abc' is required to use the templates).

    I'm thinking there is probably a better way, but can't see it right now. Maybe its even been done and I've missed it. Any suggestions on the best way to approach this kind of requirement?

  2. lunabyte
    Member
    Posted 16 years ago #

    Build a plugin with the form.

    Make it 2 files.

    File 1 example:

    $formAllow = array(1,2,3);
    global $blog_id;
    
    if ( !in_array($blog_id, $formAllow) ) {
         return;
    } elseif( is_page('page-slug') ) {
      include_once(ABSPATH . 'wp-content/mu-plugins/form-plugin/my-form.php');
    }

    This is done to cut server load, and not load up a bunch of code if it's not needed. "Clients" would need to be sure that the page added has the right page slug, as determined by you.

    file 2, inside the mu-plugins/form-plugin/ directory would be the form plugin.

    Put the form into a function, and call the function with an add action hook into the_content.

  3. drmike
    Member
    Posted 16 years ago #

    I'd be real surprised if someone hasn't written a plugin for regular wordpress already. (30 windows open. I can't go check for you.)

    http://codex.wordpress.org/Plugins

    At the very least hacking one of the contact form plugins would probably work.

  4. tene
    Member
    Posted 16 years ago #

    Thanks Luna, great approach, far better than the alternatives I had (right down to performance).

    Your contribution is concise and helpful (as always), and very much appreciated.

  5. lunabyte
    Member
    Posted 16 years ago #

    You're welcome.

  6. andrea_r
    Moderator
    Posted 16 years ago #

    I seem to recall someone wrote a client booking plugin for MU already.

    AHA! here it is:
    http://mu.wordpress.org/forums/topic.php?id=2604&replies=11
    See if that helps.

  7. tene
    Member
    Posted 16 years ago #

    Ah yes, cafespain has done a very thorough job. Thanks for the tip.

About this Topic