Skip to:
Content

bbPress.org

Opened 11 years ago

Closed 11 years ago

#2359 closed defect (bug) (fixed)

Using bbp_get_displayed_user_field() when there is no displayed user causes debug notices

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.4 Priority: normal
Severity: normal Version: 2.1
Component: Tools - Code Improvements Keywords:
Cc:

Description

If you call bbp_get_displayed_user_field() when not viewing a user, or if you attempt to get a field that does not exist, you'll be greeted with debug notices because the object being referenced is a stdObject, not a WP_User object.

If we use WP_User objects, we'll inherit the magic methods for free, and avoid these problems completely.

Worth noting here that we can do the same for the 4 main query loops.

Change History (1)

#1 @johnjamesjacoby
11 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 4996:

Replace generic stdClass usages with correct object types.

Fixes debug notices with bbp_get_displayed_user_field() when requesting non-existing fields or when there is no displayed user, by allowing the magic get() methods of the WP_User class to bail if the field is not set.

Also prevents similar issues with main query loops. Fixes #2359.

Note: See TracTickets for help on using tickets.