<!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"> ?>
</span><del>-<form action="#add-existing-user" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
</del><ins>+<form action="" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
</ins><span class="cx"> <input name="action" type="hidden" id="action" value="adduser" />
</span><span class="cx"> <?php wp_nonce_field('add-user') ?>
</span><ins>+
</ins><span class="cx"> <table class="form-table">
</span><span class="cx">         <tr class="form-field form-required">
</span><span class="cx">                 <th scope="row"><label for="email"><?php echo $label; ?></label></th>
</span><del>-                <td><input name="email" type="text" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td>
</del><ins>+                <td><input name="email" type="text" id="email" value="" /></td>
</ins><span class="cx">         </tr>
</span><span class="cx">         <tr class="form-field">
</span><span class="cx">                 <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
</span><span class="cx">                 <td><select name="role" id="role">
</span><del>-                        <?php
-                        if ( !$new_user_role )
-                                $new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
-                        wp_dropdown_roles($new_user_role);
-                        ?>
</del><ins>+                        <?php wp_dropdown_roles( get_option('default_role') ); ?>
</ins><span class="cx">                         </select>
</span><span class="cx">                 </td>
</span><span class="cx">         </tr>
</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 '<h3 id="create-new-user">' . __('Create New User') . '</h3>';
</del><ins>+                echo '<h3 id="create-new-user">' . __( 'Create New User' ) . '</h3>';
</ins><span class="cx"> ?>
</span><span class="cx"> <p><?php _e('Create a brand new user and add it to this site.'); ?></p>
</span><del>-<form action="#create-new-user" method="post" name="createuser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
</del><ins>+<form action="" method="post" name="createuser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
</ins><span class="cx"> <input name="action" type="hidden" id="action" value="createuser" />
</span><span class="cx"> <?php wp_nonce_field('create-user') ?>
</span><span class="cx"> <?php
</span><span class="cx"> // Load up the passed data, else set to a default.
</span><del>-foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
-                                'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
</del><ins>+foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
+                                'email' => 'email', 'url' => 'uri', 'role' => 'role', 'send_password' => 'send_password', 'noconfirmation' => 'ignore_pass' ) as $post_field => $var ) {
</ins><span class="cx">         $var = "new_user_$var";
</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"> ?>
</span><span class="cx"> <table class="form-table">
</span><span class="cx">         <tr class="form-field form-required">
</span><span class="lines">@@ -306,7 +307,7 @@
</span><span class="cx">         </tr>
</span><span class="cx">         <tr>
</span><span class="cx">                 <th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th>
</span><del>-                <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked($new_user_send_password, true); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
</del><ins>+                <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
</ins><span class="cx">         </tr>
</span><span class="cx"> <?php endif; ?>
</span><span class="cx"> <?php } // !is_multisite ?>
</span><span class="lines">@@ -324,7 +325,7 @@
</span><span class="cx">         <?php if ( is_multisite() && is_super_admin() ) { ?>
</span><span class="cx">         <tr>
</span><span class="cx">                 <th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
</span><del>-                <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td>
</del><ins>+                <td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending them a confirmation email.' ); ?></label></td>
</ins><span class="cx">         </tr>
</span><span class="cx">         <?php } ?>
</span><span class="cx"> </table>
</span></span></pre>
</div>
</div>
</body>
</html>