Theme Customizer: Improve WP_Customize_Setting->check_capabilities(). Add support for arrays in WP_Customize_Setting->capability and WP_Customize_Setting->theme_supports. Don't bail when WP_Customize_Setting->capability is empty. see #19910.
git-svn-id: https://develop.svn.wordpress.org/trunk@20232 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
67f21026b9
commit
c6043b2fa2
@ -46,10 +46,10 @@ class WP_Customize_Section {
|
|||||||
* @return bool False if theme doesn't support the section or user doesn't have the capability.
|
* @return bool False if theme doesn't support the section or user doesn't have the capability.
|
||||||
*/
|
*/
|
||||||
function check_capabilities() {
|
function check_capabilities() {
|
||||||
if ( ! $this->capability || ! current_user_can( $this->capability ) )
|
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( $this->theme_supports && ! current_theme_supports( $this->theme_supports ) )
|
if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -267,10 +267,10 @@ class WP_Customize_Setting {
|
|||||||
public final function check_capabilities() {
|
public final function check_capabilities() {
|
||||||
global $customize;
|
global $customize;
|
||||||
|
|
||||||
if ( ! $this->capability || ! current_user_can( $this->capability ) )
|
if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( $this->theme_supports && ! current_theme_supports( $this->theme_supports ) )
|
if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$section = $customize->get_section( $this->section );
|
$section = $customize->get_section( $this->section );
|
||||||
|
Loading…
Reference in New Issue
Block a user