Make WordPress Core

Opened 21 months ago

Last modified 4 months ago

#43018 reopened defect (bug)

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

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


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 (3)

#1 @willgorham
21 months ago

  • Resolution set to invalid
  • Status changed from new to closed

#2 @swissspidy
21 months ago

  • Milestone Awaiting Review deleted

#3 @cyclic
4 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

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.

Note: See TracTickets for help on using tickets.