Make WordPress Core

Opened 16 years ago

Closed 13 years ago

Last modified 13 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_
Priority: normal Milestone: 3.7
Component: Users Version: 3.3.2
Severity: normal Keywords: has-patch
Cc: Focuses:

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_ 14 years ago.

Download all attachments as: .zip

Change History (7)

#1 @wpdavis
16 years ago

  • Resolution → invalid
  • Status new → closed

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

#2 @duck_
16 years ago

  • Milestone Awaiting Review

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.
14 years ago

  • Component Import → Users
  • Keywords needs-patch added
  • Resolution invalid
  • Status closed → reopened
  • Version → 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.

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

  • Keywords has-patch added; needs-patch removed
  • Milestone → 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_
13 years ago

  • Owner set to duck_
  • Resolution → fixed
  • Status reopened → closed

In 24816:

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

Fixes #15498.

#6 @duck_
13 years ago

  • Milestone Future Release → 3.7
Note: See TracTickets for help on using tickets.