wp/wp-admin/network/user-new.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-admin/network/user-new.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/network/user-new.php	Tue Dec 15 13:49:49 2020 +0100
@@ -8,7 +8,7 @@
  */
 
 /** Load WordPress Administration Bootstrap */
-require_once( dirname( __FILE__ ) . '/admin.php' );
+require_once __DIR__ . '/admin.php';
 
 if ( ! current_user_can( 'create_users' ) ) {
 	wp_die( __( 'Sorry, you are not allowed to add users to this network.' ) );
@@ -30,7 +30,7 @@
 	'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>'
 );
 
-if ( isset( $_REQUEST['action'] ) && 'add-user' == $_REQUEST['action'] ) {
+if ( isset( $_REQUEST['action'] ) && 'add-user' === $_REQUEST['action'] ) {
 	check_admin_referer( 'add-user', '_wpnonce_add-user' );
 
 	if ( ! current_user_can( 'manage_network_users' ) ) {
@@ -44,6 +44,7 @@
 	$user = wp_unslash( $_POST['user'] );
 
 	$user_details = wpmu_validate_user_signup( $user['username'], $user['email'] );
+
 	if ( is_wp_error( $user_details['errors'] ) && $user_details['errors']->has_errors() ) {
 		$add_user_errors = $user_details['errors'];
 	} else {
@@ -61,6 +62,7 @@
 			 * @param int $user_id ID of the newly created user.
 			 */
 			do_action( 'network_user_new_created_user', $user_id );
+
 			wp_redirect(
 				add_query_arg(
 					array(
@@ -77,7 +79,7 @@
 
 if ( isset( $_GET['update'] ) ) {
 	$messages = array();
-	if ( 'added' == $_GET['update'] ) {
+	if ( 'added' === $_GET['update'] ) {
 		$edit_link = '';
 		if ( isset( $_GET['user_id'] ) ) {
 			$user_id_new = absint( $_GET['user_id'] );
@@ -86,19 +88,20 @@
 			}
 		}
 
-		if ( empty( $edit_link ) ) {
-			$messages[] = __( 'User added.' );
-		} else {
-			/* translators: %s: edit page url */
-			$messages[] = sprintf( __( 'User added. <a href="%s">Edit user</a>' ), $edit_link );
+		$message = __( 'User added.' );
+
+		if ( $edit_link ) {
+			$message .= sprintf( ' <a href="%s">%s</a>', $edit_link, __( 'Edit user' ) );
 		}
+
+		$messages[] = $message;
 	}
 }
 
 $title       = __( 'Add New User' );
 $parent_file = 'users.php';
 
-require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
 
 <div class="wrap">
 <h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1>
@@ -147,4 +150,4 @@
 	</form>
 </div>
 <?php
-require( ABSPATH . 'wp-admin/admin-footer.php' );
+require_once ABSPATH . 'wp-admin/admin-footer.php';