From 1d9fdca363d036a3f366a95ccb05e04b71f866a5 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 2 Mar 2010 22:55:02 +0000 Subject: [PATCH] allow empty table prefix on my-sites.php, see #12459 git-svn-id: http://svn.automattic.com/wordpress/trunk@13563 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index fdf820c38..aa9890113 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -49,8 +49,13 @@ function get_blogs_of_user( $id, $all = false ) { return false; $blogs = $match = array(); + $prefix_length = strlen($wpdb->base_prefix); foreach ( (array) $user as $key => $value ) { - if ( false !== strpos( $key, '_capabilities') && ( strlen( $wpdb->base_prefix ) == 0 || 0 === strpos( $key, $wpdb->base_prefix ) ) && preg_match( '/' . $wpdb->base_prefix . '((\d+)_)?capabilities/', $key, $match ) ) { + if ( $prefix_length && substr($key, 0, $prefix_length) != $wpdb->base_prefix ) + continue; + if ( substr($key, -12, 12) != 'capabilities' ) + continue; + if ( preg_match( '/^' . $wpdb->base_prefix . '((\d+)_)?capabilities$/', $key, $match ) ) { if ( count( $match ) > 2 ) $blog_id = $match[ 2 ]; else