author | ymh <ymh.work@gmail.com> |
Tue, 22 Oct 2019 16:11:46 +0200 | |
changeset 15 | 3d4e9c994f10 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* Edit Site Users Administration Screen |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Multisite |
|
7 |
* @since 3.1.0 |
|
8 |
*/ |
|
9 |
||
10 |
/** Load WordPress Administration Bootstrap */ |
|
11 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
12 |
||
9 | 13 |
if ( ! current_user_can( 'manage_sites' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
wp_die( __( 'Sorry, you are not allowed to edit this site.' ), 403 ); |
9 | 15 |
} |
0 | 16 |
|
9 | 17 |
$wp_list_table = _get_list_table( 'WP_Users_List_Table' ); |
0 | 18 |
$wp_list_table->prepare_items(); |
19 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
get_current_screen()->add_help_tab( get_site_screen_help_tab_args() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
get_current_screen()->set_help_sidebar( get_site_screen_help_sidebar_content() ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
|
9 | 23 |
get_current_screen()->set_screen_reader_content( |
24 |
array( |
|
25 |
'heading_views' => __( 'Filter site users list' ), |
|
26 |
'heading_pagination' => __( 'Site users list navigation' ), |
|
27 |
'heading_list' => __( 'Site users list' ), |
|
28 |
) |
|
29 |
); |
|
0 | 30 |
|
31 |
$_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] ); |
|
9 | 32 |
$referer = remove_query_arg( 'update', wp_get_referer() ); |
0 | 33 |
|
5 | 34 |
if ( ! empty( $_REQUEST['paged'] ) ) { |
35 |
$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); |
|
36 |
} |
|
37 |
||
0 | 38 |
$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
39 |
||
9 | 40 |
if ( ! $id ) { |
41 |
wp_die( __( 'Invalid site ID.' ) ); |
|
42 |
} |
|
0 | 43 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
44 |
$details = get_site( $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
45 |
if ( ! $details ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
46 |
wp_die( __( 'The requested site does not exist.' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
47 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
48 |
|
9 | 49 |
if ( ! can_edit_network( $details->site_id ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
50 |
wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
9 | 51 |
} |
0 | 52 |
|
53 |
$is_main_site = is_main_site( $id ); |
|
54 |
||
55 |
switch_to_blog( $id ); |
|
56 |
||
57 |
$action = $wp_list_table->current_action(); |
|
58 |
||
59 |
if ( $action ) { |
|
60 |
||
61 |
switch ( $action ) { |
|
62 |
case 'newuser': |
|
63 |
check_admin_referer( 'add-user', '_wpnonce_add-new-user' ); |
|
64 |
$user = $_POST['user']; |
|
65 |
if ( ! is_array( $_POST['user'] ) || empty( $user['username'] ) || empty( $user['email'] ) ) { |
|
66 |
$update = 'err_new'; |
|
67 |
} else { |
|
9 | 68 |
$password = wp_generate_password( 12, false ); |
69 |
$user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) ); |
|
0 | 70 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
71 |
if ( false === $user_id ) { |
9 | 72 |
$update = 'err_new_dup'; |
0 | 73 |
} else { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
$result = add_user_to_blog( $id, $user_id, $_POST['new_role'] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
75 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
if ( is_wp_error( $result ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
77 |
$update = 'err_add_fail'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
78 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
79 |
$update = 'newuser'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
80 |
/** |
9 | 81 |
* Fires after a user has been created via the network site-users.php page. |
82 |
* |
|
83 |
* @since 4.4.0 |
|
84 |
* |
|
85 |
* @param int $user_id ID of the newly created user. |
|
86 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
do_action( 'network_site_users_created_user', $user_id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
} |
0 | 89 |
} |
90 |
} |
|
91 |
break; |
|
92 |
||
93 |
case 'adduser': |
|
94 |
check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
|
9 | 95 |
if ( ! empty( $_POST['newuser'] ) ) { |
96 |
$update = 'adduser'; |
|
0 | 97 |
$newuser = $_POST['newuser']; |
9 | 98 |
$user = get_user_by( 'login', $newuser ); |
0 | 99 |
if ( $user && $user->exists() ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
if ( ! is_user_member_of_blog( $user->ID, $id ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
101 |
$result = add_user_to_blog( $id, $user->ID, $_POST['new_role'] ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
103 |
if ( is_wp_error( $result ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
104 |
$update = 'err_add_fail'; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
105 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
106 |
} else { |
0 | 107 |
$update = 'err_add_member'; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
108 |
} |
0 | 109 |
} else { |
110 |
$update = 'err_add_notfound'; |
|
111 |
} |
|
112 |
} else { |
|
113 |
$update = 'err_add_notfound'; |
|
114 |
} |
|
115 |
break; |
|
116 |
||
117 |
case 'remove': |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
118 |
if ( ! current_user_can( 'remove_users' ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
119 |
wp_die( __( 'Sorry, you are not allowed to remove users.' ), 403 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
120 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
|
0 | 122 |
check_admin_referer( 'bulk-users' ); |
123 |
||
124 |
$update = 'remove'; |
|
125 |
if ( isset( $_REQUEST['users'] ) ) { |
|
126 |
$userids = $_REQUEST['users']; |
|
127 |
||
128 |
foreach ( $userids as $user_id ) { |
|
129 |
$user_id = (int) $user_id; |
|
130 |
remove_user_from_blog( $user_id, $id ); |
|
131 |
} |
|
132 |
} elseif ( isset( $_GET['user'] ) ) { |
|
133 |
remove_user_from_blog( $_GET['user'] ); |
|
134 |
} else { |
|
135 |
$update = 'err_remove'; |
|
136 |
} |
|
137 |
break; |
|
138 |
||
139 |
case 'promote': |
|
140 |
check_admin_referer( 'bulk-users' ); |
|
141 |
$editable_roles = get_editable_roles(); |
|
9 | 142 |
$role = false; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
if ( ! empty( $_REQUEST['new_role2'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
144 |
$role = $_REQUEST['new_role2']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
145 |
} elseif ( ! empty( $_REQUEST['new_role'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
146 |
$role = $_REQUEST['new_role']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
147 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
148 |
|
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
149 |
if ( empty( $editable_roles[ $role ] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
150 |
wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
151 |
} |
0 | 152 |
|
153 |
if ( isset( $_REQUEST['users'] ) ) { |
|
154 |
$userids = $_REQUEST['users']; |
|
9 | 155 |
$update = 'promote'; |
0 | 156 |
foreach ( $userids as $user_id ) { |
157 |
$user_id = (int) $user_id; |
|
158 |
||
159 |
// If the user doesn't already belong to the blog, bail. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
160 |
if ( ! is_user_member_of_blog( $user_id ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
161 |
wp_die( |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
162 |
'<h1>' . __( 'Something went wrong.' ) . '</h1>' . |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
163 |
'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>', |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
164 |
403 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
165 |
); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
} |
0 | 167 |
|
168 |
$user = get_userdata( $user_id ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
169 |
$user->set_role( $role ); |
0 | 170 |
} |
171 |
} else { |
|
172 |
$update = 'err_promote'; |
|
173 |
} |
|
174 |
break; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
175 |
default: |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
if ( ! isset( $_REQUEST['users'] ) ) { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
177 |
break; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
179 |
check_admin_referer( 'bulk-users' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
180 |
$userids = $_REQUEST['users']; |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
181 |
/** This action is documented in wp-admin/network/site-themes.php */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
182 |
$referer = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $referer, $action, $userids, $id ); |
9 | 183 |
$update = $action; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
184 |
break; |
0 | 185 |
} |
186 |
||
187 |
wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); |
|
188 |
exit(); |
|
189 |
} |
|
190 |
||
191 |
restore_current_blog(); |
|
192 |
||
193 |
if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { |
|
194 |
wp_safe_redirect( $referer ); |
|
195 |
exit(); |
|
196 |
} |
|
197 |
||
5 | 198 |
add_screen_option( 'per_page' ); |
0 | 199 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
200 |
/* translators: %s: site name */ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
201 |
$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
0 | 202 |
|
9 | 203 |
$parent_file = 'sites.php'; |
0 | 204 |
$submenu_file = 'sites.php'; |
205 |
||
5 | 206 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
207 |
* Filters whether to show the Add Existing User form on the Multisite Users screen. |
5 | 208 |
* |
209 |
* @since 3.1.0 |
|
210 |
* |
|
211 |
* @param bool $bool Whether to show the Add Existing User form. Default true. |
|
212 |
*/ |
|
9 | 213 |
if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) { |
0 | 214 |
wp_enqueue_script( 'user-suggest' ); |
9 | 215 |
} |
0 | 216 |
|
217 |
require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
218 |
||
5 | 219 |
<script type="text/javascript"> |
0 | 220 |
var current_site_id = <?php echo $id; ?>; |
221 |
</script> |
|
222 |
||
223 |
||
224 |
<div class="wrap"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
225 |
<h1 id="edit-site"><?php echo $title; ?></h1> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
226 |
<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> |
0 | 227 |
<?php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
228 |
|
9 | 229 |
network_edit_site_nav( |
230 |
array( |
|
231 |
'blog_id' => $id, |
|
232 |
'selected' => 'site-users', |
|
233 |
) |
|
234 |
); |
|
0 | 235 |
|
9 | 236 |
if ( isset( $_GET['update'] ) ) : |
237 |
switch ( $_GET['update'] ) { |
|
238 |
case 'adduser': |
|
239 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User added.' ) . '</p></div>'; |
|
240 |
break; |
|
241 |
case 'err_add_member': |
|
242 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User is already a member of this site.' ) . '</p></div>'; |
|
243 |
break; |
|
244 |
case 'err_add_fail': |
|
245 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'User could not be added to this site.' ) . '</p></div>'; |
|
246 |
break; |
|
247 |
case 'err_add_notfound': |
|
248 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>'; |
|
249 |
break; |
|
250 |
case 'promote': |
|
251 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>'; |
|
252 |
break; |
|
253 |
case 'err_promote': |
|
254 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to change role.' ) . '</p></div>'; |
|
255 |
break; |
|
256 |
case 'remove': |
|
257 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User removed from this site.' ) . '</p></div>'; |
|
258 |
break; |
|
259 |
case 'err_remove': |
|
260 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Select a user to remove.' ) . '</p></div>'; |
|
261 |
break; |
|
262 |
case 'newuser': |
|
263 |
echo '<div id="message" class="updated notice is-dismissible"><p>' . __( 'User created.' ) . '</p></div>'; |
|
264 |
break; |
|
265 |
case 'err_new': |
|
266 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Enter the username and email.' ) . '</p></div>'; |
|
267 |
break; |
|
268 |
case 'err_new_dup': |
|
269 |
echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>'; |
|
270 |
break; |
|
0 | 271 |
} |
9 | 272 |
endif; |
273 |
?> |
|
0 | 274 |
|
5 | 275 |
<form class="search-form" method="get"> |
0 | 276 |
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?> |
9 | 277 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
0 | 278 |
</form> |
279 |
||
280 |
<?php $wp_list_table->views(); ?> |
|
281 |
||
282 |
<form method="post" action="site-users.php?action=update-site"> |
|
9 | 283 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
0 | 284 |
|
285 |
<?php $wp_list_table->display(); ?> |
|
286 |
||
287 |
</form> |
|
288 |
||
5 | 289 |
<?php |
290 |
/** |
|
291 |
* Fires after the list table on the Users screen in the Multisite Network Admin. |
|
292 |
* |
|
293 |
* @since 3.1.0 |
|
294 |
*/ |
|
295 |
do_action( 'network_site_users_after_list_table' ); |
|
0 | 296 |
|
5 | 297 |
/** This filter is documented in wp-admin/network/site-users.php */ |
9 | 298 |
if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) : |
299 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
300 |
<h2 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h2> |
0 | 301 |
<form action="site-users.php?action=adduser" id="adduser" method="post"> |
9 | 302 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
303 |
<table class="form-table" role="presentation"> |
|
0 | 304 |
<tr> |
5 | 305 |
<th scope="row"><label for="newuser"><?php _e( 'Username' ); ?></label></th> |
0 | 306 |
<td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td> |
307 |
</tr> |
|
308 |
<tr> |
|
5 | 309 |
<th scope="row"><label for="new_role_adduser"><?php _e( 'Role' ); ?></label></th> |
310 |
<td><select name="new_role" id="new_role_adduser"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
311 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
312 |
switch_to_blog( $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
313 |
wp_dropdown_roles( get_option( 'default_role' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
314 |
restore_current_blog(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
315 |
?> |
0 | 316 |
</select></td> |
317 |
</tr> |
|
318 |
</table> |
|
9 | 319 |
<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?> |
0 | 320 |
<?php submit_button( __( 'Add User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-existing-user' ) ); ?> |
321 |
</form> |
|
322 |
<?php endif; ?> |
|
323 |
||
5 | 324 |
<?php |
325 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
326 |
* Filters whether to show the Add New User form on the Multisite Users screen. |
5 | 327 |
* |
328 |
* @since 3.1.0 |
|
329 |
* |
|
330 |
* @param bool $bool Whether to show the Add New User form. Default true. |
|
331 |
*/ |
|
9 | 332 |
if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : |
333 |
?> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
334 |
<h2 id="add-new-user"><?php _e( 'Add New User' ); ?></h2> |
9 | 335 |
<form action="<?php echo network_admin_url( 'site-users.php?action=newuser' ); ?>" id="newuser" method="post"> |
336 |
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
|
337 |
<table class="form-table" role="presentation"> |
|
0 | 338 |
<tr> |
9 | 339 |
<th scope="row"><label for="user_username"><?php _e( 'Username' ); ?></label></th> |
5 | 340 |
<td><input type="text" class="regular-text" name="user[username]" id="user_username" /></td> |
0 | 341 |
</tr> |
342 |
<tr> |
|
9 | 343 |
<th scope="row"><label for="user_email"><?php _e( 'Email' ); ?></label></th> |
5 | 344 |
<td><input type="text" class="regular-text" name="user[email]" id="user_email" /></td> |
345 |
</tr> |
|
346 |
<tr> |
|
347 |
<th scope="row"><label for="new_role_newuser"><?php _e( 'Role' ); ?></label></th> |
|
348 |
<td><select name="new_role" id="new_role_newuser"> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
349 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
350 |
switch_to_blog( $id ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
351 |
wp_dropdown_roles( get_option( 'default_role' ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
352 |
restore_current_blog(); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
353 |
?> |
0 | 354 |
</select></td> |
355 |
</tr> |
|
356 |
<tr class="form-field"> |
|
9 | 357 |
<td colspan="2" class="td-full"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></td> |
0 | 358 |
</tr> |
359 |
</table> |
|
9 | 360 |
<?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ); ?> |
0 | 361 |
<?php submit_button( __( 'Add New User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-user' ) ); ?> |
362 |
</form> |
|
363 |
<?php endif; ?> |
|
364 |
</div> |
|
365 |
<?php |
|
366 |
require( ABSPATH . 'wp-admin/admin-footer.php' ); |