Make WordPress Core

Changeset 13301


Ignore:
Timestamp:
02/22/2010 06:41:38 PM (17 years ago)
Author:
wpmuguru
Message:

multisite UX, see #11644, add manage_ caps for super_admin, fixes #11803

Location:
trunk/wp-admin
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r13297 r13301  
    653653        printf("<div id='update-nag'>" . __("Hi %s! You're logged in as a site administrator.") . "</div>", $current_user->user_login);
    654654        if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
    655                 echo "<div id='update-nag'>" . __( 'Thank you for Upgrading! Please visit the <a href="ms-upgrade-site.php">Upgrade Site</a> page to update all your blogs.' ) . "</div>";
     655                echo "<div id='update-nag'>" . __( 'Thank you for Upgrading! Please visit the <a href="ms-upgrade-network.php">Upgrade Network</a> page to update all your blogs.' ) . "</div>";
    656656        }
    657657}
  • trunk/wp-admin/menu.php

    r13257 r13301  
    2828if ( is_multisite() && is_super_admin() ) {
    2929        /* translators: Network menu item */
    30         $menu[0] = array(__('Network'), 'super_admin', 'ms-admin.php', '', 'menu-top menu-top-first', 'menu-site', 'div');
    31         $submenu[ 'ms-admin.php' ][1] = array( __('Admin'), 'super_admin', 'ms-admin.php' );
     30        $menu[0] = array(__('Network'), 'manage_network', 'ms-admin.php', '', 'menu-top menu-top-first', 'menu-site', 'div');
     31        $submenu[ 'ms-admin.php' ][1] = array( __('Admin'), 'manage_network', 'ms-admin.php' );
    3232        /* translators: Sites menu item */
    33         $submenu[ 'ms-admin.php' ][5] = array( __('Sites'), 'super_admin', 'ms-sites.php' );
    34         $submenu[ 'ms-admin.php' ][10] = array( __('Users'), 'super_admin', 'ms-users.php' );
    35         $submenu[ 'ms-admin.php' ][20] = array( __('Themes'), 'super_admin', 'ms-themes.php' );
    36         $submenu[ 'ms-admin.php' ][25] = array( __('Options'), 'super_admin', 'ms-options.php' );
    37         $submenu[ 'ms-admin.php' ][30] = array( __('Upgrade'), 'super_admin', 'ms-upgrade-site.php' );
     33        $submenu[ 'ms-admin.php' ][5] = array( __('Sites'), 'manage_sites', 'ms-sites.php' );
     34        $submenu[ 'ms-admin.php' ][10] = array( __('Users'), 'manage_network_users', 'ms-users.php' );
     35        $submenu[ 'ms-admin.php' ][20] = array( __('Themes'), 'manage_network_themes', 'ms-themes.php' );
     36        $submenu[ 'ms-admin.php' ][25] = array( __('Options'), 'manage_network_options', 'ms-options.php' );
     37        $submenu[ 'ms-admin.php' ][30] = array( __('Upgrade'), 'manage_network', 'ms-upgrade-network.php' );
    3838
    3939        $menu[1] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
  • trunk/wp-admin/ms-admin.php

    r13114 r13301  
    1515require_once('admin-header.php');
    1616
    17 if ( !is_super_admin() )
     17if ( ! current_user_can( 'manage_network' ) )
    1818        wp_die( __('You do not have permission to access this page.') );
    1919
  • trunk/wp-admin/ms-edit.php

    r13297 r13301  
    44if ( !is_multisite() )
    55        wp_die( __('Multisite support is not enabled.') );
    6 
    7 if ( !is_super_admin() )
    8         wp_die( __('You do not have permission to access this page.') );
    96
    107do_action('wpmuadminedit', '');
     
    2118        case "siteoptions":
    2219                check_admin_referer('siteoptions');
     20                if ( ! current_user_can( 'manage_network_options' ) )
     21                        wp_die( __('You do not have permission to access this page.') );
     22
    2323                if ( empty( $_POST ) )
    2424                        wp_die( __("You probably need to go back to the <a href='ms-options.php'>options page</a>") );
     
    138138                check_admin_referer('add-blog');
    139139
     140                if ( ! current_user_can( 'manage_sites' ) )
     141                        wp_die( __('You do not have permission to access this page.') );
     142
    140143                if ( is_array( $_POST[ 'blog' ] ) == false )
    141144                        wp_die( "Can't create an empty blog." );
     
    188191        case "updateblog":
    189192                check_admin_referer('editblog');
     193                if ( ! current_user_can( 'manage_sites' ) )
     194                        wp_die( __('You do not have permission to access this page.') );
     195
    190196                if ( empty( $_POST ) )
    191197                        wp_die( __('You probably need to go back to the <a href="ms-sites.php">sites page</a>') );
     
    289295        case "deleteblog":
    290296                check_admin_referer('deleteblog');
     297                if ( ! current_user_can( 'manage_sites' ) )
     298                        wp_die( __('You do not have permission to access this page.') );
     299
    291300                if ( $id != '0' && $id != $current_site->blog_id )
    292301                        wpmu_delete_blog( $id, true );
     
    298307        case "allblogs":
    299308                check_admin_referer('allblogs');
     309                if ( ! current_user_can( 'manage_sites' ) )
     310                        wp_die( __('You do not have permission to access this page.') );
     311
    300312                foreach ( (array) $_POST[ 'allblogs' ] as $key => $val ) {
    301313                        if ( $val != '0' && $val != $current_site->blog_id ) {
     
    321333        case "archiveblog":
    322334                check_admin_referer('archiveblog');
     335                if ( ! current_user_can( 'manage_sites' ) )
     336                        wp_die( __('You do not have permission to access this page.') );
     337
    323338                update_blog_status( $id, "archived", '1' );
    324339                do_action( "archive_blog", $id );
     
    329344        case "unarchiveblog":
    330345                check_admin_referer('unarchiveblog');
     346                if ( ! current_user_can( 'manage_sites' ) )
     347                        wp_die( __('You do not have permission to access this page.') );
     348
    331349                do_action( "unarchive_blog", $id );
    332350                update_blog_status( $id, "archived", '0' );
     
    337355        case "activateblog":
    338356                check_admin_referer('activateblog');
     357                if ( ! current_user_can( 'manage_sites' ) )
     358                        wp_die( __('You do not have permission to access this page.') );
     359
    339360                update_blog_status( $id, "deleted", '0' );
    340361                do_action( "activate_blog", $id );
     
    345366        case "deactivateblog":
    346367                check_admin_referer('deactivateblog');
     368                if ( ! current_user_can( 'manage_sites' ) )
     369                        wp_die( __('You do not have permission to access this page.') );
     370
    347371                do_action( "deactivate_blog", $id );
    348372                update_blog_status( $id, "deleted", '1' );
     
    353377        case "unspamblog":
    354378                check_admin_referer('unspamblog');
     379                if ( ! current_user_can( 'manage_sites' ) )
     380                        wp_die( __('You do not have permission to access this page.') );
     381
    355382                update_blog_status( $id, "spam", '0' );
    356383                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'unspam'), $_POST['ref'] ) );
     
    360387        case "spamblog":
    361388                check_admin_referer('spamblog');
     389                if ( ! current_user_can( 'manage_sites' ) )
     390                        wp_die( __('You do not have permission to access this page.') );
     391
    362392                update_blog_status( $id, "spam", '1' );
    363393                wp_redirect( add_query_arg( array('updated' => 'true', 'action' => 'spam'), $_POST['ref'] ) );
     
    382412        // Themes
    383413    case "updatethemes":
     414        if ( ! current_user_can( 'manage_network_themes' ) )
     415                wp_die( __('You do not have permission to access this page.') );
     416
    384417        if ( is_array( $_POST['theme'] ) ) {
    385418                        $themes = get_themes();
     
    439472        case "allusers":
    440473                check_admin_referer('allusers');
     474                if ( ! current_user_can( 'manage_network_users' ) )
     475                        wp_die( __('You do not have permission to access this page.') );
     476
    441477                if ( isset($_POST['alluser_delete']) ) {
    442478                        require_once('admin-header.php');
     
    488524        case "adduser":
    489525                check_admin_referer('add-user');
     526                if ( ! current_user_can( 'manage_network_users' ) )
     527                        wp_die( __('You do not have permission to access this page.') );
    490528
    491529                if ( is_array( $_POST[ 'user' ] ) == false )
  • trunk/wp-admin/ms-options.php

    r13154 r13301  
    1010include('admin-header.php');
    1111
    12 if ( !is_super_admin() )
     12if ( ! current_user_can( 'manage_network_options' ) )
    1313    wp_die( __('You do not have permission to access this page.') );
    1414
  • trunk/wp-admin/ms-sites.php

    r13106 r13301  
    1212require_once('admin-header.php');
    1313
    14 if ( !is_super_admin() )
     14if ( ! current_user_can( 'manage_sites' ) )
    1515        wp_die( __('You do not have permission to access this page.') );
    1616
  • trunk/wp-admin/ms-themes.php

    r13106 r13301  
    66require_once('admin-header.php');
    77
    8 if ( !is_super_admin() )
     8if ( ! current_user_can( 'manage_network_themes' ) )
    99        wp_die( __('You do not have permission to access this page.') );
    1010
  • trunk/wp-admin/ms-upgrade-network.php

    • Property svn:mergeinfo set to
    r13292 r13301  
    77require_once( ABSPATH . WPINC . '/http.php' );
    88
    9 $title = __('Upgrade Site');
     9$title = __('Upgrade Network');
    1010$parent_file = 'ms-admin.php';
    1111require_once('admin-header.php');
    1212
    13 if ( !is_super_admin() )
     13if ( ! current_user_can( 'manage_network' ) )
    1414        wp_die( __('You do not have permission to access this page.') );
    1515
    1616echo '<div class="wrap">';
    1717screen_icon();
    18 echo '<h2>'.__('Upgrade Site').'</h2>';
     18echo '<h2>'.__('Upgrade Network').'</h2>';
    1919
    2020$action = isset($_GET['action']) ? $_GET['action'] : 'show';
     
    4444                        }
    4545                        echo "</ul>";
    46                         ?><p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a class="button" href="ms-upgrade-site.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Blogs"); ?></a></p>
     46                        ?><p><?php _e("If your browser doesn't start loading the next page automatically click this link:"); ?> <a class="button" href="ms-upgrade-network.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p>
    4747                        <script type='text/javascript'>
    4848                        <!--
    4949                        function nextpage() {
    50                                 location.href = "ms-upgrade-site.php?action=upgrade&n=<?php echo ($n + 5) ?>";
     50                                location.href = "ms-upgrade-network.php?action=upgrade&n=<?php echo ($n + 5) ?>";
    5151                        }
    5252                        setTimeout( "nextpage()", 250 );
     
    5959        case 'show':
    6060        default:
    61                 ?><p><?php _e("You can upgrade all the blogs on your site through this page. It works by calling the upgrade script of each blog automatically. Hit the link below to upgrade."); ?></p>
    62                 <p><a class="button" href="ms-upgrade-site.php?action=upgrade"><?php _e("Upgrade Site"); ?></a></p><?php
     61                ?><p><?php _e("You can upgrade all the sites on your network through this page. It works by calling the upgrade script of each site automatically. Hit the link below to upgrade."); ?></p>
     62                <p><a class="button" href="ms-upgrade-network.php?action=upgrade"><?php _e("Upgrade Network"); ?></a></p><?php
    6363                do_action( 'wpmu_upgrade_page' );
    6464        break;
  • trunk/wp-admin/ms-users.php

    r13297 r13301  
    1212require_once('admin-header.php');
    1313
    14 if ( !is_super_admin() )
     14if ( ! current_user_can( 'manage_network_users' ) )
    1515        wp_die( __('You do not have permission to access this page.') );
    1616
Note: See TracChangeset for help on using the changeset viewer.