Make WordPress Core


Ignore:
Timestamp:
11/04/2010 04:16:52 PM (14 years ago)
Author:
ryan
Message:

Add new user page for network admin. Props PeteMall. see #14435

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/edit.php

    r16120 r16183  
    445445    break;
    446446
    447     case 'adduser':
    448         check_admin_referer( 'add-user', '_wpnonce_add-user' );
    449         if ( ! current_user_can( 'manage_network_users' ) )
    450             wp_die( __( 'You do not have permission to access this page.' ) );
    451 
    452         if ( is_array( $_POST['user'] ) == false )
    453             wp_die( __( 'Cannot create an empty user.' ) );
    454         $user = $_POST['user'];
    455         if ( empty($user['username']) && empty($user['email']) )
    456             wp_die( __( 'Missing username and email.' ) );
    457         elseif ( empty($user['username']) )
    458             wp_die( __( 'Missing username.' ) );
    459         elseif ( empty($user['email']) )
    460             wp_die( __( 'Missing email.' ) );
    461 
    462         $password = wp_generate_password();
    463         $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
    464 
    465         if ( false == $user_id )
    466             wp_die( __( 'Duplicated username or email address.' ) );
    467         else
    468             wp_new_user_notification( $user_id, $password );
    469 
    470         wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) );
    471         exit();
    472     break;
    473 
    474447    default:
    475448        wp_redirect( network_admin_url( 'index.php' ) );
Note: See TracChangeset for help on using the changeset viewer.