Changeset 15746
- Timestamp:
- 10/07/2010 07:34:18 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 added
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin.php
r15600 r15746 12 12 * @since unknown 13 13 */ 14 if ( ! defined('WP_ADMIN') )14 if ( ! defined('WP_ADMIN') ) 15 15 define('WP_ADMIN', TRUE); 16 16 17 if ( ! defined('WP_NETWORK_ADMIN') ) {17 if ( ! defined('WP_NETWORK_ADMIN') ) 18 18 define('WP_NETWORK_ADMIN', FALSE); 19 20 if ( ! defined('WP_USER_ADMIN') ) 21 define('WP_USER_ADMIN', FALSE); 22 23 if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) { 19 24 define('WP_BLOG_ADMIN', TRUE); 20 25 } … … 98 103 if ( WP_NETWORK_ADMIN ) 99 104 require(ABSPATH . 'wp-admin/network/menu.php'); 105 elseif ( WP_USER_ADMIN ) 106 require(ABSPATH . 'wp-admin/user/menu.php'); 100 107 else 101 108 require(ABSPATH . 'wp-admin/menu.php'); -
trunk/wp-admin/edit-comments.php
r15666 r15746 106 106 $title = __('Comments'); 107 107 108 add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) ); 109 108 110 add_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>' . 109 111 '<p>' . __('A yellow row means the comment is waiting for you to moderate it.') . '</p>' . -
trunk/wp-admin/edit-form-advanced.php
r15542 r15746 164 164 do_action('do_meta_boxes', $post_type, 'side', $post); 165 165 166 add_screen_option('layout_columns', array('max' => 2) ); 167 166 168 if ( 'post' == $post_type ) { 167 169 add_contextual_help($current_screen, -
trunk/wp-admin/edit-link-form.php
r15135 r15746 37 37 do_action('do_meta_boxes', 'link', 'advanced', $link); 38 38 do_action('do_meta_boxes', 'link', 'side', $link); 39 40 add_screen_option('layout_columns', array('max' => 2) ); 39 41 40 42 add_contextual_help($current_screen, -
trunk/wp-admin/edit-tags.php
r15642 r15746 22 22 $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; 23 23 } 24 25 add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') ); 24 26 25 27 switch ( $wp_list_table->current_action() ) { -
trunk/wp-admin/edit.php
r15667 r15746 164 164 } 165 165 166 add_screen_option( 'per_page', array('label' => $title, 'default' => 20) ); 167 166 168 require_once('./admin-header.php'); 167 169 ?> -
trunk/wp-admin/includes/dashboard.php
r15718 r15746 17 17 global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks; 18 18 $wp_dashboard_control_callbacks = array(); 19 $screen = get_current_screen(); 19 20 20 21 $update = false; … … 26 27 27 28 // 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' ); 29 31 30 32 // 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 } 39 43 40 44 // 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 } 53 59 54 60 // WP Plugins Widget 55 if ( current_user_can( 'install_plugins' ) )61 if ( is_blog_admin() && current_user_can( 'install_plugins' ) ) 56 62 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 57 63 58 64 // QuickPress Widget 59 if ( current_user_can('edit_posts') )65 if ( is_blog_admin() && current_user_can('edit_posts') ) 60 66 wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); 61 67 62 68 // Recent Drafts 63 if ( current_user_can('edit_posts') )69 if ( is_blog_admin() && current_user_can('edit_posts') ) 64 70 wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' ); 65 71 … … 116 122 update_option( 'dashboard_widget_options', $widget_options ); 117 123 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', ''); 120 126 } 121 127 122 128 function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) { 129 $screen = get_current_screen(); 123 130 global $wp_dashboard_control_callbacks; 124 131 if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { … … 127 134 list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); 128 135 $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' ); 130 137 return; 131 138 } … … 133 140 $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>'; 134 141 } 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'); 136 146 $location = 'normal'; 137 147 if ( in_array($widget_id, $side_widgets) ) 138 148 $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' ); 140 150 } 141 151 … … 155 165 function wp_dashboard() { 156 166 global $screen_layout_columns; 167 168 $screen = get_current_screen(); 157 169 158 170 $hide2 = $hide3 = $hide4 = ''; … … 177 189 <?php 178 190 echo "\t<div class='postbox-container' style='$width'>\n"; 179 do_meta_boxes( 'dashboard', 'normal', '' );191 do_meta_boxes( $screen->id, 'normal', '' ); 180 192 181 193 echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n"; 182 do_meta_boxes( 'dashboard', 'side', '' );194 do_meta_boxes( $screen->id, 'side', '' ); 183 195 184 196 echo "\t</div><div class='postbox-container' style='{$hide3}$width'>\n"; 185 do_meta_boxes( 'dashboard', 'column3', '' );197 do_meta_boxes( $screen->id, 'column3', '' ); 186 198 187 199 echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n"; 188 do_meta_boxes( 'dashboard', 'column4', '' );200 do_meta_boxes( $screen->id, 'column4', '' ); 189 201 ?> 190 202 </div></div> -
trunk/wp-admin/includes/default-list-tables.php
r15742 r15746 2720 2720 function WP_Sites_Table() { 2721 2721 parent::WP_List_Table( array( 2722 'screen' => ' ms-sites',2722 'screen' => 'sites-network', 2723 2723 'plural' => 'sites', 2724 2724 ) ); … … 2735 2735 $mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode']; 2736 2736 2737 $per_page = $this->get_items_per_page( ' ms_sites_per_page' );2737 $per_page = $this->get_items_per_page( 'sites_network_per_page' ); 2738 2738 2739 2739 $pagenum = $this->get_pagenum(); … … 3008 3008 function WP_MS_Users_Table() { 3009 3009 parent::WP_List_Table( array( 3010 'screen' => ' ms-users',3010 'screen' => 'users-network', 3011 3011 ) ); 3012 3012 } … … 3025 3025 $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; 3026 3026 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' ); 3028 3028 3029 3029 $paged = $this->get_pagenum(); -
trunk/wp-admin/includes/menu.php
r15718 r15746 10 10 if ( is_network_admin() ) 11 11 do_action('_network_admin_menu'); 12 elseif ( is_user_admin() ) 13 do_action('_user_admin_menu'); 12 14 else 13 15 do_action('_admin_menu'); … … 90 92 if ( is_network_admin() ) 91 93 do_action('network_admin_menu', ''); 94 elseif ( is_user_admin() ) 95 do_action('user_admin_menu', ''); 92 96 else 93 97 do_action('admin_menu', ''); -
trunk/wp-admin/includes/misc.php
r15491 r15746 344 344 switch ( $map_option ) { 345 345 case 'edit_per_page': 346 case ' ms_sites_per_page':346 case 'sites_network_per_page': 347 347 case 'users_per_page': 348 case ' ms_users_per_page':348 case 'users_network_per_page': 349 349 case 'edit_comments_per_page': 350 350 case 'upload_per_page': -
trunk/wp-admin/includes/ms.php
r15718 r15746 503 503 504 504 $blog = get_active_blog_for_user( get_current_user_id() ); 505 $dashboard_blog = get_dashboard_blog(); 505 506 506 if ( is_object( $blog ) ) { 507 507 wp_redirect( get_admin_url( $blog->blog_id, '?c=' . $c ) ); // redirect and count to 5, "just in case" 508 508 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 528 513 wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 529 514 } -
trunk/wp-admin/includes/template.php
r15664 r15746 1390 1390 if ( is_string($screen) ) 1391 1391 $screen = convert_to_screen($screen); 1392 1393 if ( $screen->is_user ) 1394 return; 1392 1395 1393 1396 if ( isset($screen->post_type) ) { … … 1636 1639 1637 1640 function 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; 1639 1642 1640 1643 if ( is_string($screen) ) … … 1670 1673 break; 1671 1674 } 1672 if( ! empty( $settings ) ) 1675 if ( ! empty( $settings ) ) 1676 $show_screen = true; 1677 1678 if ( !empty($wp_current_screen_options) ) 1673 1679 $show_screen = true; 1674 1680 … … 1797 1803 1798 1804 function screen_layout($screen) { 1799 global $screen_layout_columns ;1805 global $screen_layout_columns, $wp_current_screen_options; 1800 1806 1801 1807 if ( is_string($screen) ) 1802 1808 $screen = convert_to_screen($screen); 1803 1809 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']) ) { 1813 1816 $screen_layout_columns = 0; 1814 1817 return ''; 1815 1818 } 1816 1819 1817 1820 $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 1821 1827 $screen_layout_columns = 2; 1828 } 1822 1829 1823 1830 $i = 1; … … 1831 1838 } 1832 1839 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 */ 1849 function 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 1833 1858 function screen_options($screen) { 1859 global $wp_current_screen_options; 1860 1834 1861 if ( is_string($screen) ) 1835 1862 $screen = convert_to_screen($screen); 1836 1863 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']; 1876 1873 } 1877 1874 1878 1875 $per_page = (int) get_user_option( $option ); 1879 1876 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']; 1882 1879 else 1883 1880 $per_page = 20; … … 1996 1993 </script> 1997 1994 <?php 1995 } 1996 1997 /** 1998 * Get the current screen object 1999 * 2000 * @since 3.1.0 2001 * 2002 * @return object Current screen object 2003 */ 2004 function get_current_screen() { 2005 global $current_screen; 2006 2007 if ( !isset($current_screen) ) 2008 return null; 2009 2010 return $current_screen; 1998 2011 } 1999 2012 … … 2061 2074 2062 2075 $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 } 2063 2085 2064 2086 $current_screen = apply_filters('current_screen', $current_screen); -
trunk/wp-admin/index-extra.php
r14924 r15746 11 11 12 12 /** Load WordPress Administration Dashboard API */ 13 require( './includes/dashboard.php' );13 require(ABSPATH . 'wp-admin/includes/dashboard.php' ); 14 14 15 15 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); -
trunk/wp-admin/index.php
r15132 r15746 25 25 $parent_file = 'index.php'; 26 26 27 if ( is_user_admin() ) 28 add_screen_option('layout_columns', array('max' => 4, 'default' => 1) ); 29 else 30 add_screen_option('layout_columns', array('max' => 4, 'default' => 2) ); 31 27 32 add_contextual_help($current_screen, 28 33 … … 43 48 ); 44 49 45 require_once('./admin-header.php');50 include (ABSPATH . 'wp-admin/admin-header.php'); 46 51 47 52 $today = current_time('mysql', 1); -
trunk/wp-admin/js/dashboard.dev.js
r14815 r15746 43 43 ajaxPopulateWidgets(); 44 44 45 postboxes.add_postbox_toggles( 'dashboard', { pbshow: ajaxPopulateWidgets } );45 postboxes.add_postbox_toggles(pagenow, { pbshow: ajaxPopulateWidgets } ); 46 46 47 47 /* 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")})}});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(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 233 233 ); 234 234 235 require (ABSPATH . 'wp-admin/includes/menu.php');235 require_once(ABSPATH . 'wp-admin/includes/menu.php'); 236 236 237 237 ?> -
trunk/wp-admin/network/edit.php
r15669 r15746 53 53 $user_list = ''; 54 54 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>"; 57 57 } 58 58 if ( '' == $user_list ) … … 138 138 update_site_option( 'banned_email_domains', '' ); 139 139 } 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' ); 187 142 $checked_options = array( 'mu_media_buttons' => array(), 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); 188 143 foreach ( $checked_options as $option_name => $option_unchecked_value ) { … … 256 211 $wpdb->show_errors(); 257 212 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 ) ) 260 214 update_user_option( $user_id, 'primary_blog', $id, true ); 261 215 $content_mail = sprintf( __( "New site created by %1s\n\nAddress: http://%2s\nName: %3s"), $current_user->user_login , $newdomain . $path, stripslashes( $title ) ); … … 688 642 wp_new_user_notification( $user_id, $password ); 689 643 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 else693 add_user_to_blog( get_site_option( 'dashboard_blog' ), $user_id, get_site_option( 'default_user_role', 'subscriber' ) );694 695 644 wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => 'add' ), wp_get_referer() ) ); 696 645 exit(); -
trunk/wp-admin/network/settings.php
r15481 r15746 44 44 45 45 <div class="wrap"> 46 <?php screen_icon( ); ?>46 <?php screen_icon('options-general'); ?> 47 47 <h2><?php _e( 'Network Options' ) ?></h2> 48 48 <form method="post" action="edit.php?action=siteoptions"> … … 66 66 <?php printf( __( 'Registration and support emails will come from this address. An address such as <code>support@%s</code> is recommended.' ), $current_site->domain ); ?> 67 67 </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 <?php76 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 (“dashboard”, “control”, “manager”, etc.) or blog ID.<br />New users are added to this site as the user role defined below if they don’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"><?php92 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. “Subscriber” or “Contributor” 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 68 </tr> 107 69 </table> -
trunk/wp-admin/network/sites.php
r15673 r15746 18 18 $title = __( 'Sites' ); 19 19 $parent_file = 'sites.php'; 20 21 add_screen_option( 'per_page', array('label' => _x( 'Sites', 'sites per page (screen options)' )) ); 20 22 21 23 if ( isset( $_REQUEST['action'] ) && 'editblog' == $_REQUEST['action'] ) { … … 110 112 ?> 111 113 <div class="wrap"> 112 <?php screen_icon( ); ?>114 <?php screen_icon('index'); ?> 113 115 <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> 114 116 <?php echo $msg; ?> … … 348 350 349 351 <div class="wrap"> 350 <?php screen_icon( ); ?>352 <?php screen_icon('index'); ?> 351 353 <h2><?php _e('Sites') ?> 352 354 <?php echo $msg; ?> -
trunk/wp-admin/network/upgrade.php
r15484 r15746 33 33 34 34 echo '<div class="wrap">'; 35 screen_icon( );35 screen_icon('tools'); 36 36 echo '<h2>' . __( 'Update Network' ) . '</h2>'; 37 37 -
trunk/wp-admin/network/users.php
r15603 r15746 16 16 $title = __( 'Users' ); 17 17 $parent_file = 'users.php'; 18 19 add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) ); 18 20 19 21 add_contextual_help($current_screen, -
trunk/wp-admin/plugins.php
r15697 r15746 291 291 add_thickbox(); 292 292 293 add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999) ); 294 293 295 add_contextual_help($current_screen, 294 296 '<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 134 134 wp_enqueue_script( 'jquery-ui-draggable' ); 135 135 wp_enqueue_script( 'media' ); 136 137 add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) ); 136 138 137 139 add_contextual_help( $current_screen, -
trunk/wp-admin/user-edit.php
r15481 r15746 32 32 else 33 33 $submenu_file = 'profile.php'; 34 $parent_file = 'users.php'; 34 35 if ( current_user_can('edit_users') && !is_user_admin() ) 36 $parent_file = 'users.php'; 37 else 38 $parent_file = 'profile.php'; 35 39 36 40 // contextual help - choose Help on the top right of admin panel to preview this. -
trunk/wp-admin/users.php
r15642 r15746 18 18 $title = __('Users'); 19 19 $parent_file = 'users.php'; 20 21 add_screen_option( 'per_page', array('label' => _x( 'Users', 'users per page (screen options)' )) ); 20 22 21 23 // contextual help - choose Help on the top right of admin panel to preview this. -
trunk/wp-includes/admin-bar.php
r15696 r15746 110 110 if ( !is_object( $wp_admin_bar ) ) 111 111 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 }120 112 121 113 /* Add the 'My Dashboards' menu if the user has more than one blog. */ -
trunk/wp-includes/admin-bar/admin-bar-class.php
r15671 r15746 16 16 if ( is_multisite() ) { 17 17 $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 ) ); 19 19 $this->user->account_domain = $this->user->domain; 20 20 } else { -
trunk/wp-includes/capabilities.php
r15640 r15746 738 738 // Must have ALL requested caps 739 739 $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args ); 740 $capabilities['exist'] = true; // Everyone is allowed to exist 740 741 foreach ( (array) $caps as $cap ) { 741 742 //echo "Checking cap $cap<br />"; -
trunk/wp-includes/functions.php
r15723 r15746 448 448 $site_id = $wpdb->siteid; 449 449 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' ); 451 451 452 452 $core_options_in = "'" . implode("', '", $core_options) . "'"; -
trunk/wp-includes/link-template.php
r15701 r15746 2131 2131 2132 2132 /** 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 */ 2142 function 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 /** 2133 2152 * Retrieve the url to the admin area for either the current blog or the network depending on context. 2134 2153 * … … 2143 2162 if ( is_network_admin() ) 2144 2163 return network_admin_url($path, $scheme); 2164 elseif ( is_user_admin() ) 2165 return user_admin_url($path, $scheme); 2145 2166 else 2146 2167 return admin_url($path, $scheme); -
trunk/wp-includes/load.php
r15680 r15746 622 622 623 623 /** 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 */ 633 function is_user_admin() { 634 if ( defined( 'WP_USER_ADMIN' ) ) 635 return WP_USER_ADMIN; 636 return false; 637 } 638 639 /** 624 640 * Whether Multisite support is enabled 625 641 * -
trunk/wp-includes/ms-functions.php
r15678 r15746 60 60 * @since MU 1.0 61 61 * @uses get_blogs_of_user() 62 * @uses get_dashboard_blog()63 62 * @uses add_user_to_blog() 64 63 * @uses update_user_meta() … … 73 72 global $wpdb; 74 73 $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]; 82 79 83 80 $primary_blog = get_user_meta( $user_id, 'primary_blog', true ); 84 $ details = get_dashboard_blog();81 $first_blog = current($blogs); 85 82 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; 90 87 } else { 91 $ details= get_blog_details( $primary_blog );88 $primary = get_blog_details( $primary_blog ); 92 89 } 93 90 } 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 ) ) { 99 97 $blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs. 100 98 $ret = false; … … 106 104 if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) { 107 105 $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 ) 110 107 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) ) 114 109 update_user_meta( $user_id, 'source_domain', $blog->domain ); 115 $changed = true;116 }117 if ( $changed )118 wp_cache_delete( $user_id, 'users' );119 110 break; 120 111 } 121 112 } 122 113 } 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; 128 115 } 129 116 return $ret; 130 117 } else { 131 return $ details;118 return $primary; 132 119 } 133 120 } … … 841 828 842 829 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 else848 add_user_to_blog( $user_site, $user_id, get_site_option( 'default_user_role', 'subscriber' ) );849 830 850 831 add_new_user_to_blog( $user_id, $user_email, $meta ); … … 927 908 update_option( 'blog_public', (int)$meta['public'] ); 928 909 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 ) ) 930 911 update_user_meta( $user_id, 'primary_blog', $blog_id ); 931 912 … … 1461 1442 add_action('update_option_blog_public', 'update_blog_public', 10, 2); 1462 1443 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 1476 1444 function get_dashboard_blog() { 1477 1445 if ( $blog = get_site_option( 'dashboard_blog' ) ) -
trunk/wp-includes/pluggable.php
r15682 r15746 82 82 83 83 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') ) { 85 85 wp_set_current_user(0); 86 86 return false; … … 776 776 } 777 777 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) ) { 779 784 do_action('auth_redirect', $user_id); 780 785 -
trunk/wp-includes/vars.php
r13132 r15746 16 16 if ( is_admin() ) { 17 17 // 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); 19 24 $pagenow = $self_matches[1]; 20 25 $pagenow = trim($pagenow, '/'); -
trunk/wp-login.php
r15735 r15746 573 573 <?php exit; 574 574 } 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() ) ) 577 582 $redirect_to = admin_url('profile.php'); 578 583 wp_safe_redirect($redirect_to);
Note: See TracChangeset
for help on using the changeset viewer.