Add the proper access modifier to _init_caps() in WP_User. Add __call() for BC.

See #32444.

Built from https://develop.svn.wordpress.org/trunk@32731


git-svn-id: http://core.svn.wordpress.org/trunk@32702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor
2015-06-12 17:26:25 +00:00
parent d2a00338f6
commit 3b1e434c3b
2 changed files with 19 additions and 2 deletions

View File

@@ -630,6 +630,23 @@ class WP_User {
return $user;
}
/**
* Make private/protected methods readable for backwards compatibility.
*
* @since 4.3.0
* @access public
*
* @param callable $name Method to call.
* @param array $arguments Arguments to pass when calling.
* @return mixed|false Return value of the callback, false otherwise.
*/
public function __call( $name, $arguments ) {
if ( '_init_caps' === $name ) {
return call_user_func_array( array( $this, $name ), $arguments );
}
return false;
}
/**
* Magic method for checking the existence of a certain custom field
*
@@ -761,7 +778,7 @@ class WP_User {
*
* @param string $cap_key Optional capability key
*/
function _init_caps( $cap_key = '' ) {
protected function _init_caps( $cap_key = '' ) {
global $wpdb;
if ( empty($cap_key) )