The MU forums have moved to WordPress.org

MrBrian wpmu blog defaults (1 post)

  1. boonika
    Member
    Posted 11 years ago #

    Does anyone know what ever happened to this plugin? I can't get it work after recent jump from 2.7.1 to 2.8.6

    <?php
    /*
    * Plugin Name: WPMU Blog Defaults
    * Plugin URI: http://paidtoblog.com
    * Description: Change the default options for WPMU and new blogs automagically
    * Version: 1.0.2
    * Author URI: MrBrian
    */
    
    //------------------------------------------------------------------------//
    //---Change the permalink structure & default category------------------//
    //------------------------------------------------------------------------//
    
    function change_newblog_defaults( $blog_id, $user_id )
    {
        global $wpdb, $current_site, $wp_rewrite;
        //--change permalink structure
        switch_to_blog($blog_id);
        $permalink_structure = '/%category%/%postname%/';
        $wp_rewrite->set_permalink_structure($permalink_structure);
        $wp_rewrite->flush_rules();
        $wpdb->query( "UPDATE {$wpdb->terms} SET name = 'My Projects', slug = 'my-projects' WHERE term_id = 1" );
        //--end
    }
    add_action( 'wpmu_new_blog', 'change_newblog_defaults' );
    
    //------------------------------------------------------------------------//
    //---Change default widgets------------------------------------------//
    //------------------------------------------------------------------------//
    //This activates the given widgets in sidebar-1 and -2. You need to know the internal names of the widgets//
    
     function new_blogs_setting( $blog_id )  {
    
        	add_option( 'widget_categories',
    		array( 'title' => 'Projects' ));
    
       	add_option("sidebars_widgets",
    		array("sidebar-2" => array("Sidebar Login", "links", "pages", "categories", "Blog Topics")));
    
    }
    add_action('populate_options', 'new_blogs_setting');
    ?>

About this Topic

  • Started 11 years ago by boonika