WordPress.org

Make WordPress Core

Ticket #14696: 14696.2.diff

File 14696.2.diff, 58.9 KB (added by ryan, 9 years ago)
  • wp-login.php

     
    572572                        </div></body></html>
    573573<?php           exit;
    574574                }
    575                 // If the user can't edit posts, send them to their profile.
    576                 if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
     575
     576                // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
     577                if ( is_multisite() && !get_active_blog_for_user($user->id) )
     578                        $redirect_to = user_admin_url();
     579                elseif ( !is_multisite() && !$user->has_cap('read') )
     580                        $redirect_to = user_admin_url();
     581                elseif ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) )
    577582                        $redirect_to = admin_url('profile.php');
    578583                wp_safe_redirect($redirect_to);
    579584                exit();
  • wp-includes/admin-bar.php

     
    110110        if ( !is_object( $wp_admin_bar ) )
    111111                return false;
    112112
    113         /* Remove the global dashboard */
    114         if ( is_multisite() ) {
    115                 foreach ( (array) $wp_admin_bar->user->blogs as $key => $blog ) {
    116                         if ( get_dashboard_blog() == $blog->domain )
    117                                 unset( $wp_admin_bar->user->blogs[$key] );
    118                 }
    119         }
    120 
    121113        /* Add the 'My Dashboards' menu if the user has more than one blog. */
    122114        if ( count( $wp_admin_bar->user->blogs ) > 1 ) {
    123115                $wp_admin_bar->add_menu( array( 'id' => 'my-blogs', 'title' => __( 'My Blogs' ), 'href' => $wp_admin_bar->user->account_domain ) );
  • wp-includes/functions.php

     
    447447        if ( empty($site_id) )
    448448                $site_id = $wpdb->siteid;
    449449
    450         $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'dashboard_blog', 'can_compress_scripts', 'global_terms_enabled' );
     450        $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled' );
    451451
    452452        $core_options_in = "'" . implode("', '", $core_options) . "'";
    453453        $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) );
  • wp-includes/vars.php

     
    1515// On which page are we ?
    1616if ( is_admin() ) {
    1717        // wp-admin pages are checked more carefully
    18         preg_match('#/wp-admin/?(.*?)$#i', $PHP_SELF, $self_matches);
     18        if ( is_network_admin() )
     19                preg_match('#/wp-admin/network/?(.*?)$#i', $PHP_SELF, $self_matches);
     20        elseif ( is_user_admin() )
     21                preg_match('#/wp-admin/user/?(.*?)$#i', $PHP_SELF, $self_matches);
     22        else
     23                preg_match('#/wp-admin/?(.*?)$#i', $PHP_SELF, $self_matches);
    1924        $pagenow = $self_matches[1];
    2025        $pagenow = trim($pagenow, '/');
    2126        $pagenow = preg_replace('#\?.*?$#', '', $pagenow);
  • wp-includes/load.php

     
    621621}
    622622
    623623/**
     624 * Whether the current request is for a user admin screen /wp-admin/user/
     625 *
     626 * Does not inform on whether the user is an admin! Use capability checks to
     627 * tell if the user should be accessing a section or not.
     628 *
     629 * @since 3.1.0
     630 *
     631 * @return bool True if inside WordPress user administration pages.
     632 */
     633function is_user_admin() {
     634        if ( defined( 'WP_USER_ADMIN' ) )
     635                return WP_USER_ADMIN;
     636        return false;
     637}
     638
     639/**
    624640 * Whether Multisite support is enabled
    625641 *
    626642 * @since 3.0.0
  • wp-includes/admin-bar/admin-bar-class.php

     
    1515                $this->user->blogs = get_ordered_blogs_of_user( $current_user->id );
    1616                if ( is_multisite() ) {
    1717                        $this->user->active_blog = get_active_blog_for_user( $current_user->id );
    18                         $this->user->domain = ( $this->user->active_blog == 'username only' ) ? get_dashboard_blog() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
     18                        $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) );
    1919                        $this->user->account_domain = $this->user->domain;
    2020                } else {
    2121                        $this->user->active_blog = $this->user->blogs[$blog_id];
  • wp-includes/link-template.php

     
    21302130}
    21312131
    21322132/**
     2133 * Retrieve the url to the admin area for the current user.
     2134 *
     2135 * @package WordPress
     2136 * @since 3.0.0
     2137 *
     2138 * @param string $path Optional path relative to the admin url
     2139 * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
     2140 * @return string Admin url link with optional path appended
     2141*/
     2142function user_admin_url( $path = '', $scheme = 'admin' ) {
     2143        $url = network_site_url('wp-admin/user/', $scheme);
     2144
     2145        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     2146                $url .= ltrim($path, '/');
     2147
     2148        return apply_filters('user_admin_url', $url, $path);
     2149}
     2150
     2151/**
    21332152 * Retrieve the url to the admin area for either the current blog or the network depending on context.
    21342153 *
    21352154 * @package WordPress
     
    21422161function self_admin_url($path = '', $scheme = 'admin') {
    21432162        if ( is_network_admin() )
    21442163                return network_admin_url($path, $scheme);
     2164        elseif ( is_user_admin() )
     2165                return user_admin_url($path, $scheme);
    21452166        else
    21462167                return admin_url($path, $scheme);
    21472168}
  • wp-includes/capabilities.php

     
    737737
    738738                // Must have ALL requested caps
    739739                $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
     740                $capabilities['exist'] = true; // Everyone is allowed to exist
    740741                foreach ( (array) $caps as $cap ) {
    741742                        //echo "Checking cap $cap<br />";
    742743                        if ( empty( $capabilities[$cap] ) || !$capabilities[$cap] )
  • wp-includes/pluggable.php

     
    8181                return;
    8282
    8383        if ( ! $user = wp_validate_auth_cookie() ) {
    84                  if ( is_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
     84                 if ( is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
    8585                        wp_set_current_user(0);
    8686                        return false;
    8787                 }
     
    775775                }
    776776        }
    777777
    778         if ( $user_id = wp_validate_auth_cookie( '', apply_filters( 'auth_redirect_scheme', '' ) ) ) {
     778        if ( is_user_admin() )
     779                $scheme = 'logged_in';
     780        else
     781                $scheme = apply_filters( 'auth_redirect_scheme', '' );
     782
     783        if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
    779784                do_action('auth_redirect', $user_id);
    780785
    781786                // If the user wants ssl but the session is not ssl, redirect.
  • wp-includes/ms-functions.php

     
    5959 *
    6060 * @since MU 1.0
    6161 * @uses get_blogs_of_user()
    62  * @uses get_dashboard_blog()
    6362 * @uses add_user_to_blog()
    6463 * @uses update_user_meta()
    6564 * @uses wp_cache_delete()
     
    7271function get_active_blog_for_user( $user_id ) {
    7372        global $wpdb;
    7473        $blogs = get_blogs_of_user( $user_id );
    75         if ( empty( $blogs ) ) {
    76                 $details = get_dashboard_blog();
    77                 add_user_to_blog( $details->blog_id, $user_id, 'subscriber' );
    78                 update_user_meta( $user_id, 'primary_blog', $details->blog_id );
    79                 wp_cache_delete( $user_id, 'users' );
    80                 return $details;
    81         }
     74        if ( empty( $blogs ) )
     75                return null;
    8276
     77        if ( !is_multisite() )
     78                return $blogs[$wpdb->blogid];
     79
    8380        $primary_blog = get_user_meta( $user_id, 'primary_blog', true );
    84         $details = get_dashboard_blog();
     81        $first_blog = current($blogs);
    8582        if ( $primary_blog ) {
    86                 if ( isset( $blogs[ $primary_blog ] ) == false ) {
    87                         add_user_to_blog( $details->blog_id, $user_id, 'subscriber' );
    88                         update_user_meta( $user_id, 'primary_blog', $details->blog_id );
    89                         wp_cache_delete( $user_id, 'users' );
     83                if ( ! isset( $blogs[ $primary_blog ] ) ) {
     84                        add_user_to_blog( $first_blog->blog_id, $user_id, 'subscriber' );
     85                        update_user_meta( $user_id, 'primary_blog', $first_blog->blog_id );
     86                        $primary = $first_blog;
    9087                } else {
    91                         $details = get_blog_details( $primary_blog );
     88                        $primary = get_blog_details( $primary_blog );
    9289                }
    9390        } else {
    94                 add_user_to_blog( $details->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog
    95                 update_user_meta( $user_id, 'primary_blog', $details->blog_id );
     91                add_user_to_blog( $first_blog->blog_id, $user_id, 'subscriber' );
     92                update_user_meta( $user_id, 'primary_blog', $first_blog->blog_id );
     93                $primary = $first_blog;
    9694        }
    9795
    98         if ( ( is_object( $details ) == false ) || ( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) ) {
     96        if ( ( ! is_object( $primary ) ) || ( is_object( $primary ) && $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
    9997                $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
    10098                $ret = false;
    10199                if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
     
    105103                                $details = get_blog_details( $blog_id );
    106104                                if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
    107105                                        $ret = $blog;
    108                                         $changed = false;
    109                                         if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id ) {
     106                                        if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id )
    110107                                                update_user_meta( $user_id, 'primary_blog', $blog_id );
    111                                                 $changed = true;
    112                                         }
    113                                         if ( !get_user_meta($user_id , 'source_domain', true) ) {
     108                                        if ( !get_user_meta($user_id , 'source_domain', true) )
    114109                                                update_user_meta( $user_id, 'source_domain', $blog->domain );
    115                                                 $changed = true;
    116                                         }
    117                                         if ( $changed )
    118                                                 wp_cache_delete( $user_id, 'users' );
    119110                                        break;
    120111                                }
    121112                        }
    122113                } else {
    123                         // Should never get here
    124                         $dashboard_blog = get_dashboard_blog();
    125                         add_user_to_blog( $dashboard_blog->blog_id, $user_id, 'subscriber' ); // Add subscriber permission for dashboard blog
    126                         update_user_meta( $user_id, 'primary_blog', $dashboard_blog->blog_id );
    127                         return $dashboard_blog;
     114                        return null;
    128115                }
    129116                return $ret;
    130117        } else {
    131                 return $details;
     118                return $primary;
    132119        }
    133120}
    134121
     
    840827                        return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
    841828
    842829                wpmu_welcome_user_notification($user_id, $password, $meta);
    843                 $user_site = get_site_option( 'dashboard_blog', $current_site->blog_id );
    844830
    845                 if ( $user_site == false )
    846                         add_user_to_blog( '1', $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    847                 else
    848                         add_user_to_blog( $user_site, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    849 
    850831                add_new_user_to_blog( $user_id, $user_email, $meta );
    851832                do_action('wpmu_activate_user', $user_id, $password, $meta);
    852833                return array('user_id' => $user_id, 'password' => $password, 'meta' => $meta);
     
    926907        add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
    927908        update_option( 'blog_public', (int)$meta['public'] );
    928909
    929         if ( !is_super_admin() && get_user_meta( $user_id, 'primary_blog', true ) == get_site_option( 'dashboard_blog', 1 ) )
     910        if ( !is_super_admin() && ! get_user_meta( $user_id, 'primary_blog', true ) )
    930911                update_user_meta( $user_id, 'primary_blog', $blog_id );
    931912
    932913        restore_current_blog();
     
    14601441}
    14611442add_action('update_option_blog_public', 'update_blog_public', 10, 2);
    14621443
    1463 /* Redirect all hits to "dashboard" blog to wp-admin/ Dashboard. */
    1464 function redirect_mu_dashboard() {
    1465         global $current_site, $current_blog;
    1466 
    1467         $dashboard_blog = get_dashboard_blog();
    1468         if ( $current_blog->blog_id == $dashboard_blog->blog_id && $dashboard_blog->blog_id != $current_site->blog_id ) {
    1469                 $protocol = ( is_ssl() ? 'https://' : 'http://' );
    1470                 wp_redirect( $protocol . $dashboard_blog->domain . trailingslashit( $dashboard_blog->path ) . 'wp-admin/' );
    1471                 die();
    1472         }
    1473 }
    1474 add_action( 'template_redirect', 'redirect_mu_dashboard' );
    1475 
    14761444function get_dashboard_blog() {
    14771445        if ( $blog = get_site_option( 'dashboard_blog' ) )
    14781446                return get_blog_details( $blog );
  • wp-admin/users.php

     
    1818$title = __('Users');
    1919$parent_file = 'users.php';
    2020
     21add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
     22
    2123// contextual help - choose Help on the top right of admin panel to preview this.
    2224add_contextual_help($current_screen,
    2325    '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options when they are logged in, based on their role.') . '</p>' .
  • wp-admin/edit-comments.php

     
    105105else
    106106        $title = __('Comments');
    107107
     108add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) );
     109
    108110add_contextual_help( $current_screen, '<p>' . __('You can manage comments made on your site similar to the way you manage Posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.') . '</p>' .
    109111        '<p>' . __('A yellow row means the comment is waiting for you to moderate it.') . '</p>' .
    110112        '<p>' . __('In the Author column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.') . '</p>' .
  • wp-admin/includes/menu.php

     
    99
    1010if ( is_network_admin() )
    1111        do_action('_network_admin_menu');
     12elseif ( is_user_admin() )
     13        do_action('_user_admin_menu');
    1214else
    1315        do_action('_admin_menu');
    1416
     
    8991
    9092if ( is_network_admin() )
    9193        do_action('network_admin_menu', '');
     94elseif ( is_user_admin() )
     95        do_action('user_admin_menu', '');
    9296else
    9397        do_action('admin_menu', '');
    9498
  • wp-admin/includes/default-list-tables.php

     
    27192719
    27202720        function WP_Sites_Table() {
    27212721                parent::WP_List_Table( array(
    2722                         'screen' => 'ms-sites',
     2722                        'screen' => 'sites-network',
    27232723                        'plural' => 'sites',
    27242724                ) );
    27252725        }
     
    27342734
    27352735                $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode'];
    27362736
    2737                 $per_page = $this->get_items_per_page( 'ms_sites_per_page' );
     2737                $per_page = $this->get_items_per_page( 'sites_network_per_page' );
    27382738
    27392739                $pagenum = $this->get_pagenum();
    27402740
     
    30073007
    30083008        function WP_MS_Users_Table() {
    30093009                parent::WP_List_Table( array(
    3010                         'screen' => 'ms-users',
     3010                        'screen' => 'users-network',
    30113011                ) );
    30123012        }
    30133013
     
    30243024
    30253025                $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
    30263026
    3027                 $users_per_page = $this->get_items_per_page( 'ms_users_per_page' );
     3027                $users_per_page = $this->get_items_per_page( 'users_network_per_page' );
    30283028
    30293029                $paged = $this->get_pagenum();
    30303030
  • wp-admin/includes/dashboard.php

     
    1616function wp_dashboard_setup() {
    1717        global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
    1818        $wp_dashboard_control_callbacks = array();
     19        $screen = get_current_screen();
    1920
    2021        $update = false;
    2122        $widget_options = get_option( 'dashboard_widget_options' );
     
    2526        /* Register Widgets and Controls */
    2627
    2728        // Right Now
    28         wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
     29        if ( is_blog_admin() && current_user_can('edit_posts') )
     30                wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
    2931
    3032        // Recent Comments Widget
    31         if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
    32                 $update = true;
    33                 $widget_options['dashboard_recent_comments'] = array(
    34                         'items' => 5,
    35                 );
     33        if ( is_blog_admin() && current_user_can('moderate_comments') ) {
     34                if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) {
     35                        $update = true;
     36                        $widget_options['dashboard_recent_comments'] = array(
     37                                'items' => 5,
     38                        );
     39                }
     40                $recent_comments_title = __( 'Recent Comments' );
     41                wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
    3642        }
    37         $recent_comments_title = __( 'Recent Comments' );
    38         wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' );
    3943
    4044        // Incoming Links Widget
    41         if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
    42                 $update = true;
    43                 $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
    44                 $widget_options['dashboard_incoming_links'] = array(
    45                         'home' => get_option('home'),
    46                         'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
    47                         'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
    48                         'items' => $num_items,
    49                         'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
    50                 );
     45        if ( is_blog_admin() && current_user_can('publish_posts') ) {
     46                if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
     47                        $update = true;
     48                        $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
     49                        $widget_options['dashboard_incoming_links'] = array(
     50                                'home' => get_option('home'),
     51                                'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
     52                                'url' => isset($widget_options['dashboard_incoming_links']['url']) ? apply_filters( 'dashboard_incoming_links_feed', $widget_options['dashboard_incoming_links']['url'] ) : apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
     53                                'items' => $num_items,
     54                                'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false
     55                        );
     56                }
     57                wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
    5158        }
    52         wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
    5359
    5460        // WP Plugins Widget
    55         if ( current_user_can( 'install_plugins' ) )
     61        if ( is_blog_admin() && current_user_can( 'install_plugins' ) )
    5662                wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
    5763
    5864        // QuickPress Widget
    59         if ( current_user_can('edit_posts') )
     65        if ( is_blog_admin() && current_user_can('edit_posts') )
    6066                wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
    6167
    6268        // Recent Drafts
    63         if ( current_user_can('edit_posts') )
     69        if ( is_blog_admin() && current_user_can('edit_posts') )
    6470                wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );
    6571
    6672        // Primary feed (Dev Blog) Widget
     
    115121        if ( $update )
    116122                update_option( 'dashboard_widget_options', $widget_options );
    117123
    118         do_action('do_meta_boxes', 'dashboard', 'normal', '');
    119         do_action('do_meta_boxes', 'dashboard', 'side', '');
     124        do_action('do_meta_boxes', $screen->id, 'normal', '');
     125        do_action('do_meta_boxes', $screen->id, 'side', '');
    120126}
    121127
    122128function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
     129        $screen = get_current_screen();
    123130        global $wp_dashboard_control_callbacks;
    124131        if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
    125132                $wp_dashboard_control_callbacks[$widget_id] = $control_callback;
    126133                if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
    127134                        list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
    128135                        $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
    129                         add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', 'dashboard', 'normal', 'core' );
     136                        add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', $screen->id, 'normal', 'core' );
    130137                        return;
    131138                }
    132139                list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
    133140                $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
    134141        }
    135         $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
     142        if ( is_user_admin() )
     143                $side_widgets = array();
     144        else
     145                $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
    136146        $location = 'normal';
    137147        if ( in_array($widget_id, $side_widgets) )
    138148                $location = 'side';
    139         add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', $location, 'core' );
     149        add_meta_box( $widget_id, $widget_name , $callback, $screen->id, $location, 'core' );
    140150}
    141151
    142152function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
     
    155165function wp_dashboard() {
    156166        global $screen_layout_columns;
    157167
     168        $screen = get_current_screen();
     169
    158170        $hide2 = $hide3 = $hide4 = '';
    159171        switch ( $screen_layout_columns ) {
    160172                case 4:
     
    176188<div id="dashboard-widgets" class="metabox-holder">
    177189<?php
    178190        echo "\t<div class='postbox-container' style='$width'>\n";
    179         do_meta_boxes( 'dashboard', 'normal', '' );
     191        do_meta_boxes( $screen->id, 'normal', '' );
    180192
    181193        echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
    182         do_meta_boxes( 'dashboard', 'side', '' );
     194        do_meta_boxes( $screen->id, 'side', '' );
    183195
    184196        echo "\t</div><div class='postbox-container' style='{$hide3}$width'>\n";
    185         do_meta_boxes( 'dashboard', 'column3', '' );
     197        do_meta_boxes( $screen->id, 'column3', '' );
    186198
    187199        echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n";
    188         do_meta_boxes( 'dashboard', 'column4', '' );
     200        do_meta_boxes( $screen->id, 'column4', '' );
    189201?>
    190202</div></div>
    191203
  • wp-admin/includes/misc.php

     
    343343
    344344                switch ( $map_option ) {
    345345                        case 'edit_per_page':
    346                         case 'ms_sites_per_page':
     346                        case 'sites_network_per_page':
    347347                        case 'users_per_page':
    348                         case 'ms_users_per_page':
     348                        case 'users_network_per_page':
    349349                        case 'edit_comments_per_page':
    350350                        case 'upload_per_page':
    351351                        case 'edit_tags_per_page':
  • wp-admin/includes/template.php

     
    13901390        if ( is_string($screen) )
    13911391                $screen = convert_to_screen($screen);
    13921392
     1393        if ( $screen->is_user )
     1394                return;
     1395
    13931396        if ( isset($screen->post_type) ) {
    13941397                $post_type_object = get_post_type_object($screen->post_type);
    13951398                if ( 'add' != $screen->action )
     
    16351638}
    16361639
    16371640function screen_meta($screen) {
    1638         global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table;
     1641        global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options;
    16391642
    16401643        if ( is_string($screen) )
    16411644                $screen = convert_to_screen($screen);
     
    16691672                        $show_screen = true;
    16701673                        break;
    16711674        }
    1672         if( ! empty( $settings ) )
     1675        if ( ! empty( $settings ) )
    16731676                $show_screen = true;
    16741677
     1678        if ( !empty($wp_current_screen_options) )
     1679                $show_screen = true;
     1680
    16751681?>
    16761682<div id="screen-meta">
    16771683<?php if ( $show_screen ) : ?>
     
    17961802}
    17971803
    17981804function screen_layout($screen) {
    1799         global $screen_layout_columns;
     1805        global $screen_layout_columns, $wp_current_screen_options;
    18001806
    18011807        if ( is_string($screen) )
    18021808                $screen = convert_to_screen($screen);
    18031809
    1804         $columns = array('dashboard' => 4, 'link' => 2);
     1810        // Back compat for plugins using the filter instead of add_screen_option()
     1811        $columns = apply_filters('screen_layout_columns', array(), $screen->id, $screen);
     1812        if ( !empty($columns) && isset($columns[$screen->id]) )
     1813                add_screen_option('layout_columns', array('max' => $columns[$screen->id]) );
    18051814
    1806         // Add custom post types
    1807         foreach ( get_post_types( array('show_ui' => true) ) as $post_type )
    1808                 $columns[$post_type] = 2;
    1809 
    1810         $columns = apply_filters('screen_layout_columns', $columns, $screen->id, $screen);
    1811 
    1812         if ( !isset($columns[$screen->id]) ) {
     1815        if ( !isset($wp_current_screen_options['layout_columns']) ) {
    18131816                $screen_layout_columns = 0;
    18141817                return '';
    1815         }
     1818        }
    18161819
    18171820        $screen_layout_columns = get_user_option("screen_layout_$screen->id");
    1818         $num = $columns[$screen->id];
     1821        $num = $wp_current_screen_options['layout_columns']['max'];
    18191822
    1820         if ( ! $screen_layout_columns )
     1823        if ( ! $screen_layout_columns ) {
     1824                if ( isset($wp_current_screen_options['layout_columns']['default']) )
     1825                        $screen_layout_columns = $wp_current_screen_options['layout_columns']['default'];
     1826                else
    18211827                        $screen_layout_columns = 2;
     1828        }
    18221829
    18231830        $i = 1;
    18241831        $return = '<h5>' . __('Screen Layout') . "</h5>\n<div class='columns-prefs'>" . __('Number of Columns:') . "\n";
     
    18301837        return $return;
    18311838}
    18321839
     1840/**
     1841 * Register and configure an admin screen option
     1842 *
     1843 * @since 3.1.0
     1844 *
     1845 * @param string $option An option name.
     1846 * @param mixed $args Option dependent arguments
     1847 * @return void
     1848 */
     1849function add_screen_option( $option, $args = array() ) {
     1850        global $wp_current_screen_options;
     1851
     1852        if ( !isset($wp_current_screen_options) )
     1853                $wp_current_screen_options = array();
     1854
     1855        $wp_current_screen_options[$option] = $args;
     1856}
     1857
    18331858function screen_options($screen) {
     1859        global $wp_current_screen_options;
     1860
    18341861        if ( is_string($screen) )
    18351862                $screen = convert_to_screen($screen);
    18361863
    1837         switch ( $screen->base ) {
    1838                 case 'edit':
    1839                 case 'edit-pages':
    1840                         $post_type = 'post';
    1841                         if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array( 'show_ui' => true ) ) ) )
    1842                                 $post_type = $_GET['post_type'];
    1843                         $post_type_object = get_post_type_object($post_type);
    1844                         $per_page_label = $post_type_object->labels->name;
    1845                         break;
    1846                 case 'ms-sites':
    1847                         $per_page_label = _x( 'Sites', 'sites per page (screen options)' );
    1848                         break;
    1849                 case 'users':
    1850                 case 'ms-users':
    1851                         $per_page_label = _x( 'Users', 'users per page (screen options)' );
    1852                         break;
    1853                 case 'edit-comments':
    1854                         $per_page_label = _x( 'Comments', 'comments per page (screen options)' );
    1855                         break;
    1856                 case 'upload':
    1857                         $per_page_label = _x( 'Media items', 'items per page (screen options)' );
    1858                         break;
    1859                 case 'edit-tags':
    1860                         global $tax;
    1861                         $per_page_label = $tax->labels->name;
    1862                         break;
    1863                 case 'plugins':
    1864                         $per_page_label = _x( 'Plugins', 'plugins per page (screen options)' );
    1865                         break;
    1866                 default:
    1867                         return '';
    1868         }
     1864        if ( !isset($wp_current_screen_options['per_page']) )
     1865                return '';
    18691866
    1870         $option = str_replace( '-', '_', "{$screen->id}_per_page" );
    1871         if ( 'edit_tags_per_page' == $option ) {
    1872                 if ( 'category' == $tax->name )
    1873                         $option = 'categories_per_page';
    1874                 elseif ( 'post_tag' != $tax->name )
    1875                         $option = 'edit_' . $tax->name . '_per_page';
     1867        $per_page_label = $wp_current_screen_options['per_page']['label'];
     1868
     1869        if ( empty($wp_current_screen_options['per_page']['option']) ) {
     1870                $option = str_replace( '-', '_', "{$screen->id}_per_page" );
     1871        } else {
     1872                $option = $wp_current_screen_options['per_page']['option'];
    18761873        }
    18771874
    18781875        $per_page = (int) get_user_option( $option );
    18791876        if ( empty( $per_page ) || $per_page < 1 ) {
    1880                 if ( 'plugins' == $screen->id )
    1881                         $per_page = 999;
     1877                if ( isset($wp_current_screen_options['per_page']['default']) )
     1878                        $per_page = $wp_current_screen_options['per_page']['default'];
    18821879                else
    18831880                        $per_page = 20;
    18841881        }
     
    19981995}
    19991996
    20001997/**
     1998 *  Get the current screen object
     1999 *
     2000 *  @since 3.1.0
     2001 *
     2002 * @return object Current screen object
     2003 */
     2004function get_current_screen() {
     2005        global $current_screen;
     2006
     2007        if ( !isset($current_screen) )
     2008                return null;
     2009
     2010        return $current_screen;
     2011}
     2012
     2013/**
    20012014 * Set the current screen object
    20022015 *
    20032016 * @since 3.0.0
     
    20602073        }
    20612074
    20622075        $current_screen->is_network = is_network_admin() ? true : false;
     2076        $current_screen->is_user = is_user_admin() ? true : false;
     2077       
     2078        if ( $current_screen->is_network ) {
     2079                $current_screen->base .= '-network';
     2080                $current_screen->id .= '-network';
     2081        } elseif ( $current_screen->is_user ) {
     2082                $current_screen->base .= '-user';
     2083                $current_screen->id .= '-user';
     2084        }
    20632085
    20642086        $current_screen = apply_filters('current_screen', $current_screen);
    20652087}
  • wp-admin/includes/ms.php

     
    502502        $c ++;
    503503
    504504        $blog = get_active_blog_for_user( get_current_user_id() );
    505         $dashboard_blog = get_dashboard_blog();
     505
    506506        if ( is_object( $blog ) ) {
    507507                wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case"
    508508                exit;
     509        } else {
     510                wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case"
    509511        }
    510512
    511         /*
    512            If the user is a member of only 1 blog and the user's primary_blog isn't set to that blog,
    513            then update the primary_blog record to match the user's blog
    514          */
    515         $blogs = get_blogs_of_user( get_current_user_id() );
    516 
    517         if ( !empty( $blogs ) ) {
    518                 foreach( $blogs as $blogid => $blog ) {
    519                         if ( $blogid != $dashboard_blog->blog_id && get_user_meta( get_current_user_id() , 'primary_blog', true ) == $dashboard_blog->blog_id ) {
    520                                 update_user_meta( get_current_user_id(), 'primary_blog', $blogid );
    521                                 continue;
    522                         }
    523                 }
    524                 $blog = get_blog_details( get_user_meta( get_current_user_id(), 'primary_blog', true ) );
    525                         wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) );
    526                 exit;
    527         }
    528513        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    529514}
    530515add_action( 'admin_page_access_denied', 'redirect_user_to_blog', 99 );
  • wp-admin/edit-tags.php

     
    2222        $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
    2323}
    2424
     25add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );
     26
    2527switch ( $wp_list_table->current_action() ) {
    2628
    2729case 'add-tag':
  • wp-admin/js/dashboard.js

     
    1 var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins","dashboard_quick_press"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}if("dashboard_quick_press"==g&&a.isFunction(tb_init)){tb_init("#dashboard_quick_press a.thickbox");quickPressLoad()}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").next("p").remove();a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})}});
    2  No newline at end of file
     1var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins","dashboard_quick_press"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}if("dashboard_quick_press"==g&&a.isFunction(tb_init)){tb_init("#dashboard_quick_press a.thickbox");quickPressLoad()}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").next("p").remove();a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})}});
     2 No newline at end of file
  • wp-admin/js/dashboard.dev.js

     
    4242        };
    4343        ajaxPopulateWidgets();
    4444
    45         postboxes.add_postbox_toggles('dashboard', { pbshow: ajaxPopulateWidgets } );
     45        postboxes.add_postbox_toggles(pagenow, { pbshow: ajaxPopulateWidgets } );
    4646
    4747        /* QuickPress */
    4848        quickPressLoad = function() {
  • wp-admin/admin.php

     
    1111 *
    1212 * @since unknown
    1313 */
    14 if ( !defined('WP_ADMIN') )
     14if ( ! defined('WP_ADMIN') )
    1515        define('WP_ADMIN', TRUE);
    1616
    17 if ( !defined('WP_NETWORK_ADMIN') ) {
     17if ( ! defined('WP_NETWORK_ADMIN') )
    1818        define('WP_NETWORK_ADMIN', FALSE);
     19
     20if ( ! defined('WP_USER_ADMIN') )
     21        define('WP_USER_ADMIN', FALSE);
     22
     23if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) {
    1924        define('WP_BLOG_ADMIN', TRUE);
    2025}
    2126
     
    97102
    98103if ( WP_NETWORK_ADMIN )
    99104        require(ABSPATH . 'wp-admin/network/menu.php');
     105elseif ( WP_USER_ADMIN )
     106        require(ABSPATH . 'wp-admin/user/menu.php');
    100107else
    101108        require(ABSPATH . 'wp-admin/menu.php');
    102109
  • wp-admin/index.php

     
    2424$title = __('Dashboard');
    2525$parent_file = 'index.php';
    2626
     27if ( is_user_admin() )
     28        add_screen_option('layout_columns', array('max' => 4, 'default' => 1) );
     29else
     30        add_screen_option('layout_columns', array('max' => 4, 'default' => 2) );
     31
    2732add_contextual_help($current_screen,
    2833
    2934        '<p>' . __('Welcome to your WordPress Dashboard! You will find helpful tips in the Help tab of each screen to assist you as you get to know the application.') . '</p>' .
     
    4247        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    4348);
    4449
    45 require_once('./admin-header.php');
     50include (ABSPATH . 'wp-admin/admin-header.php');
    4651
    4752$today = current_time('mysql', 1);
    4853?>
  • wp-admin/edit-link-form.php

     
    3737do_action('do_meta_boxes', 'link', 'advanced', $link);
    3838do_action('do_meta_boxes', 'link', 'side', $link);
    3939
     40add_screen_option('layout_columns', array('max' => 2) );
     41
    4042add_contextual_help($current_screen,
    4143        '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
    4244        '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
  • wp-admin/upload.php

     
    134134wp_enqueue_script( 'jquery-ui-draggable' );
    135135wp_enqueue_script( 'media' );
    136136
     137add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
     138
    137139add_contextual_help( $current_screen,
    138140        '<p>' . __('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the <em>Screen Options</em> tab to customize the display of this screen.') . '</p>' .
    139141        '<p>' . __('You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.') . '</p>' .
  • wp-admin/edit-form-advanced.php

     
    163163do_action('do_meta_boxes', $post_type, 'advanced', $post);
    164164do_action('do_meta_boxes', $post_type, 'side', $post);
    165165
     166add_screen_option('layout_columns', array('max' => 2) );
     167
    166168if ( 'post' == $post_type ) {
    167169        add_contextual_help($current_screen,
    168170        '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes that allow you to add metadata to your post using drag and drop, and can minimize or expand them by clicking the title bar of the box. You can also hide any of the boxes by using the Screen Options tab, where you can also choose a 1- or 2-column layout for this screen.') . '</p>' .
  • wp-admin/network/settings.php

     
    4343?>
    4444
    4545<div class="wrap">
    46         <?php screen_icon(); ?>
     46        <?php screen_icon('options-general'); ?>
    4747        <h2><?php _e( 'Network Options' ) ?></h2>
    4848        <form method="post" action="edit.php?action=siteoptions">
    4949                <?php wp_nonce_field( 'siteoptions' ); ?>
     
    6767                                </td>
    6868                        </tr>
    6969                </table>
    70                 <h3><?php _e( 'Dashboard Settings' ); ?></h3>
    71                 <table class="form-table">
    72                         <tr valign="top">
    73                                 <th scope="row"><label for="dashboard_blog"><?php _e( 'Dashboard Site' ) ?></label></th>
    74                                 <td>
    75                                         <?php
    76                                         if ( $dashboard_blog = get_site_option( 'dashboard_blog' ) ) {
    77                                                 $details = get_blog_details( $dashboard_blog );
    78                                                 $blogname = untrailingslashit( sanitize_user( str_replace( '.', '', str_replace( $current_site->domain . $current_site->path, '', $details->domain . $details->path ) ) ) );
    79                                         } else {
    80                                                 $blogname = '';
    81                                         }?>
    82                                         <input name="dashboard_blog_orig" type="hidden" id="dashboard_blog_orig" value="<?php echo esc_attr( $blogname ); ?>" />
    83                                         <input name="dashboard_blog" type="text" id="dashboard_blog" value="<?php echo esc_attr( $blogname ); ?>" class="regular-text" />
    84                                         <br />
    85                                         <?php _e( 'Site path (&#8220;dashboard&#8221;, &#8220;control&#8221;, &#8220;manager&#8221;, etc.) or blog ID.<br />New users are added to this site as the user role defined below if they don&#8217;t have a site. Leave blank for the main site. Users with the Subscriber role on the old site will be moved to the new site if changed. The new site will be created if it does not exist.' ); ?>
    86                                 </td>
    87                         </tr>
    88                         <tr valign="top">
    89                                 <th scope="row"><label for="default_user_role"><?php _e( 'Dashboard User Default Role' ) ?></label></th>
    90                                 <td>
    91                                         <select name="default_user_role" id="default_user_role"><?php
    92                                         wp_dropdown_roles( get_site_option( 'default_user_role', 'subscriber' ) );
    93                                         ?>
    94                                         </select>
    95                                         <br />
    96                                         <?php _e( 'The default role for new users on the Dashboard site. &#8220;Subscriber&#8221; or &#8220;Contributor&#8221; roles are recommended.' ); ?>
    97                                 </td>
    98                         </tr>
    99                         <tr valign="top">
    100                                 <th scope="row"><label for="admin_notice_feed"><?php _e( 'Admin Notice Feed' ) ?></label></th>
    101                                 <td><input name="admin_notice_feed" class="large-text" type="text" id="admin_notice_feed" value="<?php echo esc_attr( get_site_option( 'admin_notice_feed' ) ) ?>" size="80" /><br />
    102                                 <?php _e( 'Display the latest post from this RSS or Atom feed on all site dashboards. Leave blank to disable.' ); ?><br />
    103 
    104                                 <?php if ( get_site_option( 'admin_notice_feed' ) != get_home_url( $current_site->id, 'feed/' ) )
    105                                         echo __( 'A good one to use would be the feed from your main site: ' ) . esc_url( get_home_url( $current_site->id, 'feed/' ) ) ?></td>
    106                         </tr>
    107                 </table>
    10870                <h3><?php _e( 'Registration Settings' ); ?></h3>
    10971                <table class="form-table">
    11072                        <tr valign="top">
  • wp-admin/network/users.php

     
    1616$title = __( 'Users' );
    1717$parent_file = 'users.php';
    1818
     19add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
     20
    1921add_contextual_help($current_screen,
    2022        '<p>' . __('This table shows all users across the network and the sites to which they are assigned.') . '</p>' .
    2123        '<p>' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to his or her Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '</p>' .
  • wp-admin/network/edit.php

     
    5252                                                $user_dropdown = "<select name='blog[$val][{$key}]'>";
    5353                                                $user_list = '';
    5454                                                foreach ( $blog_users as $user ) {
    55                                                         if ( $user->user_id != $val && !in_array( $user->user_id, $allusers ) )
    56                                                                 $user_list .= "<option value='{$user->user_id}'>{$user->user_login}</option>";
     55                                                        if ( $user->user_id != $val && !in_array( $user->id, $allusers ) )
     56                                                                $user_list .= "<option value='{$user->id}'>{$user->user_login}</option>";
    5757                                                }
    5858                                                if ( '' == $user_list )
    5959                                                        $user_list = $admin_out;
     
    137137                } else {
    138138                        update_site_option( 'banned_email_domains', '' );
    139139                }
    140                 update_site_option( 'default_user_role', $_POST['default_user_role'] );
    141                 if ( trim( $_POST['dashboard_blog_orig'] ) == '' )
    142                         $_POST['dashboard_blog_orig'] = $current_site->blog_id;
    143                 if ( trim( $_POST['dashboard_blog'] ) == '' ) {
    144                         $_POST['dashboard_blog'] = $current_site->blog_id;
    145                         $dashboard_blog_id = $current_site->blog_id;
    146                 } elseif ( ! preg_match( '/(--|\.)/', $_POST['dashboard_blog'] ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $_POST['dashboard_blog'] ) ) {
    147                         $dashboard_blog = $_POST['dashboard_blog'];
    148                         $blog_details = get_blog_details( $dashboard_blog );
    149                         if ( false === $blog_details ) {
    150                                 if ( is_numeric( $dashboard_blog ) )
    151                                         wp_die( __( 'A dashboard site referenced by ID must already exist' ) );
    152                                 if ( is_subdomain_install() ) {
    153                                         $domain = $dashboard_blog . '.' . $current_site->domain;
    154                                         $path = $current_site->path;
    155                                 } else {
    156                                         $domain = $current_site->domain;
    157                                         $path = trailingslashit( $current_site->path . $dashboard_blog );
    158                                 }
    159                                 $wpdb->hide_errors();
    160                                 $dashboard_blog_id = wpmu_create_blog( $domain, $path, __( 'My Dashboard' ), $current_user->id , array( 'public' => 0 ), $current_site->id );
    161                                 $wpdb->show_errors();
    162                         } else {
    163                                 $dashboard_blog_id = $blog_details->blog_id;
    164                         }
    165                 }
    166                 if ( is_wp_error( $dashboard_blog_id ) )
    167                         wp_die( __( 'Problem creating dashboard site: ' ) . $dashboard_blog_id->get_error_message() );
    168                 if ( $_POST['dashboard_blog_orig'] != $_POST['dashboard_blog'] ) {
    169                         $users = get_users_of_blog( get_site_option( 'dashboard_blog' ) );
    170                         $move_users = array();
    171                         foreach ( (array)$users as $user ) {
    172                                 $user_meta_value = unserialize( $user->meta_value );
    173                                 if ( is_array( $user_meta_value ) && array_pop( $var_by_ref = array_keys( $user_meta_value ) ) == 'subscriber' )
    174                                         $move_users[] = $user->user_id;
    175                         }
    176                         if ( false == empty( $move_users ) ) {
    177                                 foreach ( (array)$move_users as $user_id ) {
    178                                         remove_user_from_blog($user_id, get_site_option( 'dashboard_blog' ) );
    179                                         add_user_to_blog( $dashboard_blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    180                                         update_user_meta( $user_id, 'primary_blog', $dashboard_blog_id );
    181                                 }
    182                         }
    183                 }
    184                 update_site_option( 'dashboard_blog', $dashboard_blog_id );
    185140
    186                 $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'admin_notice_feed', 'global_terms_enabled' );
     141                $options = array( 'registrationnotification', 'registration', 'add_new_users', 'menu_items', 'mu_media_buttons', 'upload_space_check_disabled', 'blog_upload_space', 'upload_filetypes', 'site_name', 'first_post', 'first_page', 'first_comment', 'first_comment_url', 'first_comment_author', 'welcome_email', 'welcome_user_email', 'fileupload_maxk', 'global_terms_enabled' );
    187142                $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 );
    188143                foreach ( $checked_options as $option_name => $option_unchecked_value ) {
    189144                        if ( ! isset( $_POST[$option_name] ) )
     
    255210                $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
    256211                $wpdb->show_errors();
    257212                if ( !is_wp_error( $id ) ) {
    258                         $dashboard_blog = get_dashboard_blog();
    259                         if ( !is_super_admin( $user_id ) && get_user_option( 'primary_blog', $user_id ) == $dashboard_blog->blog_id )
     213                        if ( !is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) )
    260214                                update_user_option( $user_id, 'primary_blog', $id, true );
    261215                        $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) );
    262216                        wp_mail( get_site_option('admin_email'),  sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
     
    687641                else
    688642                        wp_new_user_notification( $user_id, $password );
    689643
    690                 if ( get_site_option( 'dashboard_blog' ) == false )
    691                         add_user_to_blog( $current_site->blog_id, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    692                 else
    693                         add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );
    694 
    695644                wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) );
    696645                exit();
    697646        break;
  • wp-admin/network/sites.php

     
    1818$title = __( 'Sites' );
    1919$parent_file = 'sites.php';
    2020
     21add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) );
     22
    2123if ( isset( $_REQUEST['action'] ) && 'editblog' == $_REQUEST['action'] ) {
    2224        add_contextual_help($current_screen,
    2325                '<p>' . __('This extensive list of options has five modules: Site Info, Site Options, allowing Site Themes for this given site, changing user roles and passwords for that site, adding a new user, and Miscellaneous Site Actions (upload size limits).') . '</p>' .
     
    109111                require_once( '../admin-header.php' );
    110112                ?>
    111113                <div class="wrap">
    112                 <?php screen_icon(); ?>
     114                <?php screen_icon('index'); ?>
    113115                <h2><?php _e( 'Edit Site' ); ?> - <a href="<?php echo esc_url( get_home_url( $id ) ); ?>"><?php echo esc_url( get_home_url( $id ) ); ?></a></h2>
    114116                <?php echo $msg; ?>
    115117                <form method="post" action="edit.php?action=updateblog">
     
    347349                ?>
    348350
    349351                <div class="wrap">
    350                 <?php screen_icon(); ?>
     352                <?php screen_icon('index'); ?>
    351353                <h2><?php _e('Sites') ?>
    352354                <?php echo $msg; ?>
    353355                <a href="#form-add-site" class="button add-new-h2"><?php echo esc_html_x( 'Add New', 'sites' ); ?></a>
  • wp-admin/network/upgrade.php

     
    3232        wp_die( __( 'You do not have permission to access this page.' ) );
    3333
    3434echo '<div class="wrap">';
    35 screen_icon();
     35screen_icon('tools');
    3636echo '<h2>' . __( 'Update Network' ) . '</h2>';
    3737
    3838$action = isset($_GET['action']) ? $_GET['action'] : 'show';
  • wp-admin/menu.php

     
    232232        'themes' => 'appearance',
    233233        );
    234234
    235 require(ABSPATH . 'wp-admin/includes/menu.php');
     235require_once(ABSPATH . 'wp-admin/includes/menu.php');
    236236
    237237?>
  • wp-admin/plugins.php

     
    290290wp_enqueue_script('plugin-install');
    291291add_thickbox();
    292292
     293add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999) );
     294
    293295add_contextual_help($current_screen,
    294296        '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
    295297        '<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'http://wordpress.org/extend/plugins/') . '</p>' .
  • wp-admin/edit.php

     
    163163        );
    164164}
    165165
     166add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
     167
    166168require_once('./admin-header.php');
    167169?>
    168170<div class="wrap">
  • wp-admin/index-extra.php

     
    1010require_once( './admin.php' );
    1111
    1212/** Load WordPress Administration Dashboard API */
    13 require( './includes/dashboard.php' );
     13require(ABSPATH . 'wp-admin/includes/dashboard.php' );
    1414
    1515@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
    1616send_nosniff_header();
  • wp-admin/user-edit.php

     
    3131        $submenu_file = 'users.php';
    3232else
    3333        $submenu_file = 'profile.php';
    34 $parent_file = 'users.php';
    3534
     35if ( current_user_can('edit_users') && !is_user_admin() )
     36        $parent_file = 'users.php';
     37else
     38        $parent_file = 'profile.php';
     39
    3640// contextual help - choose Help on the top right of admin panel to preview this.
    3741add_contextual_help($current_screen,
    3842    '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
  • wp-admin/user/profile.php

     
     1<?php
     2
     3require_once( './admin.php' );
     4
     5require( '../profile.php' );
     6 No newline at end of file
  • wp-admin/user/user-edit.php

    Property changes on: wp-admin/user/profile.php
    ___________________________________________________________________
    Added: svn:eol-style
       + native
    
     
     1<?php
     2
     3require_once( './admin.php' );
     4
     5require( '../user-edit.php' );
     6 No newline at end of file
  • wp-admin/user/menu.php

    Property changes on: wp-admin/user/user-edit.php
    ___________________________________________________________________
    Added: svn:eol-style
       + native
    
     
     1<?php
     2
     3/* translators: Network menu item */
     4$menu[0] = array(__('Dashboard'), 'exist', 'index.php', '', 'menu-top menu-top-first menu-icon-site', 'menu-site', 'div');
     5
     6$menu[4] = array( '', 'exist', 'separator1', '', 'wp-menu-separator' );
     7
     8$menu[70] = array( __('Profile'), 'exist', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
     9
     10$menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator-last' );
     11
     12$_wp_real_parent_file['users.php'] = 'profile.php';
     13$compat = array();
     14$submenu = array();
     15
     16require_once(ABSPATH . 'wp-admin/includes/menu.php');
     17
     18?>
     19 No newline at end of file
  • wp-admin/user/index.php

    Property changes on: wp-admin/user/menu.php
    ___________________________________________________________________
    Added: svn:eol-style
       + native
    
     
     1<?php
     2
     3require_once( './admin.php' );
     4
     5require( '../index.php' );
  • wp-admin/user/admin.php

    Property changes on: wp-admin/user/index.php
    ___________________________________________________________________
    Added: svn:eol-style
       + native
    
     
     1<?php
     2
     3define('WP_USER_ADMIN', TRUE);
     4
     5require_once( dirname(dirname(__FILE__)) . '/admin.php');
     6
     7if ( ! is_main_site() )
     8        wp_redirect( user_admin_url() );
     9
     10?>
  • wp-admin/user/index-extra.php

    Property changes on: wp-admin/user/admin.php
    ___________________________________________________________________
    Added: svn:eol-style
       + native
    
     
     1<?php
     2
     3require_once( './admin.php' );
     4
     5require( '../index-extra.php' );