Changeset 21414 for trunk/wp-admin/network/site-users.php
- Timestamp:
- 08/03/2012 05:51:42 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/network/site-users.php
r21413 r21414 46 46 47 47 $details = get_blog_details( $id ); 48 if ( ! can_edit_network( $details->site_id ) )48 if ( ! can_edit_network( $details->site_id ) ) 49 49 wp_die( __( 'You do not have permission to access this page.' ) ); 50 50 51 51 $is_main_site = is_main_site( $id ); 52 52 53 // get blog prefix 54 $blog_prefix = $wpdb->get_blog_prefix( $id ); 55 56 // @todo This is a hack. Eventually, add API to WP_Roles allowing retrieval of roles for a particular blog. 57 if ( ! empty($wp_roles->use_db) ) { 58 $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" ); 59 } else { 60 // Roles are stored in memory, not the DB. 61 $editblog_roles = $wp_roles->roles; 62 } 63 $default_role = get_blog_option( $id, 'default_role' ); 53 switch_to_blog( $id ); 54 55 $editblog_roles = $wp_roles->roles; 56 57 $default_role = get_option( 'default_role' ); 64 58 65 59 $action = $wp_list_table->current_action(); 66 60 67 61 if ( $action ) { 68 switch_to_blog( $id );69 62 70 63 switch ( $action ) { … … 72 65 check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); 73 66 $user = $_POST['user']; 74 if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) {67 if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { 75 68 $update = 'err_new'; 76 69 } else { … … 95 88 $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) ); 96 89 if ( $userid ) { 90 $blog_prefix = $wpdb->get_blog_prefix( $id ); 97 91 $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" ); 98 92 if ( $user == false ) … … 109 103 110 104 case 'remove': 111 if ( ! current_user_can('remove_users') )105 if ( ! current_user_can( 'remove_users' ) ) 112 106 die(__('You can’t remove users.')); 113 107 check_admin_referer( 'bulk-users' ); … … 153 147 } 154 148 155 restore_current_blog();156 149 wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); 157 150 exit(); 158 151 } 152 153 restore_current_blog(); 159 154 160 155 if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
Note: See TracChangeset
for help on using the changeset viewer.