WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#33804 closed enhancement (fixed)

Improve error handling when creating a new site and the user couldn't be created

Reported by: ocean90 Owned by: jeremyfelt
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords: has-patch commit
Focuses: multisite Cc:

Description

There was an error creating the user.

Source: trunk/src/wp-admin/network/site-new.php#L95

You'll see this message when creating a new site, the email doesn't exist but the domain exists as a username because it's used as a fallback.

I think we should add a username_exists() check before calling wpmu_create_user() here.

Attachments (6)

33804.diff (650 bytes) - added by utkarshpatel 6 years ago.
Added check for username exist
33804_1.diff (663 bytes) - added by dipesh.kakadiya 6 years ago.
username_exists check added
33804_2.diff (694 bytes) - added by utkarshpatel 6 years ago.
move condition before generating pass
33804_3.diff (630 bytes) - added by utkarshpatel 6 years ago.
33804_4.diff (656 bytes) - added by dipesh.kakadiya 6 years ago.
username_exists check added & error message updated
33804.2.diff (653 bytes) - added by jeremyfelt 6 years ago.

Download all attachments as: .zip

Change History (12)

@utkarshpatel
6 years ago

Added check for username exist

@dipesh.kakadiya
6 years ago

username_exists check added

#1 @dipesh.kakadiya
6 years ago

  • Keywords has-patch added; needs-patch removed

@utkarshpatel
6 years ago

move condition before generating pass

@utkarshpatel
6 years ago

@dipesh.kakadiya
6 years ago

username_exists check added & error message updated

@jeremyfelt
6 years ago

#2 @jeremyfelt
6 years ago

  • Milestone changed from Awaiting Review to 4.4

33804.2.diff uses the text "The domain or path entered conflicts with an existing username."

I'd be okay changing the error message now for clarity. It would be nice to decouple this experience in the future. If we're creating a site and assigning an admin user, we shouldn't have to care about creating a user at the same time.

Related #14215, #33631

#3 @dipesh.kakadiya
6 years ago

@jeremyfelt

Updated error message has more clarity than previous one.
Thanks for suggestion.

This ticket was mentioned in Slack in #core by sergey. View the logs.


6 years ago

#5 @SergeyBiryukov
6 years ago

  • Keywords commit added
  • Owner set to jeremyfelt
  • Status changed from new to assigned

#6 @jeremyfelt
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34996:

MS: Show an error if a new site slug conflicts with an existing username.

Props utkarshpatel, dipesh.kakadiya.
Fixes #33804.

Note: See TracTickets for help on using tickets.