WordPress.org

Make WordPress Core

Opened 20 months ago

Last modified 20 months ago

#21601 closed defect (bug)

Introduce WP_User::has_prop_val() magic method — at Initial Version

Reported by: wpsmith Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Users Keywords: has-patch 2nd-opinion dev-feedback
Focuses: Cc:

Description

When using WP_User::has_prop( $key ), I believe the expectation is that if the property has a value, it would return true. However, it is returning true if the key is set or if the key exists. So if one uses it like WP_User::has_prop( 'user_url' ), it returns true regardless, simply because that's a standard WordPress user field.

So, keeping that functionality for checking even custom properties, I thought it may be beneficial to add a magic method for checking whether a property is set ( WP_User::has_prop( $key ) ) and has a value ( WP_User::get( $key ) ).

Thus, this ticket desires to add two methods: has_prop_val() & hasval()

Change History (1)

wpsmith20 months ago

Note: See TracTickets for help on using tickets.