diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/network/user-new.php --- 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 @@ '
' . __( 'Support Forums' ) . '
' ); -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. Edit user' ), $edit_link ); + $message = __( 'User added.' ); + + if ( $edit_link ) { + $message .= sprintf( ' %s', $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'; ?>