Index: wp-includes/capabilities.php
===================================================================
--- wp-includes/capabilities.php	(revision 4616)
+++ wp-includes/capabilities.php	(working copy)
@@ -15,7 +15,7 @@
 	function _init () {
 		global $wpdb;
 		global $wp_user_roles;
-		$this->role_key = $wpdb->prefix . 'user_roles';
+		$this->role_key = USER_PREFIX . 'user_roles';
 		if ( ! empty($wp_user_roles) ) {
 			$this->roles = $wp_user_roles;
 			$this->use_db = false;
@@ -166,7 +166,7 @@
 
 	function _init_caps() {
 		global $wpdb;
-		$this->cap_key = $wpdb->prefix . 'capabilities';
+		$this->cap_key = USER_PREFIX . 'capabilities';
 		$this->caps = &$this->{$this->cap_key};
 		if ( ! is_array($this->caps) )
 			$this->caps = array();
@@ -233,7 +233,7 @@
 	function update_user_level_from_caps() {
 		global $wpdb;
 		$this->user_level = array_reduce(array_keys($this->allcaps), 	array(&$this, 'level_reduction'), 0);
-		update_usermeta($this->ID, $wpdb->prefix.'user_level', $this->user_level);
+		update_usermeta($this->ID, USER_PREFIX.'user_level', $this->user_level);
 	}
 
 	function add_cap($cap, $grant = true) {
@@ -251,7 +251,7 @@
 		global $wpdb;
 		$this->caps = array();
 		update_usermeta($this->ID, $this->cap_key, '');
-		update_usermeta($this->ID, $wpdb->prefix.'user_level', '');
+		update_usermeta($this->ID, USER_PREFIX.'user_level', '');
 		$this->get_role_caps();
 	}
 
Index: wp-includes/pluggable.php
===================================================================
--- wp-includes/pluggable.php	(revision 4616)
+++ wp-includes/pluggable.php	(working copy)
@@ -82,7 +82,7 @@
 			$user->{$meta->meta_key} = $value;
 
 			// We need to set user_level from meta, not row
-			if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
+			if ( USER_PREFIX . 'user_level' == $meta->meta_key )
 				$user->user_level = $meta->meta_value;
 		} // end foreach
 	} //end if
@@ -133,7 +133,7 @@
 			$user->{$meta->meta_key} = $value;
 
 			// We need to set user_level from meta, not row
-			if ( $wpdb->prefix . 'user_level' == $meta->meta_key )
+			if ( USER_PREFIX . 'user_level' == $meta->meta_key )
 				$user->user_level = $meta->meta_value;
 		}
 	}
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 4616)
+++ wp-settings.php	(working copy)
@@ -112,10 +112,18 @@
 
 $wpdb->prefix           = $table_prefix;
 
-if ( defined('CUSTOM_USER_TABLE') )
-	$wpdb->users = CUSTOM_USER_TABLE;
-if ( defined('CUSTOM_USER_META_TABLE') )
-	$wpdb->usermeta = CUSTOM_USER_META_TABLE;
+if ( defined('CUSTOM_GLOBAL_USER_PREFIX') ) {
+	// user table, user meta table, and permissions prefix all in one
+	define('USER_PREFIX', CUSTOM_GLOBAL_USER_PREFIX);
+	$wpdb->users = CUSTOM_USER_TABLE = USER_PREFIX . 'users';
+	$wpdb->usermeta = CUSTOM_USER_META_TABLE = USER_PREFIX . 'usermeta';
+} else {
+	define('USER_PREFIX', $wpdb->prefix); // permissions should use the default prefix
+	if ( defined('CUSTOM_USER_TABLE') )
+		$wpdb->users = CUSTOM_USER_TABLE;
+	if ( defined('CUSTOM_USER_META_TABLE') )
+		$wpdb->usermeta = CUSTOM_USER_META_TABLE;
+}
 
 // To be removed in 2.2
 $tableposts = $tableusers = $tablecategories = $tablepost2cat = $tablecomments = $tablelink2cat = $tablelinks = $tablelinkcategories = $tableoptions = $tablepostmeta = '';
Index: wp-admin/upgrade-functions.php
===================================================================
--- wp-admin/upgrade-functions.php	(revision 4616)
+++ wp-admin/upgrade-functions.php	(working copy)
@@ -398,7 +398,7 @@
 		if ( !empty( $user->user_nickname ) )
 			update_usermeta( $user->ID, 'nickname', $wpdb->escape($user->user_nickname) );
 		if ( !empty( $user->user_level ) )
-			update_usermeta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
+			update_usermeta( $user->ID, USER_PREFIX . 'user_level', $user->user_level );
 		if ( !empty( $user->user_icq ) )
 			update_usermeta( $user->ID, 'icq', $wpdb->escape($user->user_icq) );
 		if ( !empty( $user->user_aim ) )
@@ -424,11 +424,11 @@
 		endif;
 
 		// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
-		$caps = get_usermeta( $user->ID, $wpdb->prefix . 'capabilities');
+		$caps = get_usermeta( $user->ID, USER_PREFIX . 'capabilities');
 		if ( empty($caps) || defined('RESET_CAPS') ) {
-			$level = get_usermeta($user->ID, $wpdb->prefix . 'user_level');
+			$level = get_usermeta($user->ID, USER_PREFIX . 'user_level');
 			$role = translate_level_to_role($level);
-			update_usermeta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
+			update_usermeta( $user->ID, USER_PREFIX . 'capabilities', array($role => true) );
 		}
 
 	endforeach;
Index: wp-admin/admin-db.php
===================================================================
--- wp-admin/admin-db.php	(revision 4616)
+++ wp-admin/admin-db.php	(working copy)
@@ -11,7 +11,7 @@
 function get_others_drafts( $user_id ) {
 	global $wpdb;
 	$user = get_userdata( $user_id );
-	$level_key = $wpdb->prefix . 'user_level';
+	$level_key = USER_PREFIX . 'user_level';
 
 	$editable = get_editable_user_ids( $user_id );
 
@@ -52,7 +52,7 @@
 			return false;
 	}
 
-	$level_key = $wpdb->prefix . 'user_level';
+	$level_key = USER_PREFIX . 'user_level';
 
 	$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
 	if ( $exclude_zeros )
@@ -63,7 +63,7 @@
 
 function get_author_user_ids() {
 	global $wpdb;
-	$level_key = $wpdb->prefix . 'user_level';
+	$level_key = USER_PREFIX . 'user_level';
 
 	$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
 
@@ -72,7 +72,7 @@
 
 function get_nonauthor_user_ids() {
 	global $wpdb;
-	$level_key = $wpdb->prefix . 'user_level';
+	$level_key = USER_PREFIX . 'user_level';
 
 	$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
 
