From cc77e573b6d6f06c2bca64fff237ae68595d11ef Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 12 Dec 2008 20:47:18 +0000 Subject: [PATCH] Explicitly return ref for the sake of PHP4. Fixes user_level being empty when installing on PHP4. Props Mr Pete. fixes #8317 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@10200 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/schema.php | 26 +++++++++++++------------- wp-includes/capabilities.php | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index bde89e874b..1f9c5be59c 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -351,7 +351,7 @@ function populate_roles_160() { add_role('subscriber', 'Subscriber|User role'); // Add caps for Administrator role - $role = get_role('administrator'); + $role =& get_role('administrator'); $role->add_cap('switch_themes'); $role->add_cap('edit_themes'); $role->add_cap('activate_plugins'); @@ -384,7 +384,7 @@ function populate_roles_160() { $role->add_cap('level_0'); // Add caps for Editor role - $role = get_role('editor'); + $role =& get_role('editor'); $role->add_cap('moderate_comments'); $role->add_cap('manage_categories'); $role->add_cap('manage_links'); @@ -406,7 +406,7 @@ function populate_roles_160() { $role->add_cap('level_0'); // Add caps for Author role - $role = get_role('author'); + $role =& get_role('author'); $role->add_cap('upload_files'); $role->add_cap('edit_posts'); $role->add_cap('edit_published_posts'); @@ -417,14 +417,14 @@ function populate_roles_160() { $role->add_cap('level_0'); // Add caps for Contributor role - $role = get_role('contributor'); + $role =& get_role('contributor'); $role->add_cap('edit_posts'); $role->add_cap('read'); $role->add_cap('level_1'); $role->add_cap('level_0'); // Add caps for Subscriber role - $role = get_role('subscriber'); + $role =& get_role('subscriber'); $role->add_cap('read'); $role->add_cap('level_0'); } @@ -437,7 +437,7 @@ function populate_roles_160() { function populate_roles_210() { $roles = array('administrator', 'editor'); foreach ($roles as $role) { - $role = get_role($role); + $role =& get_role($role); if ( empty($role) ) continue; @@ -458,19 +458,19 @@ function populate_roles_210() { $role->add_cap('read_private_pages'); } - $role = get_role('administrator'); + $role =& get_role('administrator'); if ( ! empty($role) ) { $role->add_cap('delete_users'); $role->add_cap('create_users'); } - $role = get_role('author'); + $role =& get_role('author'); if ( ! empty($role) ) { $role->add_cap('delete_posts'); $role->add_cap('delete_published_posts'); } - $role = get_role('contributor'); + $role =& get_role('contributor'); if ( ! empty($role) ) { $role->add_cap('delete_posts'); } @@ -482,7 +482,7 @@ function populate_roles_210() { * @since 2.3.0 */ function populate_roles_230() { - $role = get_role( 'administrator' ); + $role =& get_role( 'administrator' ); if ( !empty( $role ) ) { $role->add_cap( 'unfiltered_upload' ); @@ -495,7 +495,7 @@ function populate_roles_230() { * @since 2.5.0 */ function populate_roles_250() { - $role = get_role( 'administrator' ); + $role =& get_role( 'administrator' ); if ( !empty( $role ) ) { $role->add_cap( 'edit_dashboard' ); @@ -508,7 +508,7 @@ function populate_roles_250() { * @since 2.6.0 */ function populate_roles_260() { - $role = get_role( 'administrator' ); + $role =& get_role( 'administrator' ); if ( !empty( $role ) ) { $role->add_cap( 'update_plugins' ); @@ -522,7 +522,7 @@ function populate_roles_260() { * @since 2.7.0 */ function populate_roles_270() { - $role = get_role( 'administrator' ); + $role =& get_role( 'administrator' ); if ( !empty( $role ) ) { $role->add_cap( 'install_plugins' ); diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index 5ea849f24e..ab6ec3524d 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -533,7 +533,7 @@ class WP_User { //Build $allcaps from role caps, overlay user's $caps $this->allcaps = array(); foreach ( (array) $this->roles as $role ) { - $role = $wp_roles->get_role( $role ); + $role =& $wp_roles->get_role( $role ); $this->allcaps = array_merge( $this->allcaps, $role->capabilities ); } $this->allcaps = array_merge( $this->allcaps, $this->caps );