Go to file
Felix Arntz 621a95a23f Multisite: Improve initializing available roles when switch sites.
Switching the available roles and the current user's capabilities no longer happens in `switch_to_blog()` and `restore_current_blog()`, instead it has been moved to a new function `wp_switch_roles_and_user()` which is hooked into the site switching process. This allows to improve performance by temporarily unhooking the function when roles and capabilities do not need to be switched.

This change ensures that switching available roles now works closer to switching user capabilities, particularly the changes in [41624]. A new `WP_Roles::for_site( $site_id )` method has been introduced, and the `WP_Roles::_init()` method has been deprecated. It is furthermore possible to retrieve the site ID for which the available roles are currently initialized through a new `WP_Roles::get_site_id()`.

Props johnjamesjacoby, flixos90.
Fixes #38645.


git-svn-id: https://develop.svn.wordpress.org/trunk@41625 602fd350-edb4-49c9-b593-d223f7449a82
2017-09-27 21:43:59 +00:00
src Multisite: Improve initializing available roles when switch sites. 2017-09-27 21:43:59 +00:00
tests Multisite: Improve initializing available roles when switch sites. 2017-09-27 21:43:59 +00:00
tools/i18n DOCS: Replace HTTP links with HTTPS. 2016-06-10 04:49:09 +00:00
.editorconfig
.gitignore JSDocs: add the jsdoc folder to .gitignore and svn:ignore. 2017-09-15 20:13:04 +00:00
.jshintrc Build/Test Tools: After [29858], update `.jsintrc` to use spaces, not tabs. 2017-01-13 04:44:53 +00:00
.travis.yml Build/Test tools: Use the latest in the 4.x and 6.x branches of PHPUnit when running tests on Travis. 2017-08-22 16:08:33 +00:00
Gruntfile.js Retire Press This and extract it to a plugin. First run. 2017-09-24 14:21:42 +00:00
jsdoc.conf.json Docs: Add jsdoc.conf.json JSDOC configuration file. 2017-09-11 13:13:40 +00:00
package.json Docs: JSDoc improvements for namespaces. 2017-09-08 18:41:20 +00:00
phpunit.xml.dist Tests: Rename ignored tests in `phpunit.xml.dist`. 2017-08-18 10:26:50 +00:00
wp-cli.yml Remove debug mode from WP-CLI by default, as it now outputs too much debugging information to be of use during normal development. 2015-11-28 18:36:06 +00:00
wp-config-sample.php Lightly clean up and improve inline documentation in wp-config-sample.php. 2015-05-10 00:05:30 +00:00
wp-tests-config-sample.php General: Improve terminology used when referring to installations of WordPress and its extensions. 2017-08-22 11:51:11 +00:00