<!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>[16518] trunk/wp-admin/user-new.php: Fixes for user-new.php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16518">16518</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-20 22:36:46 +0000 (Sat, 20 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes for user-new.php. Props wpdavis. see <a href="http://trac.wordpress.org/ticket/15456">#15456</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminusernewphp">trunk/wp-admin/user-new.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminusernewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/user-new.php (16517 => 16518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/user-new.php        2010-11-20 22:03:54 UTC (rev 16517)
+++ trunk/wp-admin/user-new.php        2010-11-20 22:36:46 UTC (rev 16518)
</span><span class="lines">@@ -222,22 +222,19 @@
</span><span class="cx">                 $label = __('E-mail or Username');
</span><span class="cx">         }
</span><span class="cx"> ?&gt;
</span><del>-&lt;form action=&quot;#add-existing-user&quot; method=&quot;post&quot; name=&quot;adduser&quot; id=&quot;adduser&quot; class=&quot;add:users: validate&quot;&lt;?php do_action('user_new_form_tag');?&gt;&gt;
</del><ins>+&lt;form action=&quot;&quot; method=&quot;post&quot; name=&quot;adduser&quot; id=&quot;adduser&quot; class=&quot;add:users: validate&quot;&lt;?php do_action('user_new_form_tag');?&gt;&gt;
</ins><span class="cx"> &lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;adduser&quot; /&gt;
</span><span class="cx"> &lt;?php wp_nonce_field('add-user') ?&gt;
</span><ins>+
</ins><span class="cx"> &lt;table class=&quot;form-table&quot;&gt;
</span><span class="cx">         &lt;tr class=&quot;form-field form-required&quot;&gt;
</span><span class="cx">                 &lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;email&quot;&gt;&lt;?php echo $label; ?&gt;&lt;/label&gt;&lt;/th&gt;
</span><del>-                &lt;td&gt;&lt;input name=&quot;email&quot; type=&quot;text&quot; id=&quot;email&quot; value=&quot;&lt;?php echo esc_attr($new_user_email); ?&gt;&quot; /&gt;&lt;/td&gt;
</del><ins>+                &lt;td&gt;&lt;input name=&quot;email&quot; type=&quot;text&quot; id=&quot;email&quot; value=&quot;&quot; /&gt;&lt;/td&gt;
</ins><span class="cx">         &lt;/tr&gt;
</span><span class="cx">         &lt;tr class=&quot;form-field&quot;&gt;
</span><span class="cx">                 &lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;role&quot;&gt;&lt;?php _e('Role'); ?&gt;&lt;/label&gt;&lt;/th&gt;
</span><span class="cx">                 &lt;td&gt;&lt;select name=&quot;role&quot; id=&quot;role&quot;&gt;
</span><del>-                        &lt;?php
-                        if ( !$new_user_role )
-                                $new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
-                        wp_dropdown_roles($new_user_role);
-                        ?&gt;
</del><ins>+                        &lt;?php wp_dropdown_roles( get_option('default_role') ); ?&gt;
</ins><span class="cx">                         &lt;/select&gt;
</span><span class="cx">                 &lt;/td&gt;
</span><span class="cx">         &lt;/tr&gt;
</span><span class="lines">@@ -255,21 +252,25 @@
</span><span class="cx"> 
</span><span class="cx"> if ( current_user_can( 'create_users') ) {
</span><span class="cx">         if ( $do_both )
</span><del>-                echo '&lt;h3 id=&quot;create-new-user&quot;&gt;' . __('Create New User') . '&lt;/h3&gt;';
</del><ins>+                echo '&lt;h3 id=&quot;create-new-user&quot;&gt;' . __( 'Create New User' ) . '&lt;/h3&gt;';
</ins><span class="cx"> ?&gt;
</span><span class="cx"> &lt;p&gt;&lt;?php _e('Create a brand new user and add it to this site.'); ?&gt;&lt;/p&gt;
</span><del>-&lt;form action=&quot;#create-new-user&quot; method=&quot;post&quot; name=&quot;createuser&quot; id=&quot;adduser&quot; class=&quot;add:users: validate&quot;&lt;?php do_action('user_new_form_tag');?&gt;&gt;
</del><ins>+&lt;form action=&quot;&quot; method=&quot;post&quot; name=&quot;createuser&quot; id=&quot;adduser&quot; class=&quot;add:users: validate&quot;&lt;?php do_action('user_new_form_tag');?&gt;&gt;
</ins><span class="cx"> &lt;input name=&quot;action&quot; type=&quot;hidden&quot; id=&quot;action&quot; value=&quot;createuser&quot; /&gt;
</span><span class="cx"> &lt;?php wp_nonce_field('create-user') ?&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx"> // Load up the passed data, else set to a default.
</span><del>-foreach ( array('user_login' =&gt; 'login', 'first_name' =&gt; 'firstname', 'last_name' =&gt; 'lastname',
-                                'email' =&gt; 'email', 'url' =&gt; 'uri', 'role' =&gt; 'role') as $post_field =&gt; $var ) {
</del><ins>+foreach ( array( 'user_login' =&gt; 'login', 'first_name' =&gt; 'firstname', 'last_name' =&gt; 'lastname',
+                                'email' =&gt; 'email', 'url' =&gt; 'uri', 'role' =&gt; 'role', 'send_password' =&gt; 'send_password', 'noconfirmation' =&gt; 'ignore_pass' ) as $post_field =&gt; $var ) {
</ins><span class="cx">         $var = &quot;new_user_$var&quot;;
</span><del>-        if ( ! isset($$var) )
-                $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
</del><ins>+        if( isset( $_POST['createuser'] ) ) {
+                if ( ! isset($$var) )
+                        $$var = isset( $_POST[$post_field] ) ? stripslashes( $_POST[$post_field] ) : '';
+        } else {
+                $$var = false;
+        }
</ins><span class="cx"> }
</span><del>-$new_user_send_password = !$_POST || isset($_POST['send_password']);
</del><ins>+
</ins><span class="cx"> ?&gt;
</span><span class="cx"> &lt;table class=&quot;form-table&quot;&gt;
</span><span class="cx">         &lt;tr class=&quot;form-field form-required&quot;&gt;
</span><span class="lines">@@ -306,7 +307,7 @@
</span><span class="cx">         &lt;/tr&gt;
</span><span class="cx">         &lt;tr&gt;
</span><span class="cx">                 &lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;send_password&quot;&gt;&lt;?php _e('Send Password?') ?&gt;&lt;/label&gt;&lt;/th&gt;
</span><del>-                &lt;td&gt;&lt;label for=&quot;send_password&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;send_password&quot; id=&quot;send_password&quot; &lt;?php checked($new_user_send_password, true); ?&gt; /&gt; &lt;?php _e('Send this password to the new user by email.'); ?&gt;&lt;/label&gt;&lt;/td&gt;
</del><ins>+                &lt;td&gt;&lt;label for=&quot;send_password&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;send_password&quot; id=&quot;send_password&quot; &lt;?php checked( $new_user_send_password ); ?&gt; /&gt; &lt;?php _e('Send this password to the new user by email.'); ?&gt;&lt;/label&gt;&lt;/td&gt;
</ins><span class="cx">         &lt;/tr&gt;
</span><span class="cx"> &lt;?php endif; ?&gt;
</span><span class="cx"> &lt;?php } // !is_multisite ?&gt;
</span><span class="lines">@@ -324,7 +325,7 @@
</span><span class="cx">         &lt;?php if ( is_multisite() &amp;&amp; is_super_admin() ) { ?&gt;
</span><span class="cx">         &lt;tr&gt;
</span><span class="cx">                 &lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;noconfirmation&quot;&gt;&lt;?php _e('Skip Confirmation Email') ?&gt;&lt;/label&gt;&lt;/th&gt;
</span><del>-                &lt;td&gt;&lt;label for=&quot;noconfirmation&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;noconfirmation&quot; id=&quot;noconfirmation&quot; value=&quot;1&quot; /&gt; &lt;?php _e( 'Add the user without sending them a confirmation email.' ); ?&gt;&lt;/label&gt;&lt;/td&gt;
</del><ins>+                &lt;td&gt;&lt;label for=&quot;noconfirmation&quot;&gt;&lt;input type=&quot;checkbox&quot; name=&quot;noconfirmation&quot; id=&quot;noconfirmation&quot; value=&quot;1&quot;  &lt;?php checked( $new_user_ignore_pass ); ?&gt; /&gt; &lt;?php _e( 'Add the user without sending them a confirmation email.' ); ?&gt;&lt;/label&gt;&lt;/td&gt;
</ins><span class="cx">         &lt;/tr&gt;
</span><span class="cx">         &lt;?php } ?&gt;
</span><span class="cx"> &lt;/table&gt;
</span></span></pre>
</div>
</div>

</body>
</html>