• I have a nice new multisite install and my goal is to let users register for a new site, but instead of having them be the admin of their newly created site – I want them to be an editor of that site. (I have reasons for this). I’ve done a heavy amount of looking on this, and have the following to say that for me DOES NOT work.

    This is a great thread: http://wordpress.org/support/topic/how-do-i-change-the-default-administrator-role-to-author-for-new-users

    I tried all plugins mentioned in that thread, as well as others, with no success. Main take-away that got my hopes up is to put this into mu-plugins, but this didn’t work for me;

    <?php
    function ds_new_user_meta($blog_id, $user_id) {
     add_user_to_blog($blog_id, $user_id, 'editor' );
    }
    add_action( 'wpmu_new_blog', 'ds_new_user_meta', 10, 2 );
    ?>

    Another almost solution is this plugin that is supposed to do exactly what I want, but is either out of date, or I’m a moron and can’t figure out how to get it to work:

    http://wordpress.org/extend/plugins/new-blog-default-user-role/

    I’ve gone through several other plugins, but still can’t get this to work. Anyone out there with some tips?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ticanupston

    (@ticanupston)

    To update this – I’m getting desperate, so I even tried updating line 81 in wp-admin/includes/upgrade.php – with no success:

    $user = new WP_User($user_id);
    $user->set_role('editor');

    Any thoughts here?

    I haven’t looked at the plug-in in a while. It might not be up to date anymore. I’ll take a look and see if it works for me.

    Okay, I took a look, and the plugin still works. It’s just not doing what you want it to do because it’s not designed to do what you want it to do. Basically, the plugin changes the role someone is assigned to on the main site. OR, if you select roles for other existing sites AND check the box that says “Add user to blogs” a new user will be added to each of the identified sites with the identified role.

    It’s NOT designed to change the role on a brand new blog because that hasn’t been set yet.

    I do a similar thing in the New Blog Defaults plugin. You could probably look at the code there and update the new user’s role to editor after the new blog is created. There may be a rule that each blog HAS to have an owner, though. Are you first trying to make some other account the owner? (Not sure if that rule exists. But, it would be logical.)

    Thread Starter ticanupston

    (@ticanupston)

    DeannaS, thanks for the response. I really appreciate it. I will experiment with New Blog Defaults as you mention..and report back.

    This is all stemming from the fact that I have severely limited the functionality and physical view of the admin dashboard for new users (who are editors). I have successfully set up plugins and a bit of custom code for that.

    The process I currently follow is to manually create a site (at that point I as the network admin am the admin of that site with no other owner or user). Then I add a user to that newly created site, and I can choose to make them an editor, which applies all my admin restrictions for that user. Its simple, but still a manual process.

    What I want to do is to allow people to sign up at wp-signup.php and have that whole process be automated, so when they log in for the first time, they are already an editor, not an admin of their own site.

    Thread Starter ticanupston

    (@ticanupston)

    I am trying to mess with the New Blog Defaults plugin to do this, but can’t seem to get it to work. I’ve tried two strategies: both involve using previously found code to incorporate into the plugin, but I haven’t been able to see success with either strategy.

    Strategy 1: Use the code used in wp-admin/includes/upgrade.php (roughly line 81)

    $user = new WP_User($user_id);
    $user->set_role('editor');

    Strategy 2: Use the code I found on the other post to incorporate into the plugin:

    <?php
    function ds_new_user_meta($blog_id, $user_id) {
     add_user_to_blog($blog_id, $user_id, 'editor' );
    }
    add_action( 'wpmu_new_blog', 'ds_new_user_meta', 10, 2 );
    ?>

    Can you maybe guide me a little more on how to get the New Blog Defaults plugin to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘New site default user role – admin to editor’ is closed to new replies.