WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#47851 closed enhancement (fixed)

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

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

Download all attachments as: .zip

Change History (7)

@mt8.biz
14 months ago

@mt8.biz
14 months ago

I'm sorry. Previous file is incorrect

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

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

#3 @mt8.biz
14 months ago

@SergeyBiryukov oh, thanks !

#4 @SergeyBiryukov
14 months 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.