The MU forums have moved to

Want to control all default plugin settings (13 posts)

  1. mediafetish
    Posted 15 years ago #

    Wow, I haven't been around here in a long time. Well, anyway, after a long break from wpmu I'm back and loving it. I've been beating my head on the desk on this one though and maybe I'm missing something obvious... can't find anything else in the forums so....

    I'm setting up wpmu to replicate a series of sites (surprise!). I've decided to try to do what I'm doing without modifying the core code at all (last time I did that and, while awesome, it made upgrading impossible). I want a blog/site to come configured with all of the plugins and settings I have selected, etc...

    So - I'm using plugin commander and some default-type plugins (blog defaults is a good one) to set up categories and pages and so on when a blog is created. I've even got the menus fairly customized.

    My question is - many of the plugins I'm installing have settings and options. For the most part, I do not want to give my users the power to change these (read: "hassle" for beginners). So, in addition to the plugins I've selected and the defaults, I've selected - I want all created blogs to use my recommended settings.

    I've considered the following:

    1. Have one blog be considered the 'master' and all other blogs that are created are actually a duplicate of the state of that one at creation... ummmm dunno how to do this though.

    2. Modify the code of every darned plugin to write its defaults the way I want. Somehow this feels wrong to me because of all of the improvements on plugins out there... updating will become a chore.

    3. Come here and see what suggestions people have.

    This may seem like a silly thing to want to do. Consider that all of my users will be non-technical people. I want to give them a site/blog set up as recommended by me, with the pages, sections, galleries, etc, that I say they should have. Ultimately, they'll be able to change it all (I'd love to figure out an 'advanced mode' for the admin) but I want it set up with everything configured according to my whim from the start. Then, as I add features, etc, future blog will have these settings, and I only have to let existing users know of the additions.

    Make sense? Is the best thing to do to mod all the plugins to install their own defaults? Or can I clone a "master" blog at creation? Or... well, whatcha got? Please :)

  2. VentureMaker
    Posted 15 years ago #

    You know, I was thinking about the same thing a while ago :) I have figured out most of the stuff related to new blog defaults (WPMU side) and I wanted to start digging into new blog plugins defaults...

    Well, I thought this would involve hacking plugins files and changing plugin defaults. But your idea of cloning a blog where everything is set up and configured seems quite reasonable.

    Let's see what other have to say ;)

  3. mediafetish
    Posted 15 years ago #

    It might work... I've been thinking it'd be nice to login to my "defaults master" blog and configure everything. Just simple that way. But the task of cloning its settings when a blog is created are over my wp knowledge so far.

  4. mediafetish
    Posted 15 years ago #

    I thought of two more options - some educated opinions would really help...

    One, modify the blog defaults plugin to write the default values for all the plugins I want. Then, all the mods are in one place. Would take some digging to find where all those settings are stored, but then they're all controlled from one panel in my admin.

    I'm leaning toward that one...

    Or instead of modifying all the plugins to write their own defaults, modify them to read their settings from a hardcoded blog, say wp2 or whatever. That makes control of all the plugins universal. But requires modifying every single install or upgrade of every plugin ever... so its not my favorite.

    What I'm secretly hoping is someone will tell me there's a hook I could use in something like get_option or whatever... so I could write a plugin --- if getting option_x then switch to blog x and then switch back...

    Am I dreaming?

  5. andrea_r
    Posted 15 years ago #

    Mmmm... I was going to say #2, but I bet you could write a mini plugin of sorts that writes your desired plugin settings to the options tables needed.

    Just gotta make sure it gets run at the right time.

  6. mediafetish
    Posted 15 years ago #

    After reading some of the code for the blog defaults stuff I'm thinking I'm going to go that route... I'll use the code here as a foundation and add another call for every plugin I want to customize....

    (I like the one with the gui cuz its got, well, a gui... but with the way all the different plugins are written, it's probably best to have a different case for each)

  7. dsader
    Posted 15 years ago #

    I think you have answered your question, modifying new blog defaults plugin is your best option.
    To change setting in existing blogs, my current preference for setting blog options on the fly sitewide is to use PowerTools.(example, changing Daylight Savings Time for every blog. Add a line of code, click execute, done. No sticky residue.

    For maximum stability and consistency(while minimizing user customization), hardcoding plugins and removing the "*_option" calls all together would be best. Squeezing every plugin to minimize load on the server is a best practice in an mu environment IMHO. This will help get_num_queires as low as possible. Jigger the plugin to stop it from "phoning home" for updates.

    If you don't want a user to edit a plugin option, ever, yet still want SiteAdmin to easily change options now and again, converting a normal plugin to an all out mu-plugin may be as simple as changing a plugin's " _option" to " _site_option" and adding "add_submenu_page('wpmu-admin.php' ...". No additional get_num_queires, but no fewer.

    The last method is dreamy. "switch_to_blog('2');" and "restore_current_blog();" wrapped around the each of the plugin "_option" calls may work, but that may add more load than the server should handle, I figure. It has to run that switch from the frontend views as well. When a user changes the options on blog 2 , what then? switch_to_blog will not work for all options, if a core function goes looking for an _option, the core won't have the switch_to_blog so everything may get mucked up. Dizzying additional get_num_queires.

  8. mediafetish
    Posted 15 years ago #

    Was hoping you'd chime in. Thank you for the feedback.

    I'm seriously considering your suggestion about _site_option...

    So, in a general, exceptions understood, way - changing _option to _site_option will cause whatever's calling said option to get the option that I'm using at the site level?

    What if, perhaps I wanted to always get the option for blog 2... or no? Curious. Cuz it'd be cool to have my "site level" options be able to be whatever I want without affecting the children.

    I'm going to go take a serious look at powertools...

  9. dsader
    Posted 15 years ago #

    I've never tried "get_blog_option('2', 'plugin_option_blabbity_blah');" in a plugin.

    Check wpmu-functions.php to see how get_blog_option works in core functions. Quite a chain of events to get_blog_option where get_site_option is as efficient as get_option.

  10. mediafetish
    Posted 15 years ago #

    I'd rather be direct and avoid all the mess. I think I'm going to take your advice and do site option. Then, if I really have a need to have my site be different, I can always run a single install of WP on the root with a different db.

    Let's hope it works! :) Thanks!

  11. VentureMaker
    Posted 15 years ago #

    Hey, guys

    I have found this:

    Can it be used for 'plugin defaults' idea?

  12. skozyk
    Posted 15 years ago #

    Any new progress here? I think being able to preset plugin settings for all new WordPress MU blogs is a crucial feature and I hope a working solution becomes available. Thanks for your efforts.

  13. andrea_r
    Posted 15 years ago #


    Most of us have been recommending you edit the plugin to have the default settings you want.

About this Topic

  • Started 15 years ago by mediafetish
  • Latest reply from andrea_r