<!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>[15488] trunk/wp-admin: Move confirm_delete_users() to edit.php.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/15488">15488</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-08-02 18:10:43 +0000 (Mon, 02 Aug 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move confirm_delete_users() to edit.php. Update links in edit.php. see <a href="http://trac.wordpress.org/ticket/14435">#14435</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpadminnetworkeditphp">trunk/wp-admin/network/edit.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (15487 => 15488)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2010-08-02 17:56:05 UTC (rev 15487)
+++ trunk/wp-admin/includes/ms.php        2010-08-02 18:10:43 UTC (rev 15488)
</span><span class="lines">@@ -177,72 +177,6 @@
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function confirm_delete_users( $users ) {
-        $current_user = wp_get_current_user();
-        if ( !is_array( $users ) )
-                return false;
-
-        screen_icon();
-        ?&gt;
-        &lt;h2&gt;&lt;?php esc_html_e( 'Users' ); ?&gt;&lt;/h2&gt;
-        &lt;p&gt;&lt;?php _e( 'Transfer or delete posts and links before deleting users.' ); ?&gt;&lt;/p&gt;
-        &lt;form action=&quot;ms-edit.php?action=dodelete&quot; method=&quot;post&quot;&gt;
-        &lt;input type=&quot;hidden&quot; name=&quot;dodelete&quot; /&gt;
-        &lt;?php
-        wp_nonce_field( 'ms-users-delete' );
-        $site_admins = get_super_admins();
-        $admin_out = &quot;&lt;option value='$current_user-&gt;ID'&gt;$current_user-&gt;user_login&lt;/option&gt;&quot;;
-
-        foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key =&gt; $val ) {
-                if ( $val != '' &amp;&amp; $val != '0' ) {
-                        $delete_user = new WP_User( $val );
-
-                        if ( in_array( $delete_user-&gt;user_login, $site_admins ) )
-                                wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user-&gt;user_login ) );
-
-                        echo &quot;&lt;input type='hidden' name='user[]' value='{$val}'/&gt;\n&quot;;
-                        $blogs = get_blogs_of_user( $val, true );
-
-                        if ( !empty( $blogs ) ) {
-                                ?&gt;
-                                &lt;br /&gt;&lt;fieldset&gt;&lt;p&gt;&lt;legend&gt;&lt;?php printf( __( &quot;What should be done with posts and links owned by &lt;em&gt;%s&lt;/em&gt;?&quot; ), $delete_user-&gt;user_login ); ?&gt;&lt;/legend&gt;&lt;/p&gt;
-                                &lt;?php
-                                foreach ( (array) $blogs as $key =&gt; $details ) {
-                                        $blog_users = get_users_of_blog( $details-&gt;userblog_id );
-                                        if ( is_array( $blog_users ) &amp;&amp; !empty( $blog_users ) ) {
-                                                $user_site = &quot;&lt;a href='&quot; . esc_url( get_home_url( $details-&gt;userblog_id ) ) . &quot;'&gt;{$details-&gt;blogname}&lt;/a&gt;&quot;;
-                                                $user_dropdown = &quot;&lt;select name='blog[$val][{$key}]'&gt;&quot;;
-                                                $user_list = '';
-                                                foreach ( $blog_users as $user ) {
-                                                        if ( $user-&gt;user_id != $val &amp;&amp; !in_array( $user-&gt;user_id, $allusers ) )
-                                                                $user_list .= &quot;&lt;option value='{$user-&gt;user_id}'&gt;{$user-&gt;user_login}&lt;/option&gt;&quot;;
-                                                }
-                                                if ( '' == $user_list )
-                                                        $user_list = $admin_out;
-                                                $user_dropdown .= $user_list;
-                                                $user_dropdown .= &quot;&lt;/select&gt;\n&quot;;
-                                                ?&gt;
-                                                &lt;ul style=&quot;list-style:none;&quot;&gt;
-                                                        &lt;li&gt;&lt;?php printf( __( 'Site: %s' ), $user_site ); ?&gt;&lt;/li&gt;
-                                                        &lt;li&gt;&lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;delete_option0&quot; name=&quot;delete[&lt;?php echo $details-&gt;userblog_id . '][' . $delete_user-&gt;ID ?&gt;]&quot; value=&quot;delete&quot; checked=&quot;checked&quot; /&gt;
-                                                        &lt;?php _e( 'Delete all posts and links.' ); ?&gt;&lt;/label&gt;&lt;/li&gt;
-                                                        &lt;li&gt;&lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;delete_option1&quot; name=&quot;delete[&lt;?php echo $details-&gt;userblog_id . '][' . $delete_user-&gt;ID ?&gt;]&quot; value=&quot;reassign&quot; /&gt;
-                                                        &lt;?php echo __( 'Attribute all posts and links to:' ) . '&lt;/label&gt;' . $user_dropdown; ?&gt;&lt;/li&gt;
-                                                &lt;/ul&gt;
-                                                &lt;?php
-                                        }
-                                }
-                                echo &quot;&lt;/fieldset&gt;&quot;;
-                        }
-                }
-        }
-        ?&gt;
-        &lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; class=&quot;button-secondary delete&quot; value=&quot;&lt;?php esc_attr_e( 'Confirm Deletion' ); ?&gt;&quot; /&gt;&lt;/p&gt;
-        &lt;/form&gt;
-    &lt;?php
-        return true;
-}
-
</del><span class="cx"> function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
</span><span class="cx">         $themes = get_themes();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminnetworkeditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network/edit.php (15487 => 15488)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network/edit.php        2010-08-02 17:56:05 UTC (rev 15487)
+++ trunk/wp-admin/network/edit.php        2010-08-02 18:10:43 UTC (rev 15488)
</span><span class="lines">@@ -13,8 +13,74 @@
</span><span class="cx">         wp_die( __( 'Multisite support is not enabled.' ) );
</span><span class="cx"> 
</span><span class="cx"> if ( empty( $_GET['action'] ) )
</span><del>-        wp_redirect( admin_url( 'ms-admin.php' ) );
</del><ins>+        wp_redirect( admin_url( 'index.php' ) );
</ins><span class="cx"> 
</span><ins>+function confirm_delete_users( $users ) {
+        $current_user = wp_get_current_user();
+        if ( !is_array( $users ) )
+                return false;
+
+        screen_icon();
+        ?&gt;
+        &lt;h2&gt;&lt;?php esc_html_e( 'Users' ); ?&gt;&lt;/h2&gt;
+        &lt;p&gt;&lt;?php _e( 'Transfer or delete posts and links before deleting users.' ); ?&gt;&lt;/p&gt;
+        &lt;form action=&quot;edit.php?action=dodelete&quot; method=&quot;post&quot;&gt;
+        &lt;input type=&quot;hidden&quot; name=&quot;dodelete&quot; /&gt;
+        &lt;?php
+        wp_nonce_field( 'ms-users-delete' );
+        $site_admins = get_super_admins();
+        $admin_out = &quot;&lt;option value='$current_user-&gt;ID'&gt;$current_user-&gt;user_login&lt;/option&gt;&quot;;
+
+        foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key =&gt; $val ) {
+                if ( $val != '' &amp;&amp; $val != '0' ) {
+                        $delete_user = new WP_User( $val );
+
+                        if ( in_array( $delete_user-&gt;user_login, $site_admins ) )
+                                wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user-&gt;user_login ) );
+
+                        echo &quot;&lt;input type='hidden' name='user[]' value='{$val}'/&gt;\n&quot;;
+                        $blogs = get_blogs_of_user( $val, true );
+
+                        if ( !empty( $blogs ) ) {
+                                ?&gt;
+                                &lt;br /&gt;&lt;fieldset&gt;&lt;p&gt;&lt;legend&gt;&lt;?php printf( __( &quot;What should be done with posts and links owned by &lt;em&gt;%s&lt;/em&gt;?&quot; ), $delete_user-&gt;user_login ); ?&gt;&lt;/legend&gt;&lt;/p&gt;
+                                &lt;?php
+                                foreach ( (array) $blogs as $key =&gt; $details ) {
+                                        $blog_users = get_users_of_blog( $details-&gt;userblog_id );
+                                        if ( is_array( $blog_users ) &amp;&amp; !empty( $blog_users ) ) {
+                                                $user_site = &quot;&lt;a href='&quot; . esc_url( get_home_url( $details-&gt;userblog_id ) ) . &quot;'&gt;{$details-&gt;blogname}&lt;/a&gt;&quot;;
+                                                $user_dropdown = &quot;&lt;select name='blog[$val][{$key}]'&gt;&quot;;
+                                                $user_list = '';
+                                                foreach ( $blog_users as $user ) {
+                                                        if ( $user-&gt;user_id != $val &amp;&amp; !in_array( $user-&gt;user_id, $allusers ) )
+                                                                $user_list .= &quot;&lt;option value='{$user-&gt;user_id}'&gt;{$user-&gt;user_login}&lt;/option&gt;&quot;;
+                                                }
+                                                if ( '' == $user_list )
+                                                        $user_list = $admin_out;
+                                                $user_dropdown .= $user_list;
+                                                $user_dropdown .= &quot;&lt;/select&gt;\n&quot;;
+                                                ?&gt;
+                                                &lt;ul style=&quot;list-style:none;&quot;&gt;
+                                                        &lt;li&gt;&lt;?php printf( __( 'Site: %s' ), $user_site ); ?&gt;&lt;/li&gt;
+                                                        &lt;li&gt;&lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;delete_option0&quot; name=&quot;delete[&lt;?php echo $details-&gt;userblog_id . '][' . $delete_user-&gt;ID ?&gt;]&quot; value=&quot;delete&quot; checked=&quot;checked&quot; /&gt;
+                                                        &lt;?php _e( 'Delete all posts and links.' ); ?&gt;&lt;/label&gt;&lt;/li&gt;
+                                                        &lt;li&gt;&lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;delete_option1&quot; name=&quot;delete[&lt;?php echo $details-&gt;userblog_id . '][' . $delete_user-&gt;ID ?&gt;]&quot; value=&quot;reassign&quot; /&gt;
+                                                        &lt;?php echo __( 'Attribute all posts and links to:' ) . '&lt;/label&gt;' . $user_dropdown; ?&gt;&lt;/li&gt;
+                                                &lt;/ul&gt;
+                                                &lt;?php
+                                        }
+                                }
+                                echo &quot;&lt;/fieldset&gt;&quot;;
+                        }
+                }
+        }
+        ?&gt;
+        &lt;p class=&quot;submit&quot;&gt;&lt;input type=&quot;submit&quot; class=&quot;button-secondary delete&quot; value=&quot;&lt;?php esc_attr_e( 'Confirm Deletion' ); ?&gt;&quot; /&gt;&lt;/p&gt;
+        &lt;/form&gt;
+    &lt;?php
+        return true;
+}
+
</ins><span class="cx"> do_action( 'wpmuadminedit' , '');
</span><span class="cx"> 
</span><span class="cx"> if ( isset( $_GET['id' ]) )
</span><span class="lines">@@ -29,7 +95,7 @@
</span><span class="cx">                         wp_die( __( 'You do not have permission to access this page.' ) );
</span><span class="cx"> 
</span><span class="cx">                 if ( empty( $_POST ) )
</span><del>-                        wp_die( sprintf( __( 'You probably need to go back to the &lt;a href=&quot;%s&quot;&gt;options page&lt;/a&gt;.', esc_url( admin_url( 'ms-options.php' ) ) ) ) );
</del><ins>+                        wp_die( sprintf( __( 'You probably need to go back to the &lt;a href=&quot;%s&quot;&gt;options page&lt;/a&gt;.', esc_url( admin_url( 'settings.php' ) ) ) ) );
</ins><span class="cx"> 
</span><span class="cx">                 if ( isset($_POST['WPLANG']) &amp;&amp; ( '' === $_POST['WPLANG'] || in_array( $_POST['WPLANG'], get_available_languages() ) ) )
</span><span class="cx">                         update_site_option( 'WPLANG', $_POST['WPLANG'] );
</span><span class="lines">@@ -133,7 +199,7 @@
</span><span class="cx">                 // Update more options here
</span><span class="cx">                 do_action( 'update_wpmu_options' );
</span><span class="cx"> 
</span><del>-                wp_redirect( add_query_arg( 'updated', 'true', admin_url( 'ms-options.php' ) ) );
</del><ins>+                wp_redirect( add_query_arg( 'updated', 'true', admin_url( 'settings.php' ) ) );
</ins><span class="cx">                 exit();
</span><span class="cx">         break;
</span><span class="cx">         case 'addblog':
</span><span class="lines">@@ -208,7 +274,7 @@
</span><span class="cx">                         wp_die( __( 'You do not have permission to access this page.' ) );
</span><span class="cx"> 
</span><span class="cx">                 if ( empty( $_POST ) )
</span><del>-                        wp_die( sprintf( __( 'You probably need to go back to the &lt;a href=&quot;%s&quot;&gt;sites page&lt;/a&gt;', esc_url( admin_url( 'ms-sites.php' ) ) ) ) );
</del><ins>+                        wp_die( sprintf( __( 'You probably need to go back to the &lt;a href=&quot;%s&quot;&gt;sites page&lt;/a&gt;', esc_url( network_admin_url( 'sites.php' ) ) ) ) );
</ins><span class="cx"> 
</span><span class="cx">                 switch_to_blog( $id );
</span><span class="cx"> 
</span><span class="lines">@@ -367,7 +433,7 @@
</span><span class="cx">                         wp_redirect( add_query_arg( array( 'updated' =&gt; 'true', 'action' =&gt; $blogfunction ), wp_get_referer() ) );
</span><span class="cx">                         exit();
</span><span class="cx">                 } else {
</span><del>-                        wp_redirect( admin_url( 'ms-sites.php' ) );
</del><ins>+                        wp_redirect( network_admin_url( 'sites.php' ) );
</ins><span class="cx">                 }
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="lines">@@ -476,7 +542,7 @@
</span><span class="cx">                         &lt;/head&gt;
</span><span class="cx">                         &lt;body&gt;
</span><span class="cx">                                 &lt;h1 id=&quot;logo&quot;&gt;&lt;img alt=&quot;WordPress&quot; src=&quot;&lt;?php echo esc_attr( admin_url( 'images/wordpress-logo.png' ) ); ?&gt;&quot; /&gt;&lt;/h1&gt;
</span><del>-                                &lt;form action=&quot;ms-edit.php?action=&lt;?php echo esc_attr( $_GET['action2'] ) ?&gt;&quot; method=&quot;post&quot;&gt;
</del><ins>+                                &lt;form action=&quot;edit.php?action=&lt;?php echo esc_attr( $_GET['action2'] ) ?&gt;&quot; method=&quot;post&quot;&gt;
</ins><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;&lt;?php echo esc_attr( $_GET['action2'] ) ?&gt;&quot; /&gt;
</span><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;id&quot; value=&quot;&lt;?php echo esc_attr( $id ); ?&gt;&quot; /&gt;
</span><span class="cx">                                         &lt;input type=&quot;hidden&quot; name=&quot;_wp_http_referer&quot; value=&quot;&lt;?php echo esc_attr( wp_get_referer() ); ?&gt;&quot; /&gt;
</span><span class="lines">@@ -499,15 +565,15 @@
</span><span class="cx">                 if ( $id != '0' &amp;&amp; $id != '1' ) {
</span><span class="cx">                         $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays
</span><span class="cx">                         $title = __( 'Users' );
</span><del>-                        $parent_file = 'ms-admin.php';
-                        require_once( 'admin-header.php' );
</del><ins>+                        $parent_file = 'users.php';
+                        require_once( '../admin-header.php' );
</ins><span class="cx">                         echo '&lt;div class=&quot;wrap&quot;&gt;';
</span><span class="cx">                         confirm_delete_users( $_POST['allusers'] );
</span><span class="cx">                         echo '&lt;/div&gt;';
</span><del>-            require_once( 'admin-footer.php' );
</del><ins>+            require_once( '../admin-footer.php' );
</ins><span class="cx">             exit();
</span><span class="cx">                 } else {
</span><del>-                        wp_redirect( admin_url( 'ms-users.php' ) );
</del><ins>+                        wp_redirect( network_admin_url( 'users.php' ) );
</ins><span class="cx">                 }
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="lines">@@ -526,12 +592,12 @@
</span><span class="cx">                                         switch ( $doaction ) {
</span><span class="cx">                                                 case 'delete':
</span><span class="cx">                                                         $title = __( 'Users' );
</span><del>-                                                        $parent_file = 'ms-admin.php';
-                                                        require_once( 'admin-header.php' );
</del><ins>+                                                        $parent_file = 'users.php';
+                                                        require_once( '../admin-header.php' );
</ins><span class="cx">                                                         echo '&lt;div class=&quot;wrap&quot;&gt;';
</span><span class="cx">                                                         confirm_delete_users( $_POST['allusers'] );
</span><span class="cx">                                                         echo '&lt;/div&gt;';
</span><del>-                                            require_once( 'admin-footer.php' );
</del><ins>+                                            require_once( '../admin-footer.php' );
</ins><span class="cx">                                             exit();
</span><span class="cx">                                                break;
</span><span class="cx"> 
</span><span class="lines">@@ -564,7 +630,7 @@
</span><span class="cx">                         wp_redirect( add_query_arg( array( 'updated' =&gt; 'true', 'action' =&gt; $userfunction ), wp_get_referer() ) );
</span><span class="cx">                         exit();
</span><span class="cx">                 } else {
</span><del>-                        wp_redirect( admin_url( 'ms-users.php' ) );
</del><ins>+                        wp_redirect( network_admin_url( 'users.php' ) );
</ins><span class="cx">                 }
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="lines">@@ -595,7 +661,7 @@
</span><span class="cx">                 else
</span><span class="cx">                         $deletefunction = 'all_delete';
</span><span class="cx"> 
</span><del>-                wp_redirect( add_query_arg( array( 'updated' =&gt; 'true', 'action' =&gt; $deletefunction ), admin_url( 'ms-users.php' ) ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' =&gt; 'true', 'action' =&gt; $deletefunction ), network_admin_url( 'users.php' ) ) );
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">         case 'adduser':
</span><span class="lines">@@ -631,7 +697,7 @@
</span><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">         default:
</span><del>-                wp_redirect( admin_url( 'ms-admin.php' ) );
</del><ins>+                wp_redirect( network_admin_url( 'index.php' ) );
</ins><span class="cx">         break;
</span><span class="cx"> }
</span><span class="cx"> ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>