[wp-trac] [WordPress Trac] #15627: wp_insert_user should not assume a default role

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 9 23:16:23 UTC 2012


#15627: wp_insert_user should not assume a default role
-----------------------------------+-----------------------------
 Reporter:  nickmomrik             |       Owner:  westi
     Type:  defect (bug)           |      Status:  accepted
 Priority:  low                    |   Milestone:  Future Release
Component:  Users                  |     Version:  3.1
 Severity:  minor                  |  Resolution:
 Keywords:  westi-likes has-patch  |
-----------------------------------+-----------------------------
Changes (by wonderboymusic):

 * keywords:  needs-patch westi-likes => westi-likes has-patch


Comment:

 {{{wpmu_create_user()}}} was deleting a user_meta key with no
 {{{$wpdb->prefix}}}, which is dynamic to boot. My patch delete the
 user_meta for capabilities with WP_User::cap_key as the key.

 Before:
 {{{
 // Newly created users have no roles or caps until they are added to a
 blog.
 delete_user_option( $user_id, 'capabilities' );
 delete_user_option( $user_id, 'user_level' );
 }}}

 After:
 {{{
 $user = new WP_User( $user_id );

 // Newly created users have no roles or caps until they are added to a
 blog.
 delete_user_option( $user_id, $user->cap_key );
 delete_user_option( $user_id, 'user_level' );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15627#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list