The MU forums have moved to WordPress.org

All Blog Settings (9 posts)

  1. alihan1988
    Member
    Posted 6 years ago #

    How to change all blog settings? (etc:Permalinks)

  2. Klark0
    Member
    Posted 6 years ago #

    http://mu.wordpress.org/forums/topic.php?id=9265

    First post has a plugin. Further down MrBrian shared his code which is what I use.

  3. MrBrian
    Member
    Posted 6 years ago #

    I should mention I revised the code a bit to use the proper functions. This only applies to newly created blogs. If you want to change all the blogs, your going to have to edit WPMU's upgrade script to call the function and then run it like i did once.

    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 = 'Articles', slug = 'articles' WHERE term_id = 1" );
        //--end
    
        //--change default blogroll
        wp_delete_link(1); //delete Wordpress.com blogroll link
        wp_delete_link(2); //delete Wordpress.org blogroll link
        wp_insert_link(array('link_name' => $current_site->domain, 'link_url' => 'http://' . $current_site->domain . $current_site->path));
        //--end
        restore_current_blog();
    }
    add_action( 'wpmu_new_blog', 'change_newblog_defaults', 10, 2 );
  4. Klark0
    Member
    Posted 5 years ago #

    Thanks MrBrian.

    Do you release your plugins anywhere, so we can when they are updated ?

  5. MrBrian
    Member
    Posted 5 years ago #

    At the moment, I don't. When I get some time i'll post some of my stuff to wpmudev.org.

  6. Klark0
    Member
    Posted 5 years ago #

    Before the competition closes, I hope :)

  7. andrea_r
    Moderator
    Posted 5 years ago #

    and that's the wpmu plugin competition over at wpmu.org. :)

    MrBrain, please do submit a bunch.

  8. Klark0
    Member
    Posted 5 years ago #

    MrBrian with your code I'd like to set for example, the default Discussion settings of all new blogs to disable comment moderation and also set the default Avatar to an Identicon. Any pointers?

  9. MrBrian
    Member
    Posted 5 years ago #

    Most defaults inside of the options table can be changed like this:

    function change_wpmu_defaults(){
    add_option('avatar_default', 'mystery');
    add_option('comment_moderation', '0');
    }
    add_action('populate_options', 'change_wpmu_defaults');

About this Topic

  • Started 6 years ago by alihan1988
  • Latest reply from MrBrian