Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

#6981 closed defect (bug) (fixed)

PHP debug notices when deleting a WordPress user

Reported by: henrywright's profile henry.wright Owned by: djpaul's profile DJPaul
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5.0
Component: Core Keywords: needs-patch good-first-bug
Cc:

Description

Steps to reproduce:

  1. Disable BuddyPress
  2. Create a new user by going to Users > Add New in the admin area
  3. Enable BuddyPress
  4. Go to Users > All Users in the admin area
  5. Tick the checkbox next to the user you just created.
  6. Select Delete from the "Bulk Actions" option list and click on the Apply button.

Attachments (1)

screenshot.png (231.2 KB) - added by henry.wright 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
8 years ago

  • Keywords reporter-feedback added

@henry.wright It'd be useful if you could copy/paste the debug notice for reports like this, please. :)

#2 @henry.wright
8 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

@DJPaul I just tried to grab a screenshot for you but I can't seem to reproduce this problem now. I will close and reopen if it happens again.

#3 @henry.wright
8 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

So I experienced this issue again and this time I managed to grab a screenshot. See the attached file.

#4 @DJPaul
8 years ago

  • Component changed from API to Component - Core
  • Keywords needs-patch good-first-bug added
  • Milestone set to 2.6

Odd - something to do with our wpdb->delete call, maybe it's not in the right format.

#5 @DJPaul
8 years ago

  • Owner set to DJPaul
  • Status changed from reopened to assigned

#6 @djpaul
8 years ago

In 10748:

Activity: add test for deleting user when they have no bp_last_activity cache set.

See #6981

#7 @DJPaul
8 years ago

If you create a new user as described then immediately delete it, it never has a last_activity set. BP_Core_User::delete_last_activity() assumes it always will, and a null value gets passed to wpdb->delete which chokes wpdb->prepare which throws the "doing_it_wrong" error.

I've added a test in r10748 to capture this.

#8 @djpaul
8 years ago

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

In 10749:

Core: when deleting a user's last_activity value, make sure it exists.

Creating a user in wp-admin then immediately deleting it was causing a
"doing it wrong" error because the last_activity value was null,
causing WPDB's delete and prepare methods to fail.

Fixes #6981

Note: See TracTickets for help on using tickets.