[wp-trac] [WordPress Trac] #11395: make is_user_logged_in() return the $user's ID instead of true
WordPress Trac
wp-trac at lists.automattic.com
Fri Dec 11 16:03:24 UTC 2009
#11395: make is_user_logged_in() return the $user's ID instead of true
-------------------------------+--------------------------------------------
Reporter: Denis-de-Bernardy | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.0
Component: Users | Version: 2.9
Severity: normal | Keywords: has-patch dev-feedback
-------------------------------+--------------------------------------------
Comment(by nacin):
Replying to [comment:1 filosofo]:
> Don't you think it seems reasonable to expect a function prefixed with
"is_" to have a boolean return value? That's what the built-in PHP
functions do, and all of the other WP functions (as far as I know).
It does seem reasonable, but this patch still allows is_user_logged_in()
to evaluate to true or false, as it either returns false or a user ID that
evaluates to true. It just provides a little more functionality this way.
> And it especially makes sense in light of that other ticket you opened
that shows PHP is inconsistent across versions in comparing variables of
differing types.
Actually, we found that PHP was consistent and documented, and it was only
with regards to comparing a string to 0. See #11391. So this isn't an
issue, especially since this function would never return 0 or a string.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11395#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list