Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#47851 closed enhancement (fixed)

When deleting a user, there is no need to consider whether the current user has content.

Reported by: mt8biz's profile Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.2
Component: Users Keywords: has-patch
Focuses: Cc:


For example, I try to delete two users: the current user with content and another user with no content.

In this case, the current user cannot be deleted, but the existence of the content is checked because $users_have_content contains the current user.

As a result, the question “What should be done with content owned by this user?” Is displayed, but it is not actually processed.

Since it is not possible to delete the current user, how about omitting the current user ID from the user's owned content check process?

Attachments (3)

users.php.diff (1.5 KB) - added by 4 years ago.
users.php.2.diff (647 bytes) - added by 4 years ago.
I'm sorry. Previous file is incorrect
47851.diff (1.9 KB) - added by SergeyBiryukov 4 years ago.

Download all attachments as: .zip

Change History (7)
4 years ago
4 years ago

I'm sorry. Previous file is incorrect

#1 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing
  • Type changed from feature request to enhancement

4 years ago

#2 @SergeyBiryukov
4 years ago

Thanks for the patch! Found a couple of issues:

  • If only the current user is selected, there's a MySQL error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1
  • There's no longer a message that the current user will not be deleted, it's just silently discarded.

47851.diff fixes that.

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

4 years ago

@SergeyBiryukov oh, thanks !

#4 @SergeyBiryukov
4 years ago

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

In 45806:

Users: When deleting users, exclude the current user from the content existence check.

The current user cannot be deleted, so the check is redundant in that context and should only be done for other users.

Props, SergeyBiryukov.
Fixes #47851.

Note: See TracTickets for help on using tickets.