Allow role besides Admin to add users

I am using wpmu to create a main corporate blog as well as a parent login where they can see multiple blogs with their children etc. (We help kids with disabilities). I want every blog to have a corporate theme and be very uniform so I do not want to give out the ADMIN role to users. I do however want Editors to be able to sign up new users using this plugin. I do not want an open registration system due to privacy concerns. We just want parents to be able to login so we want to assign user names.

Question: IS there anyway to shut off open registration on the blog but still allow a user with an Editor role to manually sign up users from the dashboard?

Thanks!

  • richslack

    Just thought I would post my work around. I am using wpmu and I installed the "Capability Manager Plugin" to add additional capabilities to my contributor and editor roles (i.e the ability to add new users). Registration has been turned off for all blogs and new users in the site admin, to control access, so they were not seeing the "Users" menu. I had added the role "Create Users" as a cabability but the user menu still did not show up.
    Finally, I thought if I gave them all the user rights it might show up. So I added "Delete Users" "Create Users" and "Edit Users" and now the user menu is showing up. It works!

    It does not let them batch create users like the "Add New Users Plugin" but it is sufficient.

  • drmike

    *shrug* I edit core without issue.

    If I was to do this, I would modify /wp-admin/includes/schema.php. I believe the ability you want is edit_users since a quick google doesn't turn up add_users anywhere.

    Take a look here:

    http://trac.mu.wordpress.org/browser/trunk/wp-admin/includes/schema.php#L488

    $role->add_cap('edit_users');

    I would take that line and add it in for the editors bit down after line 515. At least for a new install.

    If this is a current install, you run into the problem that the upgrade script is not plugable even though this was asked for. (edit: I can;t find the trac ticket right off but it was closed with a wontfix.)

    Haven't tested this but add in around line 453:

    populate_roles_290a();

    The a just in case Automattic kicks out their own 290 sometime in the future.

    At the end of that file before the closing ?>, add in the following:

    function populate_roles_290a() {
    $role =& get_role( 'editor' );

    if ( !empty( $role ) ) {
    $role->add_cap( 'edit_users' );
    }
    }

    And then run the upgrade blogs script.

    I haven't tested the above. It may not work but that's what I would do. Or at least try.

    Hope this helps,
    -drmike

  • richslack

    Good points, and I appreciate the feedback! Luckily in my case each blog is a carbon copy, except for the users that are allowed to edit it. I was going for a uniform look and feel. I am just using the "blogtemplate plugin" to create the new sites in a matter of seconds (change the title and I am good to go). Since the permissions are already set up on the templated site I do not have to recreate them each time.

    It seems like I had to give the edit and delete capability to force the Add User option to show up in the sidebar. Perhaps it was a cache refreshing issue but it seems like Add User did not show up until I did add those options. However, in my case it does not matter as I want the Authorized subscriber management team to be able to delete the other users once we are no longer serving their kids. It is an all or nothing login. I.E. once you log in you can see all blogs. When you no longer should be logging in to one we do not want you to see any. Etc.

    Again, thanks for the feedback!! It gave me better insight and hopefully it can help someone else as well.

    Rich