<!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>[16455] trunk/wp-admin: Every time you nest a ternary operator,
  a kitten dies.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16455">16455</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-11-18 05:37:00 +0000 (Thu, 18 Nov 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Every time you nest a ternary operator, a kitten dies.</pre>

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

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminnetworkphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network.php (16454 => 16455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network.php        2010-11-18 05:29:03 UTC (rev 16454)
+++ trunk/wp-admin/network.php        2010-11-18 05:37:00 UTC (rev 16455)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">         }
</span><span class="cx">         if ( ! defined( 'MULTISITE' ) )
</span><span class="cx">                 wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
</span><del>-}        
</del><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> // We need to create references to ms global tables to enable Network.
</span><span class="cx"> foreach ( $wpdb-&gt;tables( 'ms_global' ) as $table =&gt; $prefixed_table )
</span><span class="lines">@@ -312,7 +312,10 @@
</span><span class="cx">                 echo '&lt;div class=&quot;error&quot;&gt;' . $errors-&gt;get_error_message() . '&lt;/div&gt;';
</span><span class="cx"> 
</span><span class="cx">         if ( $_POST ) {
</span><del>-                $subdomain_install = allow_subdomain_install() ? ( allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true ) : false;
</del><ins>+                if ( allow_subdomain_install() )
+                        $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
+                else
+                        $subdomain_install = false;
</ins><span class="cx">         } else {
</span><span class="cx">                 if ( is_multisite() ) {
</span><span class="cx">                         $subdomain_install = is_subdomain_install();
</span></span></pre></div>
<a id="trunkwpadminusernewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/user-new.php (16454 => 16455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/user-new.php        2010-11-18 05:29:03 UTC (rev 16454)
+++ trunk/wp-admin/user-new.php        2010-11-18 05:37:00 UTC (rev 16455)
</span><span class="lines">@@ -215,29 +215,25 @@
</span><span class="cx">         if ( $do_both )
</span><span class="cx">                 echo '&lt;h3 id=&quot;add-existing-user&quot;&gt;' . __('Add Existing User') . '&lt;/h3&gt;';
</span><span class="cx">         if ( !is_super_admin() ) {
</span><del>-                _e( 'Enter the email address of an existing user on this network to invite them to this site.  That person will be sent an email asking them to confirm the invite.' );
</del><ins>+                _e( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' );
</ins><span class="cx">                 $label = __('E-mail');
</span><span class="cx">         } else {
</span><del>-                _e( 'Enter the email address or username of an existing user on this network to invite them to this site.  That person will be sent an email asking them to confirm the invite.' );
</del><ins>+                _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' );
</ins><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><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 +251,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 +306,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 +324,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>