Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

No, I've never made a plugin. But I would like to, or find someone who can work with me on it. What I'm hoping to accomplish is setup presets on site creation. I need my multisite to do this:

  1. When creating a site, require information from the user creating it that is not normally requested.
  2. Upon obtaining this information, create the site with a preset path (using the information previously provided)
  3. Then, when logging in for the first time, redirect the site owner to a setup page where they can choose a theme, a layout, and other options.

I know of the wpmu_create_blog function, but am unsure of where to "include.php" it. Also I don't know what function to use for editing the site creation page or how to use this information in the wpmu_create_blog function.

share|improve this question
    
I think this would be great. I'm in the process of looking into something like this and trying to plan something out to help subsite creation. –  NW Tech Apr 26 '13 at 20:58
    
Answering a Q, I ended writing a plugin that resembles your step #1. In #2, I don't understand "preset path". And for #3, I remember seeing something similar here in the archives (like "first time user login"). –  brasofilo Apr 26 '13 at 23:09
    
Let me explain further on the preset path. I want to run a niche website for personal marriage websites. On site creation, I want to require first names of the two being married and the male's last name. Example: Let "M" = Male's first initial. Let "F" = Female's first initial. When a site is created, the preset path will become www.domain.com/m&f-lastname And in addition, their names will be used as the default site title. –  jmalais Apr 29 '13 at 19:22

1 Answer 1

up vote 1 down vote accepted

To create a basic plugin, add a directory in wp-content/plugin, then put a php file in it with the required header, and that's it.

Now, here is how to use the action :

add_action( 'wpmu_new_blog', 'user16975_customize_blog', 10, 6);
function user16975_customize_blog($blog_id, $user_id, $domain, $path, $site_id, $meta ){
    // do not forget to select the correct blog (we are in mutisite admin)
    switch_to_blog($blog_id);

    // You can retrieve the register information in $_POST var, depending on your registration form

    // change the blog name
    update_option('blogname', 'M&F Lastname');

    // change the blog address
    $newurl = esc_url( 'http://' . $domain . 'm&f-lastname' );
    update_option( 'siteurl', $newurl );
    update_option( 'home', $newurl );

    // rename the default article
    wp_update_post(array(
        'ID' => 1,
        'post_title' => 'Long live the newlyweds!',
        'post_name' => 'long-live-the-newlyweds'
    ));

    restore_current_blog();
}

So the remaining part is to customize your registration form. What form do you use to register new users ? If you are using the front-end registration form, you can add custom registration parameters with the signup_blogform action.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.