Make WordPress Core

Changeset 15746


Ignore:
Timestamp:
10/07/2010 07:34:18 PM (14 years ago)
Author:
ryan
Message:

First pass of user admin. Network admin and screen cleanups. see #14696

Location:
trunk
Files:
7 added
36 edited

Legend:

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

    r15600 r15746  
    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}
     
    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');
  • trunk/wp-admin/edit-comments.php

    r15666 r15746  
    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>' .
  • trunk/wp-admin/edit-form-advanced.php

    r15542 r15746  
    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,
  • trunk/wp-admin/edit-link-form.php

    r15135 r15746  
    3737do_action('do_meta_boxes', 'link', 'advanced', $link);
    3838do_action('do_meta_boxes', 'link', 'side', $link);
     39
     40add_screen_option('layout_columns', array('max' => 2) );
    3941
    4042add_contextual_help($current_screen,
  • trunk/wp-admin/edit-tags.php

    r15642 r15746  
    2222    $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
    2323}
     24
     25add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') );
    2426
    2527switch ( $wp_list_table->current_action() ) {
  • trunk/wp-admin/edit.php

    r15667 r15746  
    164164}
    165165
     166add_screen_option( 'per_page', array('label' => $title, 'default' => 20) );
     167
    166168require_once('./admin-header.php');
    167169?>
  • trunk/wp-admin/includes/dashboard.php

    r15718 r15746  
    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;
     
    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         );
    36     }
    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' );
     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' );
     42    }
    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         );
    51     }
    52     wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
     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' );
     58    }
    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
     
    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 ) ) {
     
    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        }
     
    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
     
    155165function wp_dashboard() {
    156166    global $screen_layout_columns;
     167
     168    $screen = get_current_screen();
    157169
    158170    $hide2 = $hide3 = $hide4 = '';
     
    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>
  • trunk/wp-admin/includes/default-list-tables.php

    r15742 r15746  
    27202720    function WP_Sites_Table() {
    27212721        parent::WP_List_Table( array(
    2722             'screen' => 'ms-sites',
     2722            'screen' => 'sites-network',
    27232723            'plural' => 'sites',
    27242724        ) );
     
    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();
     
    30083008    function WP_MS_Users_Table() {
    30093009        parent::WP_List_Table( array(
    3010             'screen' => 'ms-users',
     3010            'screen' => 'users-network',
    30113011        ) );
    30123012    }
     
    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();
  • trunk/wp-admin/includes/menu.php

    r15718 r15746  
    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');
     
    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', '');
  • trunk/wp-admin/includes/misc.php

    r15491 r15746  
    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':
  • trunk/wp-admin/includes/ms.php

    r15718 r15746  
    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     }
    510 
    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     }
     509    } else {
     510        wp_redirect( user_admin_url( '?c=' . $c ) ); // redirect and count to 5, "just in case"
     511    }
     512
    528513    wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    529514}
  • trunk/wp-admin/includes/template.php

    r15664 r15746  
    13901390    if ( is_string($screen) )
    13911391        $screen = convert_to_screen($screen);
     1392
     1393    if ( $screen->is_user )
     1394        return;
    13921395
    13931396    if ( isset($screen->post_type) ) {
     
    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) )
     
    16701673            break;
    16711674    }
    1672     if( ! empty( $settings ) )
     1675    if ( ! empty( $settings ) )
     1676        $show_screen = true;
     1677
     1678    if ( !empty($wp_current_screen_options) )
    16731679        $show_screen = true;
    16741680
     
    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);
    1805 
    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]) ) {
     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]) );
     1814
     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];
    1819 
    1820     if ( ! $screen_layout_columns )
     1821    $num = $wp_current_screen_options['layout_columns']['max'];
     1822
     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;
     
    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     }
    1869 
    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';
     1864    if ( !isset($wp_current_screen_options['per_page']) )
     1865        return '';
     1866
     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;
     
    19961993    </script>
    19971994<?php
     1995}
     1996
     1997/**
     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;
    19982011}
    19992012
     
    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);
  • trunk/wp-admin/index-extra.php

    r14924 r15746  
    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' ) );
  • trunk/wp-admin/index.php

    r15132 r15746  
    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
     
    4348);
    4449
    45 require_once('./admin-header.php');
     50include (ABSPATH . 'wp-admin/admin-header.php');
    4651
    4752$today = current_time('mysql', 1);
  • trunk/wp-admin/js/dashboard.dev.js

    r14815 r15746  
    4343    ajaxPopulateWidgets();
    4444
    45     postboxes.add_postbox_toggles('dashboard', { pbshow: ajaxPopulateWidgets } );
     45    postboxes.add_postbox_toggles(pagenow, { pbshow: ajaxPopulateWidgets } );
    4646
    4747    /* QuickPress */
  • trunk/wp-admin/js/dashboard.js

    r14815 r15746  
    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")})}});
     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")})}});
  • trunk/wp-admin/menu.php

    r15556 r15746  
    233233    );
    234234
    235 require(ABSPATH . 'wp-admin/includes/menu.php');
     235require_once(ABSPATH . 'wp-admin/includes/menu.php');
    236236
    237237?>
  • trunk/wp-admin/network/edit.php

    r15669 r15746  
    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 )
     
    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 );
    185 
    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' );
     140
     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 ) {
     
    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 ) );
     
    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();
  • trunk/wp-admin/network/settings.php

    r15481 r15746  
    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">
     
    6666                    <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), $current_site->domain ); ?>
    6767                </td>
    68             </tr>
    69         </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>
    10668            </tr>
    10769        </table>
  • trunk/wp-admin/network/sites.php

    r15673 r15746  
    1818$title = __( 'Sites' );
    1919$parent_file = 'sites.php';
     20
     21add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) );
    2022
    2123if ( isset( $_REQUEST['action'] ) && 'editblog' == $_REQUEST['action'] ) {
     
    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; ?>
     
    348350
    349351        <div class="wrap">
    350         <?php screen_icon(); ?>
     352        <?php screen_icon('index'); ?>
    351353        <h2><?php _e('Sites') ?>
    352354        <?php echo $msg; ?>
  • trunk/wp-admin/network/upgrade.php

    r15484 r15746  
    3333
    3434echo '<div class="wrap">';
    35 screen_icon();
     35screen_icon('tools');
    3636echo '<h2>' . __( 'Update Network' ) . '</h2>';
    3737
  • trunk/wp-admin/network/users.php

    r15603 r15746  
    1616$title = __( 'Users' );
    1717$parent_file = 'users.php';
     18
     19add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
    1820
    1921add_contextual_help($current_screen,
  • trunk/wp-admin/plugins.php

    r15697 r15746  
    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>' .
  • trunk/wp-admin/upload.php

    r15642 r15746  
    134134wp_enqueue_script( 'jquery-ui-draggable' );
    135135wp_enqueue_script( 'media' );
     136
     137add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
    136138
    137139add_contextual_help( $current_screen,
  • trunk/wp-admin/user-edit.php

    r15481 r15746  
    3232else
    3333    $submenu_file = 'profile.php';
    34 $parent_file = 'users.php';
     34
     35if ( current_user_can('edit_users') && !is_user_admin() )
     36    $parent_file = 'users.php';
     37else
     38    $parent_file = 'profile.php';
    3539
    3640// contextual help - choose Help on the top right of admin panel to preview this.
  • trunk/wp-admin/users.php

    r15642 r15746  
    1818$title = __('Users');
    1919$parent_file = 'users.php';
     20
     21add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) );
    2022
    2123// contextual help - choose Help on the top right of admin panel to preview this.
  • trunk/wp-includes/admin-bar.php

    r15696 r15746  
    110110    if ( !is_object( $wp_admin_bar ) )
    111111        return false;
    112 
    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     }
    120112
    121113    /* Add the 'My Dashboards' menu if the user has more than one blog. */
  • trunk/wp-includes/admin-bar/admin-bar-class.php

    r15671 r15746  
    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 {
  • trunk/wp-includes/capabilities.php

    r15640 r15746  
    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 />";
  • trunk/wp-includes/functions.php

    r15723 r15746  
    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) . "'";
  • trunk/wp-includes/link-template.php

    r15701 r15746  
    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 *
     
    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);
  • trunk/wp-includes/load.php

    r15680 r15746  
    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 *
  • trunk/wp-includes/ms-functions.php

    r15678 r15746  
    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()
     
    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;
     76
     77    if ( !is_multisite() )
     78        return $blogs[$wpdb->blogid];
    8279
    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 );
    96     }
    97 
    98     if ( ( is_object( $details ) == false ) || ( is_object( $details ) && $details->archived == 1 || $details->spam == 1 || $details->deleted == 1 ) ) {
     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;
     94    }
     95
     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;
     
    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}
     
    841828
    842829        wpmu_welcome_user_notification($user_id, $password, $meta);
    843         $user_site = get_site_option( 'dashboard_blog', $current_site->blog_id );
    844 
    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' ) );
    849830
    850831        add_new_user_to_blog( $user_id, $user_email, $meta );
     
    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
     
    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' ) )
  • trunk/wp-includes/pluggable.php

    r15682 r15746  
    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;
     
    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
  • trunk/wp-includes/vars.php

    r13132 r15746  
    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, '/');
  • trunk/wp-login.php

    r15735 r15746  
    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);
Note: See TracChangeset for help on using the changeset viewer.