Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#43018 closed defect (bug) (worksforme)

Multisite: Adding a new user to a site with non-Subscriber role adds Subscriber user

Reported by: willgorham Owned by:
Priority: normal Milestone:
Component: Role/Capability Version: 4.9.1
Severity: normal Keywords:
Cc: Focuses: multisite

Description

When attempting to add a new user to a site on a multisite network with any role that isn't Subscriber, the new user is saved as a Subscriber no matter what role you select.

To reproduce:

  • Have a multisite network with some sites.
  • Log in as a super admin, and go to a site dashboard (not the network dashboard)
  • Go to Users > Add New
  • In the Add New User section (not Add Existing User) add new user details and select a non-Subscriber role.
  • Check the box to skip a confirmation email. Submit the form.
  • View all users and see that the newly created user is a Subscriber

I came across this issue when developing a plugin which creates a custom user role, but this seems to apply regardless of the role type.

Looking through the codebase, the desired role is submitted correctly into POST['role'], and saved into the meta field of the _signups table as 'new_role'. Then wpmu_activate_signup() is called, which calls wpmu_create_user(), and then wp_create_user(), creating a capability-less user. The submitted role doesn't look like it's ever handled in user creation / linking to

Change History (4)

#1 @willgorham
9 years ago

  • Resolutioninvalid
  • Status newclosed

#2 @swissspidy
9 years ago

  • Milestone Awaiting Review

#3 @cyclic
7 years ago

  • Resolution invalid
  • Status closedreopened

This is still a problem in 5.2, I regularly have to change user roles after they activate because the role I select when I "Add New User" is not the role they end up with - it's always subscriber.

#4 @desrosj
7 years ago

  • Resolutionworksforme
  • Status reopenedclosed

I am unable to reproduce this behavior using the latest release of WordPress (5.2.4 as of this comment). I have tried several times using different roles and checking/unchecking the skip confirmation option.

Closing out. If anyone is able to reproduce this, please try reproducing with:

  • No plugins active
  • A fresh install

If you are still able to reproduce, please provide a more detailed explanation of the steps you are taking and the configuration you have.

Note: See TracTickets for help on using tickets.