WPMU new blog settings plugin

This plugin was updated to work with version 2.6 - see here.

In a new forum thread this week a WordPress MU user asked an old question: how to set the default timezone offset for new blogs? The solution proposed was to edit the wp-admin/includes/schema.php file (line 275). This of course should work but it involves in changing wpmu core files, an option I think is not the best one.

The option I propose is to set the default timezone offset option, and other options as well, using a plugin. This is really simple by using the wpmu_new_blog hook. The entire thing is less than 10 lines of code:

<?php
function new_blogs_setting( $blog_id )  {
//set your options here:
update_option('gmt_offset', 2);
// stop editing here
return;
}
add_action('wpmu_new_blog', 'new_blogs_setting');
?>

The plugin can be downloaded from here (wpmu_new_blog.zip) and needs to be droped in the mu-plugins directory. One can add any other default option settings. In the case were a change of an option for existing blogs is required, the script to set global options for all WPMU blogs may be used.


Did you find this post interesting? Please subscribe to my feed.

13 Responses to “WPMU new blog settings plugin”

  1. very helpful.

  2. Simple, easy and useful. Thanks! Will help in future updates.

  3. I used this plugin to change the default language for a new created blog but it doesn’t seems to work wpmu 1.5.1

    I’ll put the next line in the plugin:

    //set your options here:
    add_option(’WPLANG’, ‘nl_NL’);
    // stop editing here

    But the language is still english instead of nl_NL (dutch)
    What to do to change the default language for new created blogs in wpmu v1.5.1 ?

    Thanks in advance

  4. Try:
    update_blog_option( $blog_id, ‘wplang’, ‘nl_NL’ );

    I’m not sure why this is needed but I think it works. Please let me know.

  5. @Elad - your suggestion re: default language works correctly, once you’ve made the usual quote substitutions which are necessary with code posted in a WP blog. Thanks!

  6. Wondering if this can be used to change the default role for a new blog owner from ‘admin’ to ‘author’? Also, i downloaded, placed n mu-plugins but could not find any reference to it on my site anywhere. Did I miss something?

    Thx

  7. Scot, I guess it could but you will have search for the right option to change.

    This plugin doesn’t have any UI at all.

  8. Hmmm…couldn’t get this to work in WPMU 2.6. I dropped the (edited) file into mu-plugins, added a blog, and nothing happened. Has something changed with the hook in 2.6?

  9. camner - I will check and get back on this.

  10. Hi Elad !
    First of all, thanks for your plugin, a very usefull one !
    Indead, as camner said if before, it doesn’t work on WPMU 2.6.
    Activating the plugin results an error :
    “Parse error: syntax error, unexpected T_RETURN in /homepages/xxxxxx/htdocs/mu/wp-content/plugins/wpmu_new_blog.php on line 19″

    I’ll try to figure out what’s going one, but if you can help, that would be great ;)

  11. Yep, the only bug on your plugin is… Me !
    I forgot to close an “‘” on a delcaration…
    Plugin Activeted Succefully ! ;)

  12. Page with the new version of this plugin links to this page. That link is broken:
    http://www.ringofblogs.com/2007/12/21/wpmu-new-blog-settings-pluginwpmu-new-blog-settings-plugin/

    Cheers

  13. Thanks Boonika - fixed.

Leave a Reply