Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 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 mt8.biz Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.2
Component: Users Keywords: has-patch
Focuses: Cc:

Description

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 mt8.biz 5 years ago.
users.php.2.diff (647 bytes) - added by mt8.biz 5 years ago.
I'm sorry. Previous file is incorrect
47851.diff (1.9 KB) - added by SergeyBiryukov 5 years ago.

Download all attachments as: .zip

Change History (7)

@mt8.biz
5 years ago

@mt8.biz
5 years ago

I'm sorry. Previous file is incorrect

#1 @SergeyBiryukov
5 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

@SergeyBiryukov
5 years ago

#2 @SergeyBiryukov
5 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 5 years ago by SergeyBiryukov (previous) (diff)

#3 @mt8.biz
5 years ago

@SergeyBiryukov oh, thanks !

#4 @SergeyBiryukov
5 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 mt8.biz, SergeyBiryukov.
Fixes #47851.

Note: See TracTickets for help on using tickets.