mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784
git-svn-id: https://develop.svn.wordpress.org/trunk@8572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -28,7 +28,7 @@ class WP_Roles {
|
||||
|
||||
$this->role_objects = array();
|
||||
$this->role_names = array();
|
||||
foreach ($this->roles as $role => $data) {
|
||||
foreach ( (array) $this->roles as $role => $data) {
|
||||
$this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']);
|
||||
$this->role_names[$role] = $this->roles[$role]['name'];
|
||||
}
|
||||
@@ -207,7 +207,7 @@ class WP_User {
|
||||
}
|
||||
|
||||
function set_role($role) {
|
||||
foreach($this->roles as $oldrole)
|
||||
foreach( (array) $this->roles as $oldrole)
|
||||
unset($this->caps[$oldrole]);
|
||||
if ( !empty($role) ) {
|
||||
$this->caps[$role] = true;
|
||||
@@ -265,7 +265,7 @@ class WP_User {
|
||||
$caps = call_user_func_array('map_meta_cap', $args);
|
||||
// Must have ALL requested caps
|
||||
$capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args);
|
||||
foreach ($caps as $cap) {
|
||||
foreach ( (array) $caps as $cap) {
|
||||
//echo "Checking cap $cap<br />";
|
||||
if(empty($capabilities[$cap]) || !$capabilities[$cap])
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user