WordPress.org

Make WordPress Core

Opened 23 months ago

Closed 2 weeks 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:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: Role/Capability Keywords:
Focuses: multisite Cc:
PR Number:

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
23 months ago

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

#2 @swissspidy
23 months ago

  • Milestone Awaiting Review deleted

#3 @cyclic
6 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.

#4 @desrosj
2 weeks ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

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.