Default Blog Options

February 26, 2010 in Plugins

The plugin gives you the possibility to copy default blog options into new blogs automatically.It uses one mu blog as a default blog.
All options you select from the default blog will be used for new blogs on a wpmu installation.
After a new blog is created, the first time the dashboard is loaded, the options from the default blog will be copied into the new blog option table.

This is interesting in many situations on a WPMU installation.
If you want to automatically install some plugins with every new blog, there is already a plugin for free, look here http://wpmudev.org/project/wpmu-plugin-manager.

With wpmu-plugin-manager you can have control over the plugins, but not over the setup of the plugins.
So you need to configure all the options and settings every time a blog is created.

To get rid of this nasty work, I developed this plugin.

How it works:
Just create a blog as default blog.
Install all the plugins on this default blog you like to run on everey new blog.
After you made all the needed configuration to your plugins and they work as they should work on every new blog, your work for this blog is done.

Now all you need to do is, go to the main blog to Admin/default-blog-options.
First you have to enter the blog ID of your default blog.
When done, you will be able to select the options you’d like to have in every new blog.

Once you have all the options selected and saved, you are finished.

Every time a blog is created, the blogoptions are copied from the default blog like you selected before.

Please give me some feedback, and let me know about the bugs you find.

:-Sven

Download: Default Blog

and support us: PAYPAL

Default Blog Options

77 Comments

    1. semir says:

      Hi,
      Your plug-in is pretty nice, it make my configuration easier ;-) It work on my WP MS 3.0.1
      I have some minor questions:
      1) I try to get the static font page form my default site I have selected the option in Setting>”Welcome page” or in Option table (page_on_front, and show_on_front) but I haven’t on the new blog the default value for “show_on_front” … have you some suggestion?
      2) I try to copy my nav_menu option on advanced option but my menu is not copied and active…

      Your suggestion wold be appreciated
      Thanks Semir

      Sorry for my bad english…

    2. mene says:

      sorry for posting again but would it be possible to make any person who creates a blog to get the default blog settings ?

      thanks

      //mene

    3. mene says:

      Hi, would it be possible to let any person who registers a new blog/site to get the default blog or is it only the super admin creating one ? because for me its only me who is super admin that gets the default blog.

      thanks for a greate plugin

      //mene

    4. alex says:

      Hi There
      i tried using your plugin, but nothing is being displayed when i select my default blog. Any reason for this?

    5. Poor Uncle says:

      I am using wp multisite 3.0.1. I installed the plug in, set my default blog template for appearance, links, posts, and pages. I create a new site. Nothing happen in terms of copying anything over to the new site. Any ideas?

      • Sven Wagener says:

        Hi Poor Uncle,

        maybe you have annother plugin that does anything if youre creating a new blog. Normally the plugin copies the values if youre creating the new blog.

        Best regards,

        Sven

        • Ivan Volkov says:

          I have the same promlem, the same software. Nothing happen in terms of copying anything over to the new site.

          Before create a new site I disable any other plugins.

          More ideas?

    6. Ash says:

      Hi
      I really want to use the plugin in our corporate environment, but i am testing it on a local installation – i dont get the pages listed in the pages tab, but categories seem to display. So what may be the reason for pages to be gone? When i check the DB for the newly created site, the old standard About pages are added. How can i fix this?

    7. Ash says:

      HI guys
      Does your plugin work if i test localy?
      Cause i activated it ok. Then i go to select the blog that was already created with pages. And use it as a default, but nothing shows up in pages part? What may be wrong?

      PS – i have been searching a week for how to do such a thing – we really need your plug in.

      • Ash says:

        Also, i see that when i create a site, it is added in the DB, but with usual pages (About, hello world). But categories seem to be visible when i add them – so this tab works.I did not set up the wildcard and test localy – is this the reason (though i wanted to see at least the result in DB) or chose the pages of the default blog – that is created and works. I am so waiting your reply.

    8. Steffo says:

      The Problem was i don’t use wp_ as database prefix. Changed it in pages & posts-file

    9. Steffo says:

      Just noticed Brians solution, I’ll try it out first, so don’t mind my comment for now…

    10. Steffo says:

      I just installed this plugin on a site running WP 3.0.1 multisite. I created a default blog, selected it in the Default Blog admin and clicket update.

      I click around in the tabs but NO pages, posts or settings appear…

      I activated the 0.3 version of your plugin in the whole network by the way.

      Any ideas on this?

    11. josh says:

      hi sven
      when i activate the plugin I get this error when trying to visit a newly created blog.

      Fatal error: Call to undefined function wp_get_current_user() in /home/meds/public_html/sheilaswheelsinsurancequote.com/wp-includes/capabilities.php on line 1059

      When I deativate, the error goes away. I am using the latest wp mu.
      thanks

      • josh says:

        Sven
        It was my autoblog plugin which was erroring. do you have a recommendation for an auto blog plugin which will not error out? Thanks

    12. Brian says:

      I’m having trouble including custom post types. Is add_action('wpmu_new_blog', 'initialise_blog'); running before the custom post type is setup in my theme? I have it happening on

      add_action('init', 'billboard_register');

    13. Brian says:

      I ran into a possible problem and thought I would post the solution. I was only getting options for categories and tags after setting my default template. This is the result of two things.

      if you change the table prefix from _wp.
      if your default template is your first site. The table does not have a number like the rest
      Below is the solution for the admin-default-blog-pages.inc.php. I have not done it yet, but I’m sure you can apply the same idea to the other files

      Original

      if($_POST['pages']!="" && !isset($_POST['defblog_submit'])){ $selected_blog_pages = $_POST['pages']; }

      $sql="SELECT * FROM wp_".$defblog_id."_posts WHERE post_type='page' ORDER BY post_title";

      Fix


      if($_POST['pages']!="" && !isset($_POST['defblog_submit'])){ $selected_blog_pages = $_POST['pages']; }

      if($defblog_id == 1) { $the_sql="SELECT * FROM xx_posts WHERE post_type='page' ORDER BY post_title"; }

      else { $the_sql="SELECT * FROM xx_".$defblog_id."_posts WHERE post_type='page' ORDER BY post_title"; }

      Notice SELECT * FROM wp_ changed to SELECT * FROM xx_. You would sub in your prefix for xx.
      The conditional statement just says if the default blog ID = 1 don’t include the _#_ just write it normal like wp_pages.

      If this plugin works as expected, Sevn & Konrad if you ever travel to San Diego I’m taking you to Disneyland.

      • admin says:

        Hi Brian,

        you’re right. The table prefixes aren’t integrated yet. They will be integrated in the next version.

        Sven Wagener

    14. semir says:

      Hallo,
      I have found your plug-in and it seems to be a great solution for our community, I have installed the new version 0.4 but It didn’t work for me …
      I have access on the first tab (Blog) but not to the oder tabs (post, categories, …) I have checked on firebug I get this error:

      <q vite"$("#tabctnr").tabs is not a function
      [Break on this error] $('#tabctnr').tabs({ fx: { opacity: 'toggle' } });
      admin….r=3.0.1 (ligne 4)
      $ is not a function
      [Break on this error] $(function() { $(“#config-tabs”).tabs(); });
      ms-adm…earance (ligne 904)”>

      I have deactivated all the plug-in I use and I have the same issue, I use WP 3.0.1 MS and BP 2.6

      I hope you understand my bad English
      Thanks for your support
      Semir

      • admin says:

        Hi Demir,

        the problem is known. The reason seems to be a double include of Ajax. We try to fix it as fast as we can.

        Thank you!

        Sven

    15. Vitalik says:

      Hello. Your plugin is very useful but i have some problem. When i create a new blog as admin the setings copy well but when I registered a new user nothing happend, the seting do not copy to new blog.

      • Sven Wagener says:

        Hi Vitalik!

        I can’t reproduce your error. The script usually have to be runned on blog activation. There should be no depence on creation by admin or by creation by the a user at the website.

        Which versions do you use?

        Thank you!

        Sven

    16. Lee H says:

      I can’t express enough how grateful I/we are that you are developing this plugin. I’ve been searching the net for weeks trying to find a plugin/code snippet or anything relating to putting “our sites custom default options and plugin settings” into our new blog users settings right off the bat. I’ve only seen comments saying that sort of thing just can’t be done. Your approach was so simple that no one else thought of it. Hat’s off to you my friend. Upon installing your plugin my heart sank a bit as it wouldn’t work for me out of the box. Each time I set my default blog, I’d get the message that the default blog was saved, but the form would always be set to the main blog (ID 1). I was stuck. This morning I went through your code and I “think” (I’m far from good at php) I found the problem.

      line 9 admin.inc.php:
      code if ($defblog_id != “”){/code
      should actually be:
      code if ($defblog_id == “”){/code

      Changing this opened up all the doors for me and I was able to select options as expected from the tabs, and the form would show my chosen default blog selected in the drop down on refresh. Nice!!! So my test user created his new blog and entered his dashboard to find the settings had been applied. Thanks so much!

      Although I found a bug. When going into the newly created blog dashboard I got a php warning at the top of the page.
      codeWarning: implode() [function.implode]: Invalid arguments passed in /opt/lampp/htdocs/wp-content/plugins/default-blog-options/functions.inc.php on line 217/code
      This was caused because I had not elected to choose any pages when setting up the “default blog”. implode failed because the pages variable was unset.
      my hack for this error was to change line 217 on functions.inc.php from this:
      code$new_pages=get_pages(“include=”.implode(“,”,$pages));/code
      to this:
      codeif($pages!=”"){ $new_pages=get_pages(“include=”.implode(“,”,$pages));}/code

      Once again… I’m in no way a php coder. I know just enough to get myself in trouble. So certainly there is a better way. But it’s working for me.

      Oh yeah… I’m working with 0.22 – beta.
      Hope this is useful for anyone reading.
      Cheers!

      • Sven Wagener says:

        These bugs aren’t bugs anymore ;) It’s enjoing me, thats the plugin helps you so much.

        Now the plugin is WP 3.0 compatible with a new GUI and better set up routine for new blogs.

        Now every time you create a new blog the settings will be set immedieately.

        There will be more functions coming up in a pro version of the plugin.

        Roadmap for pro version:

        - Creating Blog templates and saving it
        - Selecting Blog template on creating a blog
        - Copy Menues
        - Copy Plugin settings
        - Setting um permalinks

        and so on ;)

        If you’ve got any other ideas, feel free to tell it!

    17. Thadues says:

      I am using the plugin on 3.0, but when I select the default blog, it says the ID is saved, but does not allow any further options…for example when I go to edit which pages should be copied, the plugin does not pull the pages of the blog I selected as a template. In fact, it doesn’t pull any pages – the only option is to delete all pages.

      Afer doing some testing on it, it looks like the categories is about the only option that is working properly.

      Honestly, I just want to echo others saying this plugin will rock! I’m really glad you are making efforts to get it working.

      Any time frame on a fully functioning version for WP 3.0?

    18. Hi, we are trying to use your plugin but it has a lack of functionality or BUG, as you want :-)

      When the plugin call the function copy_plugins, it only update the blog option active_plugins, it’s a mistake! Because if a plugin needs database tables or something else that it called with the action activate_plugin, it breaks.

      Here is the correct copy_plugins that call WordPress functionality


      // Updating plugin settings of blog
      function copy_plugins(){
      global $defblog_id;
      $global_blog_plugins = get_blog_option(SITE_ID_CURRENT_SITE,'default_blog_plugins');

      // Copy active plugins
      if($global_blog_plugins["active"]==true){
      $active_plugins=get_blog_option($defblog_id, 'active_plugins');

      foreach ($active_plugins as $plugin){
      $return = activate_plugin($plugin);
      if (is_wp_error($return)){
      //The plugin can't be activated
      }else{
      //plugin activated OK//
      }
      }
      }
      }

      Another question, in all plugin you use pieces of code like this


      switch_to_blog($defblog_id);
      $current_template=get_option('current_theme');

      There is a function more efficient, we have a very big blog to duplicate and the plugin crash

      $current_template=get_blog_option($defblog_id,'current_theme');

    19. Tuan Anh says:

      I can’t save default blog. It Always back to Main blog? I use BB 1.2.4.1 and Mu 2.9.2

    20. admin says:

      Hi @All, Thanks allot for all your feedback.

      We are just too busy at the moment.
      The plugin is still in development and will become stable in the nearest future.

      Sorry for the delay.

    21. josh says:

      If you can get this working I would be happy to donate/pay you for this. This would be the greatest plugin ever created if you can just make it work. Please please get this working there are many of us out there in the community whose lives would be changed by this. Sorry for the drama, but I am serious. This plugin will put food on my table.
      Thanks again.
      Josh

      • Sven says:

        Hi Josh,

        I need detailed informations for getting your bug fixed. Which part doesn’t work?

        Sven

        • josh says:

          Hi Sven
          I just get the blue tabs at the top, but nothing is clickable.

        • josh says:

          Hi Sven Sorry it took me a few days to get back to you. I am getting this error when I press the update button under each of the tabs and the settings are not being saved.
          Warning: stripslashes() expects parameter 1 to be string, array given in /home/attorney/public_html/newyork-electrician.net/wp-includes/wpmu-functions.php on line 262
          Thanks for your time and effort
          Josh

      • alex says:

        I am actually thinking the same – if it works, its a gem worth paying for.

    22. Sleenie says:

      This looks to be a GREAT plugin, it is exactly what I’ve been looking for and am in dire need of having. Right now I have it installed but all I get are the tabs. I really can view anything under those tabs like in the screenshots. I’m more than willing for a good donation if this gets to working. I’m sure there are many who feel the same way.

    23. Wasi says:

      your plugin (all versions) is giving this error.

      subcontent is null
      subcontent.style.display=(subcontent.id==subcontentid)? “block” : “none” //”show” or hide sub content based on matching id attr value
      tabcontent.js (line 96)

      • Sven says:

        Hi Wasi,

        this problem will be solved, if we have inserted the WordPress GUI. This will be in the next weeks.

        Thank you!

        Sven

    24. Gareth says:

      Hi there, any plans to update the plugin for WordPress 3? The UI looks like its broken. This functionality is vital and should be built into the core! Cheers.

      • Sven says:

        Hi Gareth!

        I’ll look for this in a few days. I’m a bit busy at the moment.

        Thank you for your info.

        Sven

    25. Steph says:

      I get the same problem as Justin and Vinicius. Also with the latest BuddyPress and WordPress 2.9.2 No content is being sent.

      • Steph says:

        What I did that “seems” to have solved the problem, I delete line 9 and 21 of admin.inc.php :
        if ($defblog_id != “”){
        and the corresponding
        }

        I’m not actually sure why that is there. Maybe the Author can enlighten us.

        • Sven says:

          Hi Steph,

          sorry for answering so late. I’m a bit busy, so I will fix the bug in some days.

          Thanks for your Information!

          Sven

        • phil says:

          thanks steph, this is my solution
          if ($defblog_id == “”){
          $defblog_id = “1″;
          }
          include(“admin-default-blog-defblog.php”);
          include(“admin-default-blog-posts.inc.php”);
          include(“admin-default-blog-pages.inc.php”);
          include(“admin-default-blog-links.inc.php”);
          include(“admin-default-blog-cats.inc.php”);
          include(“admin-default-blog-tags.inc.php”);
          include(“admin-default-blog-design.inc.php”);
          include(“admin-default-blog-plugins.inc.php”);
          include(“admin-default-blog-settings.inc.php”);
          include(“admin-default-blog-options.inc.php”);

          • Sven says:

            It make sense ;-) The bug will be fixed in the upcoming version in the next hours.

            Thank you for your work!

            Sven

    26. Vinicius says:

      I noticed some issues on my wordpress MU (2.9.2) test site. The Default Options page is always blank, it’s only display links on a blue menu: Blogs/Posts/Categories…

      I instaled the plugin, activated the site wide feature, then created a new blog.

      Maybe i’m missing some step, anyone could help me? This plugin will be very appreciated!

    27. Justin says:

      I can’t get this plugin to work. It installs correctly (sitewide) but when I click in my admin panel to set the default blog, all I get is a nonworking menu. No other content. I have the latest Buddypress and WPMU. Maybe a plugin conflict?

    28. Sven says:

      Version 0.2 beta released:

      - Tags can be copied too. Default blog can be selected in a dropdown list.

      - Inserted design, plugins and settings tabs with settings for it.

    29. Sven says:

      Today I’ve made some important updates:

      - Categories can be copied now.
      - Post an page meta where copied now.
      - Parent pages where set correct.
      - Default blog couldn’t be set after setting main blog to defaul blog. Now it works.
      - Tabs where shown now. CSS and JS wasn’t linked correctly.

      Just download Version 0.14 beta and get your update.

      Happy testing! ;-)

    30. Benjamin Knight says:

      If the new version is experimental and shouldn’t be implemented on live sites, why was it pushed as an upgrade? Also not sure I understand what the two bugfixes you’re talking about were. Content was getting deleted for all existing blogs upon dashboard visit? If this were really the case that would be a serious problem, but I never noticed anything like that in using this plugin…

    31. Sven says:

      New version is out:

      0.11

      Heavy Bugfix: Content of existing blogs have been deleted, if dashboard was visited and plugin was active. Now plugin won’t run anymore for blogs which have been created before plugin was enabled.

      Bugfix: Warning won’t be shown anymore, if blog dashboard was visited the first time

      New function: Added tabs to the admin area.

    32. Benjamin Knight says:

      Sven, is it possible to have the pages and categories of the default blog be copied into newly created blogs as well?

    33. admin says:

      @RoyDeanJr,
      Thanks for the detailed bug report, and sorry for your trouble.

      The plugin is 0.1, and it looks like it needs more attention to work probably.

      We will have a look into it and let you know.
      I will try to reconstruct your bug and will see how to get back the post.

      But it wouldn’t be before eastern.

      • RoyDeanJr says:

        Sven, Thank you for your reply.

        I looked at the data and it seems the records with post_status=publish and/or post_type=post have been deleted from the wp_?_posts table.

        Without a backup there does not seem to be a way to get it back.

        Maybe you could use the “send to trash” technology in WP so that if it happens again the admin can recover from the trashcan.

        I am in the process of editing all of the latest posts to flag them as publish and post.

    34. RoyDeanJr says:

      Sven, how do I get the posts back from the affects of Default Blog?

    35. Sven says:

      I’ll take care for these errors next week. Until Sunday I’ll be too busy to do anything.

      Thank you for testing!

      Sven Wagener

      • eden says:

        thanks for this plugin buddy, here is some bugs ive found:
        I’ve tried it with bubbypress but it afected my main blog that was already created…

        This plugin would be much better if you just select a blog and click COPY, because then we would be able to use any blog as default for a new one without the need to check all those options again and again…

    36. Oliver says:

      The Plugin does not seem to have any effect on new blogs (after installation & setup). I double checked if all desired options are checked in the setup and if the Blog-ID is correct.

      I am running WordPress MU 2.9.2.

    37. fgjfg says:

      guys your plugin doesn’t work on wpmu with buddypress. you always mention that it is going to affect only new blog, but ALL the posts of my main buddypress blog (id =1) have been deleted (not even put in thash!), after i set a child blog as default blog (id = 5). such things may never happen.

      • RoyDeanJr says:

        I had 4 blogs and a number of users had contributed and now nothing shows on the blog pages. I did check the option to delete all posts, pages and blog links and then proceeded to visit existing blog dashboards. Then when I visited each blog I saw nothing! What happened to everything?

        I did some research and I see that there are still post revisions in the wp_1,2,3,6_posts tables. How do I resurrect those records so the posts come back to life?

      • Sven says:

        The problem is no solved in Version 0.11. The problem was, that the script runned on all blogs, including the old blogs. Now old blogs won’t be touched anymore by the plugin.

        I also removed the warning on the dashboard, if the blog was visited the first time and added Tabs to the admin for better navigating.

    38. Scot says:

      Hi

      I will test this straight away. This is a remarkable plugin for WPMU. Bravo!

    39. Jochen says:

      This plugin makes my life complete, it just needs the option to also »get all categories« from the main blog!

      is that possible somehow?
      thanks!

    40. admin says:

      Yes, this should work. You can use the plugin to manage default widgets options.

    41. Jack says:

      Does this handle widget configuration also?

Default Blog Options

0 Trackbacks