WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#15498 closed defect (bug) (fixed)

Notice: Trying to get property of non-object in wp-admin/edit-form-advanced.php on line 281

Reported by: wpdavis Owned by: duck_
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.3.2
Component: Users Keywords: has-patch
Focuses: Cc:
PR Number:

Description

The problem seems to arise from the fact that when users are imported their old IDs aren't mapped to their new IDs, so then $last_user = get_userdata($last_id) is trying to look up a user that doesn't exist.

Attachments (1)

15498.diff (906 bytes) - added by duck_ 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @wpdavis
9 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Killing this off — was using old version of WP importer.

#2 @duck_
9 years ago

  • Milestone Awaiting Review deleted

Note that I was thinking of reintroducing importing _edit_last since it's used by get_the_modified_author. If that happens the ID will indeed have to be mapped to the new local ID to stop this.

#3 follow-up: @Ludwig C.
7 years ago

  • Component changed from Import to Users
  • Keywords needs-patch added
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Version set to 3.3.2

This error does still exist when deleting a user and reasigning the posts to an other user. Not only the post_author in wp_posts should be changed, please update wp_postmeta too.

UPDATE wp_postmeta SET meta_value='NEW-USER-ID' WHERE meta_key='_edit_last';

An other solution would be to check the object in edit-form-advanced.php and display 'unknown user' when it is null.

@duck_
7 years ago

#4 in reply to: ↑ 3 @duck_
7 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone set to Future Release

Replying to Ludwig C.:

This error does still exist when deleting a user and reasigning the posts to an other user. Not only the post_author in wp_posts should be changed, please update wp_postmeta too.

Good point. Attached a patch to include the get_userdata() call in the conditional.

#5 @duck_
6 years ago

  • Owner set to duck_
  • Resolution set to fixed
  • Status changed from reopened to closed

In 24816:

Fix notice and show generic last update message if _edit_last references a nonexistent user.

Fixes #15498.

#6 @duck_
6 years ago

  • Milestone changed from Future Release to 3.7
Note: See TracTickets for help on using tickets.