Make WordPress Core

Changeset 12828


Ignore:
Timestamp:
01/25/2010 10:46:41 PM (17 years ago)
Author:
ryan
Message:

Move blog deletion to ms-delete-site.php. see #11644

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/menu.php

    r12818 r12828  
    137137        if ( is_super_admin() )
    138138                $submenu['tools.php'][20] = array( __('Upgrade'), 'install_plugins',  'update-core.php');
     139        if ( is_multisite() && ($current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path) )
     140                $submenu['tools.php'][25] = array( __('Delete Blog'), 'manage_options', 'ms-delete-site.php' );
    139141
    140142$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top', 'menu-settings', 'div' );
    … …  
    148150        if ( is_super_admin() )
    149151                $submenu['options-general.php'][45] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
    150         if ( !is_multisite() && is_super_admin() ) {
     152        if ( !is_multisite() && is_super_admin() )
    151153                $submenu['options-general.php'][50] = array(__('Network'), 'manage_options', 'options-network.php');
    152         }
    153154
    154155$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
  • trunk/wp-includes/ms-functions.php

    r12827 r12828  
    599599
    600600        if ( $refresh )
    601                 refresh_blog_details($id);
     601                refresh_blog_details($blog_id);
    602602
    603603        if ( $pref == 'spam' ) {
    604604                if ( $value == 1 )
    605                         do_action( "make_spam_blog", $id );
     605                        do_action( "make_spam_blog", $blog_id );
    606606                else
    607                         do_action( "make_ham_blog", $id );
     607                        do_action( "make_ham_blog", $blog_id );
    608608        }
    609609
    … …  
    17671767}
    17681768
    1769 /* Delete blog */
    1770 class delete_blog {
    1771         function delete_blog() {
    1772                 $this->reallydeleteblog = false;
    1773                 add_action('admin_menu', array(&$this, 'admin_menu'));
    1774                 add_action('admin_footer', array(&$this, 'admin_footer'));
    1775         }
    1776 
    1777         function admin_footer() {
    1778                 global $wpdb, $current_blog, $current_site;
    1779                 if ( $current_blog->domain . $current_blog->path == $current_site->domain . $current_site->path )
    1780                         return false;
    1781 
    1782                 if ( $this->reallydeleteblog == true )
    1783                         wpmu_delete_blog( $wpdb->blogid );
    1784         }
    1785 
    1786         function admin_menu() {
    1787                 global $current_blog, $current_site;
    1788                 if ( $current_blog->domain . $current_blog->path != $current_site->domain . $current_site->path )
    1789                         add_submenu_page('options-general.php', __('Delete Blog'), __('Delete Blog'), 'manage_options', 'delete-blog', array(&$this, 'plugin_content'));
    1790         }
    1791 
    1792         function plugin_content() {
    1793                 global $current_blog, $current_site;
    1794                 $this->delete_blog_hash = get_settings('delete_blog_hash');
    1795                 echo '<div class="wrap"><h2>' . __('Delete Blog') . '</h2>';
    1796                 if ( $_POST['action'] == "deleteblog" && $_POST['confirmdelete'] == '1' ) {
    1797                         $hash = substr( md5( $_SERVER['REQUEST_URI'] . time() ), 0, 6 );
    1798                         update_option( "delete_blog_hash", $hash );
    1799                         $url_delete = get_option( "siteurl" ) . "/wp-admin/options-general.php?page=delete-blog&h=" . $hash;
    1800                         $msg = __("Dear User,
    1801 You recently clicked the 'Delete Blog' link on your blog and filled in a
    1802 form on that page.
    1803 If you really want to delete your blog, click the link below. You will not
    1804 be asked to confirm again so only click this link if you are 100% certain:
    1805 URL_DELETE
    1806 
    1807 If you delete your blog, please consider opening a new blog here
    1808 some time in the future! (But remember your current blog and username
    1809 are gone forever.)
    1810 
    1811 Thanks for using the site,
    1812 Webmaster
    1813 SITE_NAME
    1814 ");
    1815                         $msg = str_replace( "URL_DELETE", $url_delete, $msg );
    1816                         $msg = str_replace( "SITE_NAME", $current_site->site_name, $msg );
    1817                         wp_mail( get_option( "admin_email" ), "[ " . get_option( "blogname" ) . " ] ".__("Delete My Blog"), $msg );
    1818                         ?>
    1819                         <p><?php _e('Thank you. Please check your email for a link to confirm your action. Your blog will not be deleted until this link is clicked.') ?></p>
    1820                         <?php
    1821                 } elseif ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option('delete_blog_hash') != false ) {
    1822                         if ( get_option('delete_blog_hash') == $_GET['h'] ) {
    1823                                 $this->reallydeleteblog = true;
    1824                                 echo "<p>" . sprintf(__('Thank you for using %s, your blog has been deleted. Happy trails to you until we meet again.'), $current_site->site_name) . "</p>";
    1825                         } else {
    1826                                 $this->reallydeleteblog = false;
    1827                                 echo "<p>" . __("I'm sorry, the link you clicked is stale. Please select another option.") . "</p>";
    1828                         }
    1829                 } else {
    1830 ?>
    1831                         <p><?php printf(__('If you do not want to use your %s blog any more, you can delete it using the form below. When you click <strong>Delete My Blog</strong> you will be sent an email with a link in it. Click on this link to delete your blog.'), $current_site->site_name); ?></p>
    1832                         <p><?php _e('Remember, once deleted your blog cannot be restored.') ?></p>
    1833                         <form method='post' name='deletedirect'>
    1834                         <input type="hidden" name="page" value="<?php echo esc_attr($_GET['page']) ?>" />
    1835                         <input type='hidden' name='action' value='deleteblog' />
    1836                         <p><input id='confirmdelete' type='checkbox' name='confirmdelete' value='1' /> <label for='confirmdelete'><strong><?php printf( __("I'm sure I want to permanently disable my blog, and I am aware I can never get it back or use %s again."), $current_blog->domain); ?></strong></label></p>
    1837                         <p class="submit"><input type='submit' value='<?php esc_attr_e('Delete My Blog Permanently') ?>' /></p>
    1838                         </form>
    1839 <?php
    1840                 }
    1841                 echo "</div>";
    1842         }
    1843 }
    1844 $delete_blog_obj = new delete_blog();
    1845 
    18461769/* Global Categories */
    18471770function global_terms( $term_id, $deprecated = '' ) {
  • trunk/wp-includes/pluggable.php

    r12733 r12828  
    17921792}
    17931793endif;
    1794 
Note: See TracChangeset for help on using the changeset viewer.