<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16183] trunk/wp-admin/network: Add new user page for network admin.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16183">16183</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-04 16:16:52 +0000 (Thu, 04 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add new user page for network admin. Props PeteMall. see <a href="http://trac.wordpress.org/ticket/14435">#14435</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminnetworkeditphp">trunk/wp-admin/network/edit.php</a></li>
<li><a href="#trunkwpadminnetworkmenuphp">trunk/wp-admin/network/menu.php</a></li>
<li><a href="#trunkwpadminnetworkusersphp">trunk/wp-admin/network/users.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminnetworkusernewphp">trunk/wp-admin/network/user-new.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminnetworkeditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/edit.php (16182 => 16183)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/edit.php        2010-11-04 15:00:55 UTC (rev 16182)
+++ trunk/wp-admin/network/edit.php        2010-11-04 16:16:52 UTC (rev 16183)
</span><span class="lines">@@ -444,33 +444,6 @@
</span><span class="cx">                 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) );
</span><span class="cx">         break;
</span><span class="cx">
</span><del>-        case 'adduser':
-                check_admin_referer( 'add-user', '_wpnonce_add-user' );
-                if ( ! current_user_can( 'manage_network_users' ) )
-                        wp_die( __( 'You do not have permission to access this page.' ) );
-
-                if ( is_array( $_POST['user'] ) == false )
-                        wp_die( __( 'Cannot create an empty user.' ) );
-                $user = $_POST['user'];
-                if ( empty($user['username']) && empty($user['email']) )
-                        wp_die( __( 'Missing username and email.' ) );
-                elseif ( empty($user['username']) )
-                        wp_die( __( 'Missing username.' ) );
-                elseif ( empty($user['email']) )
-                        wp_die( __( 'Missing email.' ) );
-
-                $password = wp_generate_password();
-                $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
-
-                if ( false == $user_id )
-                         wp_die( __( 'Duplicated username or email address.' ) );
-                else
-                        wp_new_user_notification( $user_id, $password );
-
-                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) );
-                exit();
-        break;
-
</del><span class="cx">         default:
</span><span class="cx">                 wp_redirect( network_admin_url( 'index.php' ) );
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkwpadminnetworkmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/menu.php (16182 => 16183)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/menu.php        2010-11-04 15:00:55 UTC (rev 16182)
+++ trunk/wp-admin/network/menu.php        2010-11-04 16:16:52 UTC (rev 16183)
</span><span class="lines">@@ -14,11 +14,12 @@
</span><span class="cx">
</span><span class="cx"> /* translators: Sites menu item */
</span><span class="cx"> $menu[5] = array(__('Sites'), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'div');
</span><del>-
</del><span class="cx"> $submenu['sites.php'][5] = array( __('Sites'), 'manage_sites', 'sites.php' );
</span><span class="cx"> $submenu['sites.php'][10] = array( __('Add New'), 'create_sites', 'site-new.php' );
</span><span class="cx">
</span><span class="cx"> $menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div');
</span><ins>+$submenu['users.php'][5] = array( __('Users'), 'manage_network_users', 'users.php' );
+$submenu['users.php'][10] = array( __('Add New'), 'manage_network_users', 'user-new.php' );
</ins><span class="cx">
</span><span class="cx"> $menu[15] = array(__('Themes'), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div');
</span><span class="cx"> $submenu['themes.php'][5] = array( __('Themes'), 'manage_network_themes', 'themes.php' );
</span></span></pre></div>
<a id="trunkwpadminnetworkusernewphp"></a>
<div class="addfile"><h4>Added: trunk/wp-admin/network/user-new.php (0 => 16183)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/user-new.php         (rev 0)
+++ trunk/wp-admin/network/user-new.php        2010-11-04 16:16:52 UTC (rev 16183)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+<?php
+
+/**
+ * Add Site Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once('./admin.php');
+
+if ( ! is_multisite() )
+        wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can('manage_network_users') )
+        wp_die(__('You do not have sufficient permissions to add users to this network.'));
+
+if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) {
+        check_admin_referer( 'add-user', '_wpnonce_add-user' );
+        if ( ! current_user_can( 'manage_network_users' ) )
+                wp_die( __( 'You do not have permission to access this page.' ) );
+
+        if ( is_array( $_POST['user'] ) == false )
+                wp_die( __( 'Cannot create an empty user.' ) );
+        $user = $_POST['user'];
+        if ( empty($user['username']) && empty($user['email']) )
+                wp_die( __( 'Missing username and email.' ) );
+        elseif ( empty($user['username']) )
+                wp_die( __( 'Missing username.' ) );
+        elseif ( empty($user['email']) )
+                wp_die( __( 'Missing email.' ) );
+
+        $password = wp_generate_password();
+        $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, esc_html( $user['email'] ) );
+
+        if ( false == $user_id )
+                 wp_die( __( 'Duplicated username or email address.' ) );
+        else
+                wp_new_user_notification( $user_id, $password );
+                
+        wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) );
+        exit;
+}
+
+if ( isset($_GET['update']) ) {
+        $messages = array();
+        if ( 'added' == $_GET['update'] )
+                $messages[] = __('User added.');
+}
+
+$title = __('Add New User');
+$parent_file = 'users.php';
+
+require('../admin-header.php'); ?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
+<?php
+if ( ! empty( $messages ) ) {
+        foreach ( $messages as $msg )
+                echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+} ?>
+        <form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" method="post">        
+        <table class="form-table">
+                <tr class="form-field form-required">
+                        <th scope="row"><?php _e( 'Username' ) ?></th>
+                        <td><input type="text" class="regular-text" name="user[username]" /></td>
+                </tr>
+                <tr class="form-field form-required">
+                        <th scope="row"><?php _e( 'Email' ) ?></th>
+                        <td><input type="text" class="regular-text" name="user[email]" /></td>
+                </tr>
+                <tr class="form-field">
+                        <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
+                </tr>
+        </table>
+        <p class="submit">
+                <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
+                <?php submit_button( __('Add User'), 'primary', 'add-user' ); ?>
+        </form>
+</div>
+<?php
+require('../admin-footer.php');
+?>
</ins><span class="cx">\ No newline at end of file
</span><span class="cx">Property changes on: trunk/wp-admin/network/user-new.php
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="trunkwpadminnetworkusersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/users.php (16182 => 16183)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/users.php        2010-11-04 15:00:55 UTC (rev 16182)
+++ trunk/wp-admin/network/users.php        2010-11-04 16:16:52 UTC (rev 16183)
</span><span class="lines">@@ -62,9 +62,11 @@
</span><span class="cx">         ?>
</span><span class="cx"> <div class="wrap">
</span><span class="cx">         <?php screen_icon(); ?>
</span><del>-        <h2><?php esc_html_e( 'Users' ); ?>
-        <a href="#form-add-user" class="button add-new-h2"><?php echo esc_html_x( 'Add New' , 'users'); ?></a>
-        <?php
</del><ins>+        <h2><?php esc_html_e( 'Users' );
+        if ( current_user_can( 'create_users') ) : ?>
+                <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
+        endif;
+        
</ins><span class="cx">         if ( !empty( $usersearch ) )
</span><span class="cx">         printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
</span><span class="cx">         ?>
</span><span class="lines">@@ -82,30 +84,4 @@
</span><span class="cx">         </form>
</span><span class="cx"> </div>
</span><span class="cx">
</span><del>-<?php
-if ( apply_filters( 'show_adduser_fields', true ) ) :
-?>
-<div class="wrap" id="form-add-user">
-        <h3><?php _e( 'Add User' ) ?></h3>
-        <form action="edit.php?action=adduser" method="post">
-        <table class="form-table">
-                <tr class="form-field form-required">
-                        <th scope="row"><?php _e( 'Username' ) ?></th>
-                        <td><input type="text" class="regular-text" name="user[username]" /></td>
-                </tr>
-                <tr class="form-field form-required">
-                        <th scope="row"><?php _e( 'Email' ) ?></th>
-                        <td><input type="text" class="regular-text" name="user[email]" /></td>
-                </tr>
-                <tr class="form-field">
-                        <td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
-                </tr>
-        </table>
-        <p class="submit">
-                <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
-                <input class="button" type="submit" value="<?php esc_attr_e( 'Add user' ) ?>" /></p>
-        </form>
-</div>
-<?php endif;
-
-require_once( '../admin-footer.php' ); ?>
</del><ins>+<?php require_once( '../admin-footer.php' ); ?>
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>
</body>
</html>