2010-10-21 20:35:52 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Edit Site Users Administration Screen
|
|
|
|
*
|
|
|
|
* @package WordPress
|
2010-11-10 15:27:15 +01:00
|
|
|
* @subpackage Multisite
|
2010-10-21 20:35:52 +02:00
|
|
|
* @since 3.1.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Load WordPress Administration Bootstrap */
|
2013-09-25 02:18:11 +02:00
|
|
|
require_once( dirname( __FILE__ ) . '/admin.php' );
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! current_user_can( 'manage_sites' ) ) {
|
2017-06-25 20:46:44 +02:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to edit this site.' ), 403 );
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$wp_list_table = _get_list_table( 'WP_Users_List_Table' );
|
2010-11-24 06:31:25 +01:00
|
|
|
$wp_list_table->prepare_items();
|
|
|
|
|
2017-07-17 22:53:45 +02:00
|
|
|
get_current_screen()->add_help_tab( get_site_screen_help_tab_args() );
|
|
|
|
get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() );
|
2010-12-16 07:52:47 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
get_current_screen()->set_screen_reader_content(
|
|
|
|
array(
|
|
|
|
'heading_views' => __( 'Filter site users list' ),
|
|
|
|
'heading_pagination' => __( 'Site users list navigation' ),
|
|
|
|
'heading_list' => __( 'Site users list' ),
|
|
|
|
)
|
|
|
|
);
|
2015-10-07 03:28:25 +02:00
|
|
|
|
2011-12-09 00:02:33 +01:00
|
|
|
$_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] );
|
2017-12-01 00:11:00 +01:00
|
|
|
$referer = remove_query_arg( 'update', wp_get_referer() );
|
2011-11-22 06:55:55 +01:00
|
|
|
|
2014-03-25 17:57:15 +01:00
|
|
|
if ( ! empty( $_REQUEST['paged'] ) ) {
|
|
|
|
$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer );
|
|
|
|
}
|
|
|
|
|
2010-10-21 20:35:52 +02:00
|
|
|
$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
|
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! $id ) {
|
|
|
|
wp_die( __( 'Invalid site ID.' ) );
|
|
|
|
}
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2016-10-19 08:08:28 +02:00
|
|
|
$details = get_site( $id );
|
2015-07-09 18:29:24 +02:00
|
|
|
if ( ! $details ) {
|
2015-07-09 18:33:25 +02:00
|
|
|
wp_die( __( 'The requested site does not exist.' ) );
|
2015-07-09 18:29:24 +02:00
|
|
|
}
|
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! can_edit_network( $details->site_id ) ) {
|
2016-06-29 17:16:29 +02:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2010-10-21 20:35:52 +02:00
|
|
|
|
|
|
|
$is_main_site = is_main_site( $id );
|
|
|
|
|
2012-08-03 19:51:42 +02:00
|
|
|
switch_to_blog( $id );
|
2010-11-17 20:45:10 +01:00
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
$action = $wp_list_table->current_action();
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
if ( $action ) {
|
2011-12-09 00:02:33 +01:00
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
switch ( $action ) {
|
2010-11-25 12:12:33 +01:00
|
|
|
case 'newuser':
|
2010-12-24 23:37:51 +01:00
|
|
|
check_admin_referer( 'add-user', '_wpnonce_add-new-user' );
|
2010-11-25 12:12:33 +01:00
|
|
|
$user = $_POST['user'];
|
2012-08-03 19:51:42 +02:00
|
|
|
if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) {
|
2010-11-25 12:12:33 +01:00
|
|
|
$update = 'err_new';
|
|
|
|
} else {
|
2017-12-01 00:11:00 +01:00
|
|
|
$password = wp_generate_password( 12, false );
|
|
|
|
$user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
|
2010-11-25 12:12:33 +01:00
|
|
|
|
2015-06-12 19:19:27 +02:00
|
|
|
if ( false === $user_id ) {
|
2017-12-01 00:11:00 +01:00
|
|
|
$update = 'err_new_dup';
|
2010-11-25 12:12:33 +01:00
|
|
|
} else {
|
2017-08-03 23:41:45 +02:00
|
|
|
$result = add_user_to_blog( $id, $user_id, $_POST['new_role'] );
|
|
|
|
|
|
|
|
if ( is_wp_error( $result ) ) {
|
|
|
|
$update = 'err_add_fail';
|
|
|
|
} else {
|
|
|
|
$update = 'newuser';
|
|
|
|
/**
|
2017-11-27 00:57:55 +01:00
|
|
|
* Fires after a user has been created via the network site-users.php page.
|
|
|
|
*
|
|
|
|
* @since 4.4.0
|
|
|
|
*
|
|
|
|
* @param int $user_id ID of the newly created user.
|
|
|
|
*/
|
2017-08-03 23:41:45 +02:00
|
|
|
do_action( 'network_site_users_created_user', $user_id );
|
|
|
|
}
|
2010-11-25 12:12:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
case 'adduser':
|
2010-12-24 23:37:51 +01:00
|
|
|
check_admin_referer( 'add-user', '_wpnonce_add-user' );
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! empty( $_POST['newuser'] ) ) {
|
|
|
|
$update = 'adduser';
|
2011-12-09 00:02:33 +01:00
|
|
|
$newuser = $_POST['newuser'];
|
2017-12-01 00:11:00 +01:00
|
|
|
$user = get_user_by( 'login', $newuser );
|
2013-06-25 16:24:18 +02:00
|
|
|
if ( $user && $user->exists() ) {
|
2017-08-03 23:41:45 +02:00
|
|
|
if ( ! is_user_member_of_blog( $user->ID, $id ) ) {
|
|
|
|
$result = add_user_to_blog( $id, $user->ID, $_POST['new_role'] );
|
|
|
|
|
|
|
|
if ( is_wp_error( $result ) ) {
|
|
|
|
$update = 'err_add_fail';
|
|
|
|
}
|
|
|
|
} else {
|
2010-11-25 10:13:38 +01:00
|
|
|
$update = 'err_add_member';
|
2017-08-03 23:41:45 +02:00
|
|
|
}
|
2010-11-25 10:13:38 +01:00
|
|
|
} else {
|
|
|
|
$update = 'err_add_notfound';
|
2010-11-24 06:31:25 +01:00
|
|
|
}
|
2010-11-25 10:13:38 +01:00
|
|
|
} else {
|
|
|
|
$update = 'err_add_notfound';
|
2010-11-24 06:31:25 +01:00
|
|
|
}
|
|
|
|
break;
|
2011-12-09 00:02:33 +01:00
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
case 'remove':
|
2016-09-27 17:27:30 +02:00
|
|
|
if ( ! current_user_can( 'remove_users' ) ) {
|
2017-06-25 20:46:44 +02:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to remove users.' ), 403 );
|
2016-09-27 17:27:30 +02:00
|
|
|
}
|
|
|
|
|
2010-12-24 23:37:51 +01:00
|
|
|
check_admin_referer( 'bulk-users' );
|
2011-12-09 00:02:33 +01:00
|
|
|
|
2010-11-25 10:13:38 +01:00
|
|
|
$update = 'remove';
|
2010-11-24 06:31:25 +01:00
|
|
|
if ( isset( $_REQUEST['users'] ) ) {
|
|
|
|
$userids = $_REQUEST['users'];
|
|
|
|
|
|
|
|
foreach ( $userids as $user_id ) {
|
|
|
|
$user_id = (int) $user_id;
|
|
|
|
remove_user_from_blog( $user_id, $id );
|
|
|
|
}
|
2010-11-25 10:13:38 +01:00
|
|
|
} elseif ( isset( $_GET['user'] ) ) {
|
2010-11-24 06:31:25 +01:00
|
|
|
remove_user_from_blog( $_GET['user'] );
|
2010-11-25 10:13:38 +01:00
|
|
|
} else {
|
|
|
|
$update = 'err_remove';
|
2010-11-24 06:31:25 +01:00
|
|
|
}
|
|
|
|
break;
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
case 'promote':
|
2010-12-24 23:37:51 +01:00
|
|
|
check_admin_referer( 'bulk-users' );
|
2010-11-24 06:31:25 +01:00
|
|
|
$editable_roles = get_editable_roles();
|
2017-12-01 00:11:00 +01:00
|
|
|
$role = false;
|
2017-05-18 19:08:43 +02:00
|
|
|
if ( ! empty( $_REQUEST['new_role2'] ) ) {
|
|
|
|
$role = $_REQUEST['new_role2'];
|
|
|
|
} elseif ( ! empty( $_REQUEST['new_role'] ) ) {
|
|
|
|
$role = $_REQUEST['new_role'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( empty( $editable_roles[ $role ] ) ) {
|
2017-06-25 20:46:44 +02:00
|
|
|
wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 );
|
2016-09-28 01:52:28 +02:00
|
|
|
}
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2010-11-25 10:13:38 +01:00
|
|
|
if ( isset( $_REQUEST['users'] ) ) {
|
|
|
|
$userids = $_REQUEST['users'];
|
2017-12-01 00:11:00 +01:00
|
|
|
$update = 'promote';
|
2010-11-25 10:13:38 +01:00
|
|
|
foreach ( $userids as $user_id ) {
|
|
|
|
$user_id = (int) $user_id;
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2010-11-25 10:13:38 +01:00
|
|
|
// If the user doesn't already belong to the blog, bail.
|
2015-09-03 11:03:24 +02:00
|
|
|
if ( ! is_user_member_of_blog( $user_id ) ) {
|
|
|
|
wp_die(
|
2018-02-19 03:13:32 +01:00
|
|
|
'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
|
2015-09-03 11:03:24 +02:00
|
|
|
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
|
|
|
|
403
|
|
|
|
);
|
|
|
|
}
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2012-08-03 03:06:05 +02:00
|
|
|
$user = get_userdata( $user_id );
|
2017-05-18 19:08:43 +02:00
|
|
|
$user->set_role( $role );
|
2010-11-25 10:13:38 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$update = 'err_promote';
|
2010-11-24 06:31:25 +01:00
|
|
|
}
|
|
|
|
break;
|
2016-09-23 22:33:30 +02:00
|
|
|
default:
|
|
|
|
if ( ! isset( $_REQUEST['users'] ) ) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
check_admin_referer( 'bulk-users' );
|
|
|
|
$userids = $_REQUEST['users'];
|
2016-10-26 16:37:29 +02:00
|
|
|
/** This action is documented in wp-admin/network/site-themes.php */
|
|
|
|
$referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $userids, $id );
|
2017-12-01 00:11:00 +01:00
|
|
|
$update = $action;
|
2016-09-23 22:33:30 +02:00
|
|
|
break;
|
2010-10-21 20:35:52 +02:00
|
|
|
}
|
2011-12-09 00:02:33 +01:00
|
|
|
|
2011-12-10 19:26:48 +01:00
|
|
|
wp_safe_redirect( add_query_arg( 'update', $update, $referer ) );
|
2010-11-25 10:25:50 +01:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2012-08-03 19:51:42 +02:00
|
|
|
restore_current_blog();
|
|
|
|
|
2010-11-25 10:25:50 +01:00
|
|
|
if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
|
2011-12-10 19:26:48 +01:00
|
|
|
wp_safe_redirect( $referer );
|
2010-11-25 10:25:50 +01:00
|
|
|
exit();
|
2010-10-21 20:35:52 +02:00
|
|
|
}
|
|
|
|
|
2015-03-10 16:32:27 +01:00
|
|
|
add_screen_option( 'per_page' );
|
2011-10-02 08:59:36 +02:00
|
|
|
|
2016-08-23 01:53:31 +02:00
|
|
|
/* translators: %s: site name */
|
2015-07-13 02:27:24 +02:00
|
|
|
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) );
|
2011-06-03 17:35:45 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$parent_file = 'sites.php';
|
2010-10-21 20:35:52 +02:00
|
|
|
$submenu_file = 'sites.php';
|
|
|
|
|
2013-10-26 22:33:09 +02:00
|
|
|
/**
|
2016-05-22 20:01:30 +02:00
|
|
|
* Filters whether to show the Add Existing User form on the Multisite Users screen.
|
2013-10-26 22:33:09 +02:00
|
|
|
*
|
|
|
|
* @since 3.1.0
|
|
|
|
*
|
|
|
|
* @param bool $bool Whether to show the Add Existing User form. Default true.
|
|
|
|
*/
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) {
|
2012-06-05 20:51:33 +02:00
|
|
|
wp_enqueue_script( 'user-suggest' );
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2012-02-10 09:45:17 +01:00
|
|
|
|
2013-09-25 02:18:11 +02:00
|
|
|
require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2014-05-19 03:59:15 +02:00
|
|
|
<script type="text/javascript">
|
2012-02-10 09:45:17 +01:00
|
|
|
var current_site_id = <?php echo $id; ?>;
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
2010-10-21 20:35:52 +02:00
|
|
|
<div class="wrap">
|
2015-07-13 02:27:24 +02:00
|
|
|
<h1 id="edit-site"><?php echo $title; ?></h1>
|
2015-08-10 20:11:25 +02:00
|
|
|
<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p>
|
2010-10-21 20:35:52 +02:00
|
|
|
<?php
|
2016-05-19 23:48:30 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
network_edit_site_nav(
|
|
|
|
array(
|
|
|
|
'blog_id' => $id,
|
|
|
|
'selected' => 'site-users',
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( isset( $_GET['update'] ) ) :
|
|
|
|
switch ( $_GET['update'] ) {
|
|
|
|
case 'adduser':
|
|
|
|
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_add_member':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_add_fail':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User could not be added to this site.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_add_notfound':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'promote':
|
|
|
|
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_promote':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'remove':
|
|
|
|
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_remove':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'newuser':
|
|
|
|
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_new':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
|
|
|
|
break;
|
|
|
|
case 'err_new_dup':
|
|
|
|
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
|
|
|
|
break;
|
2010-11-25 10:13:38 +01:00
|
|
|
}
|
2017-12-01 00:11:00 +01:00
|
|
|
endif;
|
|
|
|
?>
|
2010-11-25 10:13:38 +01:00
|
|
|
|
2015-01-16 05:16:24 +01:00
|
|
|
<form class="search-form" method="get">
|
2010-12-16 21:45:10 +01:00
|
|
|
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
|
2017-12-01 00:11:00 +01:00
|
|
|
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
|
2010-11-24 06:31:25 +01:00
|
|
|
</form>
|
|
|
|
|
|
|
|
<?php $wp_list_table->views(); ?>
|
|
|
|
|
2012-09-19 01:06:22 +02:00
|
|
|
<form method="post" action="site-users.php?action=update-site">
|
2017-12-01 00:11:00 +01:00
|
|
|
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
|
2010-10-21 20:35:52 +02:00
|
|
|
|
2010-11-24 06:31:25 +01:00
|
|
|
<?php $wp_list_table->display(); ?>
|
2010-10-21 20:35:52 +02:00
|
|
|
|
|
|
|
</form>
|
|
|
|
|
2013-10-26 22:33:09 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Fires after the list table on the Users screen in the Multisite Network Admin.
|
|
|
|
*
|
|
|
|
* @since 3.1.0
|
|
|
|
*/
|
|
|
|
do_action( 'network_site_users_after_list_table' );
|
2010-12-13 12:58:49 +01:00
|
|
|
|
2013-10-26 22:33:09 +02:00
|
|
|
/** This filter is documented in wp-admin/network/site-users.php */
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) :
|
2018-08-17 03:51:36 +02:00
|
|
|
?>
|
2015-10-01 16:33:26 +02:00
|
|
|
<h2 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h2>
|
2010-11-25 12:12:33 +01:00
|
|
|
<form action="site-users.php?action=adduser" id="adduser" method="post">
|
2017-12-01 00:11:00 +01:00
|
|
|
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
|
2010-11-17 20:45:10 +01:00
|
|
|
<table class="form-table">
|
|
|
|
<tr>
|
2015-02-23 03:29:26 +01:00
|
|
|
<th scope="row"><label for="newuser"><?php _e( 'Username' ); ?></label></th>
|
2012-06-05 20:51:33 +02:00
|
|
|
<td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td>
|
2010-11-17 20:45:10 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-02-23 03:29:26 +01:00
|
|
|
<th scope="row"><label for="new_role_adduser"><?php _e( 'Role' ); ?></label></th>
|
|
|
|
<td><select name="new_role" id="new_role_adduser">
|
2017-09-30 05:20:46 +02:00
|
|
|
<?php
|
|
|
|
switch_to_blog( $id );
|
|
|
|
wp_dropdown_roles( get_option( 'default_role' ) );
|
|
|
|
restore_current_blog();
|
|
|
|
?>
|
2010-11-17 20:45:10 +01:00
|
|
|
</select></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2017-12-01 00:11:00 +01:00
|
|
|
<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?>
|
2012-09-15 21:38:23 +02:00
|
|
|
<?php submit_button( __( 'Add User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-existing-user' ) ); ?>
|
2010-11-25 12:12:33 +01:00
|
|
|
</form>
|
2010-12-13 12:58:49 +01:00
|
|
|
<?php endif; ?>
|
2010-11-25 12:12:33 +01:00
|
|
|
|
2013-10-26 22:33:09 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2016-05-22 20:01:30 +02:00
|
|
|
* Filters whether to show the Add New User form on the Multisite Users screen.
|
2013-10-26 22:33:09 +02:00
|
|
|
*
|
|
|
|
* @since 3.1.0
|
|
|
|
*
|
|
|
|
* @param bool $bool Whether to show the Add New User form. Default true.
|
|
|
|
*/
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) :
|
2018-08-17 03:51:36 +02:00
|
|
|
?>
|
2015-10-01 16:33:26 +02:00
|
|
|
<h2 id="add-new-user"><?php _e( 'Add New User' ); ?></h2>
|
2017-12-01 00:11:00 +01:00
|
|
|
<form action="<?php echo network_admin_url( 'site-users.php?action=newuser' ); ?>" id="newuser" method="post">
|
|
|
|
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
|
2010-11-25 12:12:33 +01:00
|
|
|
<table class="form-table">
|
|
|
|
<tr>
|
2017-12-01 00:11:00 +01:00
|
|
|
<th scope="row"><label for="user_username"><?php _e( 'Username' ); ?></label></th>
|
2015-02-23 03:29:26 +01:00
|
|
|
<td><input type="text" class="regular-text" name="user[username]" id="user_username" /></td>
|
2010-11-25 12:12:33 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2017-12-01 00:11:00 +01:00
|
|
|
<th scope="row"><label for="user_email"><?php _e( 'Email' ); ?></label></th>
|
2015-02-23 03:29:26 +01:00
|
|
|
<td><input type="text" class="regular-text" name="user[email]" id="user_email" /></td>
|
2010-11-25 12:12:33 +01:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-02-23 03:29:26 +01:00
|
|
|
<th scope="row"><label for="new_role_newuser"><?php _e( 'Role' ); ?></label></th>
|
|
|
|
<td><select name="new_role" id="new_role_newuser">
|
2017-09-30 05:20:46 +02:00
|
|
|
<?php
|
|
|
|
switch_to_blog( $id );
|
|
|
|
wp_dropdown_roles( get_option( 'default_role' ) );
|
|
|
|
restore_current_blog();
|
|
|
|
?>
|
2010-11-25 12:12:33 +01:00
|
|
|
</select></td>
|
|
|
|
</tr>
|
|
|
|
<tr class="form-field">
|
2017-12-01 00:11:00 +01:00
|
|
|
<td colspan="2"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></td>
|
2010-11-25 12:12:33 +01:00
|
|
|
</tr>
|
|
|
|
</table>
|
2017-12-01 00:11:00 +01:00
|
|
|
<?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ); ?>
|
2012-09-15 21:38:23 +02:00
|
|
|
<?php submit_button( __( 'Add New User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-user' ) ); ?>
|
2010-11-25 12:12:33 +01:00
|
|
|
</form>
|
2010-12-13 12:58:49 +01:00
|
|
|
<?php endif; ?>
|
2010-12-15 10:05:10 +01:00
|
|
|
</div>
|
2010-10-21 20:35:52 +02:00
|
|
|
<?php
|
2013-09-25 02:18:11 +02:00
|
|
|
require( ABSPATH . 'wp-admin/admin-footer.php' );
|