<!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' =&gt; 'true', 'action' =&gt; $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']) &amp;&amp; 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' =&gt; 'true', 'action' =&gt; '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>+&lt;?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']) &amp;&amp; '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']) &amp;&amp; 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' =&gt; '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'); ?&gt;
+
+&lt;div class=&quot;wrap&quot;&gt;
+&lt;?php screen_icon(); ?&gt;
+&lt;h2 id=&quot;add-new-user&quot;&gt;&lt;?php _e('Add New User') ?&gt;&lt;/h2&gt;
+&lt;?php
+if ( ! empty( $messages ) ) {
+        foreach ( $messages as $msg )
+                echo '&lt;div id=&quot;message&quot; class=&quot;updated&quot;&gt;&lt;p&gt;' . $msg . '&lt;/p&gt;&lt;/div&gt;';
+} ?&gt;
+        &lt;form action=&quot;&lt;?php echo network_admin_url('user-new.php?action=add-user'); ?&gt;&quot; method=&quot;post&quot;&gt;        
+        &lt;table class=&quot;form-table&quot;&gt;
+                &lt;tr class=&quot;form-field form-required&quot;&gt;
+                        &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Username' ) ?&gt;&lt;/th&gt;
+                        &lt;td&gt;&lt;input type=&quot;text&quot; class=&quot;regular-text&quot; name=&quot;user[username]&quot; /&gt;&lt;/td&gt;
+                &lt;/tr&gt;
+                &lt;tr class=&quot;form-field form-required&quot;&gt;
+                        &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Email' ) ?&gt;&lt;/th&gt;
+                        &lt;td&gt;&lt;input type=&quot;text&quot; class=&quot;regular-text&quot; name=&quot;user[email]&quot; /&gt;&lt;/td&gt;
+                &lt;/tr&gt;
+                &lt;tr class=&quot;form-field&quot;&gt;
+                        &lt;td colspan=&quot;2&quot;&gt;&lt;?php _e( 'Username and password will be mailed to the above email address.' ) ?&gt;&lt;/td&gt;
+                &lt;/tr&gt;
+        &lt;/table&gt;
+        &lt;p class=&quot;submit&quot;&gt;
+                &lt;?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?&gt;
+                &lt;?php submit_button( __('Add User'), 'primary', 'add-user' ); ?&gt;
+        &lt;/form&gt;
+&lt;/div&gt;
+&lt;?php
+require('../admin-footer.php');
+?&gt;
</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">         ?&gt;
</span><span class="cx"> &lt;div class=&quot;wrap&quot;&gt;
</span><span class="cx">         &lt;?php screen_icon(); ?&gt;
</span><del>-        &lt;h2&gt;&lt;?php esc_html_e( 'Users' ); ?&gt;
-        &lt;a href=&quot;#form-add-user&quot; class=&quot;button add-new-h2&quot;&gt;&lt;?php echo esc_html_x( 'Add New' , 'users'); ?&gt;&lt;/a&gt;
-        &lt;?php
</del><ins>+        &lt;h2&gt;&lt;?php esc_html_e( 'Users' );
+        if ( current_user_can( 'create_users') ) : ?&gt;
+                &lt;a href=&quot;&lt;?php echo network_admin_url('user-new.php'); ?&gt;&quot; class=&quot;button add-new-h2&quot;&gt;&lt;?php echo esc_html_x( 'Add New', 'users' ); ?&gt;&lt;/a&gt;&lt;?php
+        endif;
+        
</ins><span class="cx">         if ( !empty( $usersearch ) )
</span><span class="cx">         printf( '&lt;span class=&quot;subtitle&quot;&gt;' . __( 'Search results for &amp;#8220;%s&amp;#8221;' ) . '&lt;/span&gt;', esc_html( $usersearch ) );
</span><span class="cx">         ?&gt;
</span><span class="lines">@@ -82,30 +84,4 @@
</span><span class="cx">         &lt;/form&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><del>-&lt;?php
-if ( apply_filters( 'show_adduser_fields', true ) ) :
-?&gt;
-&lt;div class=&quot;wrap&quot; id=&quot;form-add-user&quot;&gt;
-        &lt;h3&gt;&lt;?php _e( 'Add User' ) ?&gt;&lt;/h3&gt;
-        &lt;form action=&quot;edit.php?action=adduser&quot; method=&quot;post&quot;&gt;
-        &lt;table class=&quot;form-table&quot;&gt;
-                &lt;tr class=&quot;form-field form-required&quot;&gt;
-                        &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Username' ) ?&gt;&lt;/th&gt;
-                        &lt;td&gt;&lt;input type=&quot;text&quot; class=&quot;regular-text&quot; name=&quot;user[username]&quot; /&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr class=&quot;form-field form-required&quot;&gt;
-                        &lt;th scope=&quot;row&quot;&gt;&lt;?php _e( 'Email' ) ?&gt;&lt;/th&gt;
-                        &lt;td&gt;&lt;input type=&quot;text&quot; class=&quot;regular-text&quot; name=&quot;user[email]&quot; /&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr class=&quot;form-field&quot;&gt;
-                        &lt;td colspan=&quot;2&quot;&gt;&lt;?php _e( 'Username and password will be mailed to the above email address.' ) ?&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-        &lt;/table&gt;
-        &lt;p class=&quot;submit&quot;&gt;
-                &lt;?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?&gt;
-                &lt;input class=&quot;button&quot; type=&quot;submit&quot; value=&quot;&lt;?php esc_attr_e( 'Add user' ) ?&gt;&quot; /&gt;&lt;/p&gt;
-        &lt;/form&gt;
-&lt;/div&gt;
-&lt;?php endif;
-
-require_once( '../admin-footer.php' ); ?&gt;
</del><ins>+&lt;?php require_once( '../admin-footer.php' ); ?&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>