Can New Blog Templates ignore certain settings?

I have a plugin that also hooks into the new blog creation process and we both collide. The only thing my plugin does is adding a wordpress option into to options table with a option_name and option_value for the newly created blog. These are overwritten by New Blog Templates (as they should), I want to keep every other option that is present in my blog template but this one single field I would like for New Blog Templates to ignore.

Is this something that can be modified in the plugin code or am I left to my own devices?

  • Philip John

    Hiya!

    I presume your plugin is using the wpmu_new_blog hook as well?

    You'll see this is what this plugin uses:
    add_action('wpmu_new_blog', array(&$this, 'set_blog_defaults'), 999, 2); // Set to 999 so this runs after every other action

    That suggests that you can simply have your plugin hook in after NBT like so:
    add_action('wpmu_new_blog', 'your_plugin', 1000, 2); // Set to 999 so this runs after every other action

    How does that work for ya?

    Phil

  • andigonm

    I'm having a similar problem here. (Sorry for re-opening this old post). I've added some code to my functions.php file (instead of creating a plugin) to add some fields to the signup page. Here is the code I've added:

    // Add text field on blog signup form
    add_action('signup_blogform', 'add_extra_field_on_blog_signup');
    function add_extra_field_on_blog_signup() { ?>
    <h3>Wine Shop Information</h3>
    <br/>
        <p><label>Shop Address:</label>
        <textarea name="shop_address" cols="50" rows="8"/></textarea><br/>
        <small>Enter the physical address of your shop. Enter <br/> if you want to split the text in two lines.</small>
        </p>
    
        <p><label>Shop Phone/s:</label>
        <input type="text" name="shop_phone" value="" /> </p>
    
        <p><label>Shop Hours:</label>
        <textarea name="shop_hours"  cols="50" rows="8"/></textarea><br/>
        <small>Enter <br/> if you want to split the text in two lines.</small></p>
    
        <p><label>Copyright Notice:</label>
        <textarea name="copyright_notice" cols="50" rows="8"/></textarea><br/>
        <small>Enter the notice you want to be displayed at your new site footer.</small>
        </p>
    
        <p><label>Facebook page address:</label>
        <input type="text" name="facebook_link" value="" /><br/>
        <small>Leave blank if you don't use this service</small></p>
    
        <p><label>Twitter page address:</label>
        <input type="text" name="twitter_link" value="" /><br/>
        <small>Leave blank if you don't use this service</small></p>
    
        <p><label>Google+ page address:</label>
        <input type="text" name="googleplus_link" value="" /><br/>
        <small>Leave blank if you don't use this service</small></p>
    
    <?php
    }
    
    // Append the submitted value of our custom input into the meta array that is stored while the user doesn't activate
    add_filter('add_signup_meta', 'append_extra_field_as_meta');
    function append_extra_field_as_meta($meta) {
    
        $meta['shop_address']="";
        if(isset($_REQUEST['shop_address'])) {
            $meta['shop_address'] = $_REQUEST['shop_address'];
        }
        $meta['shop_phone']="";
        if(isset($_REQUEST['shop_phone'])) {
            $meta['shop_phone'] = $_REQUEST['shop_phone'];
        }
        $meta['shop_hours']="";
        if(isset($_REQUEST['shop_hours'])) {
            $meta['shop_hours'] = $_REQUEST['shop_hours'];
        }
        $meta['copyright_notice']="";
        if(isset($_REQUEST['copyright_notice'])) {
            $meta['copyright_notice'] = $_REQUEST['copyright_notice'];
        }
        $meta['facebook_link']="";
        if(isset($_REQUEST['facebook_link'])) {
            $meta['facebook_link'] = $_REQUEST['facebook_link'];
        }
        $meta['twitter_link']="";
        if(isset($_REQUEST['twitter_link'])) {
            $meta['twitter_link'] = $_REQUEST['twitter_link'];
        }
        $meta['googleplus_link']="";
        if(isset($_REQUEST['googleplus_link'])) {
            $meta['googleplus_link'] = $_REQUEST['googleplus_link'];
        }          
    
        return $meta;
    }
    
    // When the new site is finally created (user has followed the activation link provided via e-mail), add a row to the options table with the value he submitted during signup.
    // We use 1000 as priority to force it to update the settings after the New Blog Template plugin
    add_action('wpmu_new_blog', 'process_extra_field_on_blog_signup', 1000, 6);
    function process_extra_field_on_blog_signup($blog_id, $user_id, $domain, $path, $site_id, $meta) {
        update_blog_option($blog_id, 'shop_address', $meta['shop_address']);
        update_blog_option($blog_id, 'shop_phone', $meta['shop_phone']);
        update_blog_option($blog_id, 'shop_hours', $meta['shop_hours']);
        update_blog_option($blog_id, 'copyright_notice', $meta['copyright_notice']);
        update_blog_option($blog_id, 'facebook_link', $meta['facebook_link']);
        update_blog_option($blog_id, 'twitter_link', $meta['twitter_link']);
        update_blog_option($blog_id, 'googleplus_link', $meta['googleplus_link']);
    }

    However, when I create a new blog with the New Blog Template plugin installed (and the option to copy "Wordpress Settings, Current Theme, and Active Plugins" enabled), the new blog gets created copying the content for those additional meta fields from the blog template, and not the fields I've added to the signup sequence.

    I've modified the priority at the add_action call to make it run after NBT but it is not working.

    Any ideas?

    Thank you!

  • Timothy Bowers

    Hey there.

    Thanks for posting in this thread, however it might be best if you open your own, even if the issues seem closely related. That way it will remain independent of this one and ensure it doesn't confuse issues here if this thread needs reopening again by the author.

    Posting on old threads can also lead to us missing your questions as you experienced here.

    The staff member that was active on this thread is no longer with our company, so your posts went unseen.

    It also means the member who started this thread or anyone following it isn't inundated with post notifications each time we respond to each other. A lengthy thread could annoy the original

    This also allows us to better track and answer your questions to ensure we don't miss any for ya.

    You can start a new thread here:

    https://premium.wpmudev.org/qanda/

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.