WordPress.org

Make WordPress Core

Changeset 16183


Ignore:
Timestamp:
11/04/10 16:16:52 (3 years ago)
Author:
ryan
Message:

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

Location:
trunk/wp-admin/network
Files:
1 added
3 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' ) ); 
  • trunk/wp-admin/network/menu.php

    r16103 r16183  
    1515/* translators: Sites menu item */ 
    1616$menu[5] = array(__('Sites'), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'div'); 
    17  
    1817$submenu['sites.php'][5]  = array( __('Sites'), 'manage_sites', 'sites.php' ); 
    1918$submenu['sites.php'][10]  = array( __('Add New'), 'create_sites', 'site-new.php' ); 
    2019 
    2120$menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div'); 
     21$submenu['users.php'][5]  = array( __('Users'), 'manage_network_users', 'users.php' ); 
     22$submenu['users.php'][10]  = array( __('Add New'), 'manage_network_users', 'user-new.php' ); 
    2223 
    2324$menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div'); 
  • trunk/wp-admin/network/users.php

    r16175 r16183  
    6363<div class="wrap"> 
    6464    <?php screen_icon(); ?> 
    65     <h2><?php esc_html_e( 'Users' ); ?> 
    66     <a href="#form-add-user" class="button add-new-h2"><?php echo esc_html_x( 'Add New' , 'users'); ?></a> 
    67     <?php 
     65    <h2><?php esc_html_e( 'Users' ); 
     66    if ( current_user_can( 'create_users') ) : ?> 
     67        <a href="<?php echo network_admin_url('user-new.php'); ?>" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'users' ); ?></a><?php 
     68    endif; 
     69     
    6870    if ( !empty( $usersearch ) ) 
    6971    printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) ); 
     
    8385</div> 
    8486 
    85 <?php 
    86 if ( apply_filters( 'show_adduser_fields', true ) ) : 
    87 ?> 
    88 <div class="wrap" id="form-add-user"> 
    89     <h3><?php _e( 'Add User' ) ?></h3> 
    90     <form action="edit.php?action=adduser" method="post"> 
    91     <table class="form-table"> 
    92         <tr class="form-field form-required"> 
    93             <th scope="row"><?php _e( 'Username' ) ?></th> 
    94             <td><input type="text" class="regular-text" name="user[username]" /></td> 
    95         </tr> 
    96         <tr class="form-field form-required"> 
    97             <th scope="row"><?php _e( 'Email' ) ?></th> 
    98             <td><input type="text" class="regular-text" name="user[email]" /></td> 
    99         </tr> 
    100         <tr class="form-field"> 
    101             <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td> 
    102         </tr> 
    103     </table> 
    104     <p class="submit"> 
    105         <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> 
    106         <input class="button" type="submit" value="<?php esc_attr_e( 'Add user' ) ?>" /></p> 
    107     </form> 
    108 </div> 
    109 <?php endif; 
    110  
    111 require_once( '../admin-footer.php' ); ?> 
     87<?php require_once( '../admin-footer.php' ); ?> 
Note: See TracChangeset for help on using the changeset viewer.