[wp-trac] [WordPress Trac] #44634: multisite: WP_User compatibility keys inacessible after switch_to_blog
WordPress Trac
noreply at wordpress.org
Tue Jul 24 18:19:52 UTC 2018
#44634: multisite: WP_User compatibility keys inacessible after switch_to_blog
--------------------------+-----------------------------
Reporter: flaviozavan | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 4.9.7
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Some WP_User attributes are accessed using $back_compat_keys and
get_user_meta:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
user.php#L121
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
user.php#L312
$back_compat_keys is static and defined when the first WP_User is
instantiated.
This process hardcodes $wpdb->prefix into some keys (e.g. user_level),
preventing it from functioning correctly after switch_to_blog().
Additionally, unsetting any of these attributes for one user will unset it
for all Users, due to $back_compat_keys being static:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
user.php#L374
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44634>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list