[wp-trac] [WordPress Trac] #20845: wp_set_current_user( null, "name") does not work when $current_user is already 0

WordPress Trac noreply at wordpress.org
Thu Oct 8 16:24:24 UTC 2015


#20845: wp_set_current_user( null, "name") does not work when $current_user is
already 0
-------------------------------------+------------------------------
 Reporter:  bobbingwide              |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Users                    |     Version:  3.3.2
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------------
Changes (by bobbingwide):

 * keywords:  has-patch needs-unit-tests needs-refresh => has-patch needs-
     testing


Comment:

 I've added a new file which contains a test setting the user by name with
 ID=null.

 There seems little point in adding tests for setting it by a numeric ID,
 since this is already implicit in many other tests.

 In the future, for completeness, there should be tests with non-null/0
 values of both ID AND name; to demonstrate that name is trumped by ID.
 e.g. wp_set_current_user( "admin", "bobbingwide" ); will return the
 "admin" user.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/20845#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list