WordPress.org

Ready to get started?Download WordPress

Forums

Options Framework
Default options and WP Multisite (2 posts)

  1. asocalguy
    Member
    Posted 1 year ago #

    I'm using Options Framework on a WP Multisite network. When I create a new blog, I'd like to have the user's settings prepopulated with the default values I've set up in options.php. Currently, I have to go in and press the Restore Defaults button to get the defaults to apply.

    Is there a function I can call when the blog is created that will emulate clicking in the Restore Defaults button and save the default values for the current blog?

    Thanks!
    Kevin

    http://wordpress.org/extend/plugins/options-framework/

  2. asocalguy
    Member
    Posted 1 year ago #

    If anyone is curious, this is how I accomplished what I was after:

    // get the array of default option values
    $values = of_get_default_values();
    
    // set the value of one of them
    $values['myfield'] = $myvalue;
    
    // save the option values
    update_option( 'optionsframework', $values );
    
    // force options framework to save its required settings
    // otherwise you have to browse the admin area first to get
    // the settings to "take"
    optionsframework_init();

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic