<!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();
-        ?>
-        <h2><?php esc_html_e( 'Users' ); ?></h2>
-        <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
-        <form action="ms-edit.php?action=dodelete" method="post">
-        <input type="hidden" name="dodelete" />
-        <?php
-        wp_nonce_field( 'ms-users-delete' );
-        $site_admins = get_super_admins();
-        $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
-
-        foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
-                if ( $val != '' && $val != '0' ) {
-                        $delete_user = new WP_User( $val );
-
-                        if ( in_array( $delete_user->user_login, $site_admins ) )
-                                wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );
-
-                        echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
-                        $blogs = get_blogs_of_user( $val, true );
-
-                        if ( !empty( $blogs ) ) {
-                                ?>
-                                <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
-                                <?php
-                                foreach ( (array) $blogs as $key => $details ) {
-                                        $blog_users = get_users_of_blog( $details->userblog_id );
-                                        if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
-                                                $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
-                                                $user_dropdown = "<select name='blog[$val][{$key}]'>";
-                                                $user_list = '';
-                                                foreach ( $blog_users as $user ) {
-                                                        if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
-                                                                $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
-                                                }
-                                                if ( '' == $user_list )
-                                                        $user_list = $admin_out;
-                                                $user_dropdown .= $user_list;
-                                                $user_dropdown .= "</select>\n";
-                                                ?>
-                                                <ul style="list-style:none;">
-                                                        <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
-                                                        <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
-                                                        <?php _e( 'Delete all posts and links.' ); ?></label></li>
-                                                        <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
-                                                        <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
-                                                </ul>
-                                                <?php
-                                        }
-                                }
-                                echo "</fieldset>";
-                        }
-                }
-        }
-        ?>
-        <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>
-        </form>
- <?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();
+        ?>
+        <h2><?php esc_html_e( 'Users' ); ?></h2>
+        <p><?php _e( 'Transfer or delete posts and links before deleting users.' ); ?></p>
+        <form action="edit.php?action=dodelete" method="post">
+        <input type="hidden" name="dodelete" />
+        <?php
+        wp_nonce_field( 'ms-users-delete' );
+        $site_admins = get_super_admins();
+        $admin_out = "<option value='$current_user->ID'>$current_user->user_login</option>";
+
+        foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) {
+                if ( $val != '' && $val != '0' ) {
+                        $delete_user = new WP_User( $val );
+
+                        if ( in_array( $delete_user->user_login, $site_admins ) )
+                                wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network admnistrator.' ), $delete_user->user_login ) );
+
+                        echo "<input type='hidden' name='user[]' value='{$val}'/>\n";
+                        $blogs = get_blogs_of_user( $val, true );
+
+                        if ( !empty( $blogs ) ) {
+                                ?>
+                                <br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
+                                <?php
+                                foreach ( (array) $blogs as $key => $details ) {
+                                        $blog_users = get_users_of_blog( $details->userblog_id );
+                                        if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
+                                                $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
+                                                $user_dropdown = "<select name='blog[$val][{$key}]'>";
+                                                $user_list = '';
+                                                foreach ( $blog_users as $user ) {
+                                                        if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
+                                                                $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
+                                                }
+                                                if ( '' == $user_list )
+                                                        $user_list = $admin_out;
+                                                $user_dropdown .= $user_list;
+                                                $user_dropdown .= "</select>\n";
+                                                ?>
+                                                <ul style="list-style:none;">
+                                                        <li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
+                                                        <li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
+                                                        <?php _e( 'Delete all posts and links.' ); ?></label></li>
+                                                        <li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
+                                                        <?php echo __( 'Attribute all posts and links to:' ) . '</label>' . $user_dropdown; ?></li>
+                                                </ul>
+                                                <?php
+                                        }
+                                }
+                                echo "</fieldset>";
+                        }
+                }
+        }
+        ?>
+        <p class="submit"><input type="submit" class="button-secondary delete" value="<?php esc_attr_e( 'Confirm Deletion' ); ?>" /></p>
+        </form>
+ <?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 <a href="%s">options page</a>.', esc_url( admin_url( 'ms-options.php' ) ) ) ) );
</del><ins>+                        wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">options page</a>.', esc_url( admin_url( 'settings.php' ) ) ) ) );
</ins><span class="cx">
</span><span class="cx">                 if ( isset($_POST['WPLANG']) && ( '' === $_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 <a href="%s">sites page</a>', esc_url( admin_url( 'ms-sites.php' ) ) ) ) );
</del><ins>+                        wp_die( sprintf( __( 'You probably need to go back to the <a href="%s">sites page</a>', 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' => 'true', 'action' => $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">                         </head>
</span><span class="cx">                         <body>
</span><span class="cx">                                 <h1 id="logo"><img alt="WordPress" src="<?php echo esc_attr( admin_url( 'images/wordpress-logo.png' ) ); ?>" /></h1>
</span><del>-                                <form action="ms-edit.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
</del><ins>+                                <form action="edit.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
</ins><span class="cx">                                         <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
</span><span class="cx">                                         <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
</span><span class="cx">                                         <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
</span><span class="lines">@@ -499,15 +565,15 @@
</span><span class="cx">                 if ( $id != '0' && $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 '<div class="wrap">';
</span><span class="cx">                         confirm_delete_users( $_POST['allusers'] );
</span><span class="cx">                         echo '</div>';
</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 '<div class="wrap">';
</span><span class="cx">                                                         confirm_delete_users( $_POST['allusers'] );
</span><span class="cx">                                                         echo '</div>';
</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' => 'true', 'action' => $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' => 'true', 'action' => $deletefunction ), admin_url( 'ms-users.php' ) ) );
</del><ins>+                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $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"> ?>
</span></span></pre>
</div>
</div>
</body>
</html>