Felix Arntz
21f18c2d30
Multisite: Initialize a user's roles correctly when setting them up for a different site.
...
While it has always been possible to initialize a user's roles and capabilities for another site than the current one in a multisite, the actual roles available were not switched prior to this change, possibly causing invalid roles to show up or actually valid capabilities not being available.
In order to fix this bug in a clean way, relevant parts of the `WP_User` class have been refactored. The ID of the site for which capabilities are currently initialized are now stored in a private property `WP_User::$site_id`. The `WP_User::for_blog( $blog_id )` and `WP_User::_init_caps( $cap_key )` methods have been deprecated in favor of `WP_User::for_site( $site_id )`. In addition, a new method `WP_User::get_site_id()` has been introduced to retrieve the site ID for which the user's capabilities are currently initialized.
Props ryanduff, jeremyfelt, flixos90.
Fixes #36961 .
Built from https://develop.svn.wordpress.org/trunk@41624
git-svn-id: http://core.svn.wordpress.org/trunk@41459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-27 21:10:45 +00:00
..
2017-09-27 17:27:45 +00:00
2017-09-24 16:00:46 +00:00
2017-07-31 19:50:45 +00:00
2017-09-26 21:15:47 +00:00
2017-09-25 10:27:43 +00:00
2017-09-22 17:35:48 +00:00
2017-09-25 06:28:45 +00:00
2017-07-26 16:45:44 +00:00
2017-09-13 06:08:47 +00:00
2017-07-27 00:41:44 +00:00
2017-08-16 21:11:43 +00:00
2017-08-29 16:43:47 +00:00
2017-08-03 16:13:44 +00:00
2017-09-22 09:33:47 +00:00
2017-09-27 13:27:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-08-21 15:35:46 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-26 20:33:46 +00:00
2017-09-09 13:19:45 +00:00
2017-09-24 16:00:46 +00:00
2017-09-19 05:40:44 +00:00
2017-07-27 00:41:44 +00:00
2017-08-02 05:35:41 +00:00
2017-07-27 00:41:44 +00:00
2017-09-08 14:03:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-21 10:00:48 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-01 16:58:42 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-08-22 11:12:44 +00:00
2017-08-22 11:12:44 +00:00
2017-08-22 11:12:44 +00:00
2017-07-27 00:41:44 +00:00
2017-08-22 11:52:48 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-08-03 14:34:44 +00:00
2017-09-15 11:15:52 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-04 11:17:43 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-13 14:48:45 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-27 08:38:45 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-27 21:10:45 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-09-22 22:08:46 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-07-27 00:41:44 +00:00
2017-08-20 20:13:47 +00:00
2017-07-01 13:36:41 +00:00
2017-07-28 01:15:52 +00:00
2017-06-30 04:54:41 +00:00
2017-07-27 00:41:44 +00:00
2017-08-22 11:52:48 +00:00
2017-09-27 13:04:47 +00:00
2017-09-25 06:28:45 +00:00
2017-09-24 14:22:54 +00:00
2016-07-06 12:40:29 +00:00
2017-09-27 17:27:45 +00:00
2017-09-17 22:52:47 +00:00
2017-09-27 13:07:46 +00:00
2017-09-21 23:04:45 +00:00
2017-09-22 22:00:47 +00:00
2017-06-25 22:16:40 +00:00
2017-08-22 11:52:48 +00:00
2017-09-24 23:01:44 +00:00
2017-07-01 22:13:41 +00:00
2017-08-31 11:17:45 +00:00
2017-09-16 11:03:45 +00:00
2017-05-10 06:10:43 +00:00
2017-09-27 21:10:45 +00:00
2017-05-09 17:15:43 +00:00
2017-08-22 11:52:48 +00:00
2017-09-27 14:17:45 +00:00
2017-09-15 11:15:52 +00:00
2017-07-05 21:31:44 +00:00
2017-08-09 21:04:47 +00:00
2017-08-12 13:11:43 +00:00
2017-09-10 21:09:45 +00:00
2017-09-12 12:54:45 +00:00
2017-08-20 20:03:54 +00:00
2017-09-24 11:28:46 +00:00
2017-08-18 18:19:44 +00:00
2017-09-09 13:53:42 +00:00
2017-07-27 08:19:43 +00:00
2017-08-10 01:38:43 +00:00
2017-09-27 08:46:45 +00:00
2017-08-20 20:38:42 +00:00
2017-07-28 01:15:52 +00:00
2017-09-27 14:39:45 +00:00
2017-06-29 16:05:41 +00:00
2017-09-26 07:38:45 +00:00
2017-09-27 13:04:47 +00:00
2017-09-22 13:14:45 +00:00
2017-06-15 12:05:42 +00:00
2017-09-27 21:10:45 +00:00
2017-09-25 16:19:46 +00:00
2017-09-19 17:56:45 +00:00