The MU forums have moved to WordPress.org

Changer user role on new blog creation (9 posts)

  1. mdgross
    Member
    Posted 15 years ago #

    When a new blog is created the accompanying user is configured by default as an Administrator. I'd like to change this to Editor instead. What is the best way to go about this?

  2. mercime
    Member
    Posted 15 years ago #

    Site Admin > Blogs - click on BackEnd link of new blog created then when you're there, go to Users and choose name and then in profile change role to Editor

  3. VentureMaker
    Member
    Posted 15 years ago #

    There exists a plugin to set default roles. Don't remember its homepage, I can drop it to you via email :)

  4. dekztah
    Member
    Posted 15 years ago #

    can you please post it here?

  5. VentureMaker
    Member
    Posted 15 years ago #

  6. VentureMaker
    Member
    Posted 15 years ago #

  7. mercime
    Member
    Posted 15 years ago #

    Thank you for sharing VentureMaker :-)

  8. mdgross
    Member
    Posted 15 years ago #

    Thank you for your suggestions. I borrowed from the concepts mentioned in this thread and wrote this plug-in.

    <?php
    /*
    Plugin Name: WPMU New Blogger Default Role
    Plugin URI: http://www.michaeldgross.com
    Description: Automatically set the default role of new bloggers.
    */
    
    function new_blog_settings($blog_id)
    {
    	switch_to_blog($blog_id);
    		query_posts('showposts=1');
    		if(have_posts())
    		{
    			the_post();
    			if(get_the_author_ID() > 1)
    			{
    				$user = new WP_User(get_the_author_ID());
    				$user->set_role('editor');	// WPMU default is 'administrator'
    			}
    		}
    	restore_current_blog();
    }
    
    add_action('wpmu_new_blog', 'new_blog_settings');
    
    ?>
  9. developdesign
    Member
    Posted 14 years ago #

    VentureMaker - It looked promising, but didn't change anything for me on wpmu 2.7.1. I tried it on two installs, one with buddypress and one default wpmu.
    I liked how it could be changed in the main Admin area, but didn't work.

    Hey mgross, your code worked. I saved it as a PHP file and put it into the mu-plugins folder. It would be great if I could also change it from within the Main Admin area like http://wpmudevorg.wordpress.com/project/default-user-role

About this Topic

  • Started 15 years ago by mdgross
  • Latest reply from developdesign