[wp-trac] [WordPress Trac] #44697: Argument type does not match: user.php
WordPress Trac
noreply at wordpress.org
Fri Aug 3 10:33:55 UTC 2018
#44697: Argument type does not match: user.php
-------------------------------------+-------------------------------
Reporter: subrataemfluence | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0
Component: Users | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-refresh | Focuses: coding-standards
-------------------------------------+-------------------------------
Comment (by subrataemfluence):
I had the same initial feeling but got a kinda confused!
Now, since the default value set for `$for_user_id` is `0`, can this be
better idea to rewrite the comparison block like this?
{{{
if ( '' == $for_user_id || 0 == $for_user_id ) {
$for_user_id = get_current_user_id();
}
$user = get_userdata( $for_user_id );
}}}
This ensures `$for_user_id` gets the current user id for default values.
And if fails to satisfy the above condition, rest will be executed as tNB:
Ire.
And if the default value for `$for_user_id` is set to `0`, do we really
need to compare it with an `empty string`?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44697#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list