site_id != $wpdb->siteid ) wp_die( __( 'You do not have permission to access this page.' ) ); $is_main_site = is_main_site( $id ); if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] ) { check_admin_referer( 'edit-site' ); switch_to_blog( $id ); // get blog prefix $blog_prefix = $wpdb->get_blog_prefix( $id ); // user roles if ( isset( $_POST['role'] ) && is_array( $_POST['role'] ) == true ) { $newroles = $_POST['role']; reset( $newroles ); foreach ( (array) $newroles as $userid => $role ) { $user = new WP_User( $userid ); if ( empty( $user->ID ) ) continue; $user->for_blog( $id ); $user->set_role( $role ); } } // remove user if ( isset( $_POST['blogusers'] ) && is_array( $_POST['blogusers'] ) ) { reset( $_POST['blogusers'] ); foreach ( (array) $_POST['blogusers'] as $key => $val ) remove_user_from_blog( $key, $id ); } // change password if ( isset( $_POST['user_password'] ) && is_array( $_POST['user_password'] ) ) { reset( $_POST['user_password'] ); $newroles = $_POST['role']; foreach ( (array) $_POST['user_password'] as $userid => $pass ) { unset( $_POST['role'] ); $_POST['role'] = $newroles[ $userid ]; if ( $pass != '' ) { $cap = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'", $userid ) ); $userdata = get_userdata($userid); $_POST['pass1'] = $_POST['pass2'] = $pass; $_POST['email'] = $userdata->user_email; $_POST['rich_editing'] = $userdata->rich_editing; edit_user( $userid ); if ( $cap == null ) $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->usermeta} WHERE user_id = %d AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'", $userid ) ); } } unset( $_POST['role'] ); $_POST['role'] = $newroles; } // add user if ( !empty( $_POST['newuser'] ) ) { $newuser = $_POST['newuser']; $userid = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->users . " WHERE user_login = %s", $newuser ) ); if ( $userid ) { $user = $wpdb->get_var( "SELECT user_id FROM " . $wpdb->usermeta . " WHERE user_id='$userid' AND meta_key='{$blog_prefix}capabilities'" ); if ( $user == false ) add_user_to_blog( $id, $userid, $_POST['new_role'] ); } } restore_current_blog(); wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-users.php') ); } if ( isset($_GET['update']) ) { $messages = array(); if ( 'updated' == $_GET['update'] ) $messages[] = __('Site users updated.'); } $title = sprintf( __('Edit Site: %s'), get_blogaddress_by_id($id)); $parent_file = 'sites.php'; $submenu_file = 'sites.php'; require('../admin-header.php'); ?>

array( 'label' => __('Info'), 'url' => 'site-info.php'), 'site-options' => array( 'label' => __('Options'), 'url' => 'site-options.php'), 'site-users' => array( 'label' => __('Users'), 'url' => 'site-users.php'), 'site-themes' => array( 'label' => __('Themes'), 'url' => 'site-themes.php')); foreach ( $tabs as $tab_id => $tab ) { $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; echo '' . esc_html( $tab['label'] ) . ''; } ?>

' . $msg . '

'; } ?>
$id, 'number' => 20 ) ); if ( is_array( $blogusers ) ) { echo ''; echo ""; $user_count = 0; $blog_prefix = $wpdb->get_blog_prefix( $id ); $editblog_roles = get_blog_option( $id, "{$blog_prefix}user_roles" ); foreach ( $blogusers as $user_id => $user_object ) { $user_count++; $existing_role = reset( $user_object->roles ); echo ''; if ( $user_id != $current_user->data->ID ) { ?> '; } else { echo ""; } echo ''; } echo "
" . __( 'User' ) . "" . __( 'Role' ) . "" . __( 'Password' ) . "" . __( 'Remove' ) . "
' . $user_object->user_login . ' " . __ ( 'N/A' ) . "" . __ ( 'N/A' ) . "" . __( 'N/A' ) . "
"; submit_button(); if ( 20 == $user_count ) echo '

' . sprintf( __('First 20 users shown. Manage all users.'), get_admin_url($id, 'users.php') ) . '

'; } else { _e('This site has no users.'); } ?>