WordPress.org

Make WordPress Core

Changeset 15717


Ignore:
Timestamp:
10/04/10 19:26:40 (4 years ago)
Author:
ryan
Message:

Fix user edit urls for network admin

Location:
trunk/wp-admin/includes
Files:
4 edited

Legend:

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

    r15596 r15717  
    2626 
    2727    // Right Now 
    28     wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' ); 
     28    if ( is_blog_admin() && current_user_can('edit_posts') ) 
     29        wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' ); 
    2930 
    3031    // 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' ); 
     32    if ( is_blog_admin() && current_user_can('moderate_comments') ) { 
     33        if ( !isset( $widget_options['dashboard_recent_comments'] ) || !isset( $widget_options['dashboard_recent_comments']['items'] ) ) { 
     34            $update = true; 
     35            $widget_options['dashboard_recent_comments'] = array( 
     36                'items' => 5, 
     37            ); 
     38        } 
     39        $recent_comments_title = __( 'Recent Comments' ); 
     40        wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments', 'wp_dashboard_recent_comments_control' ); 
     41    } 
    3942 
    4043    // 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' ); 
     44    if ( is_blog_admin() && current_user_can('publish_posts') ) { 
     45        if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) { 
     46            $update = true; 
     47            $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10; 
     48            $widget_options['dashboard_incoming_links'] = array( 
     49                'home' => get_option('home'), 
     50                'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ), 
     51                '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') ) ), 
     52                'items' => $num_items, 
     53                'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false 
     54            ); 
     55        } 
     56        wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' ); 
     57    } 
    5358 
    5459    // WP Plugins Widget 
    55     if ( current_user_can( 'install_plugins' ) ) 
     60    if ( is_blog_admin() && current_user_can( 'install_plugins' ) ) 
    5661        wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 
    5762 
    5863    // QuickPress Widget 
    59     if ( current_user_can('edit_posts') ) 
     64    if ( is_blog_admin() && current_user_can('edit_posts') ) 
    6065        wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); 
    6166 
    6267    // Recent Drafts 
    63     if ( current_user_can('edit_posts') ) 
     68    if ( is_blog_admin() && current_user_can('edit_posts') ) 
    6469        wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' ); 
    6570 
  • trunk/wp-admin/includes/default-list-tables.php

    r15697 r15717  
    31413141                        ?> 
    31423142                        <td class="username column-username"> 
    3143                             <?php echo $avatar; ?><strong><a href="<?php echo esc_url( admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php 
     3143                            <?php echo $avatar; ?><strong><a href="<?php echo esc_url( self_admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php 
    31443144                            if ( in_array( $user->user_login, $super_admins ) ) 
    31453145                                echo ' - ' . __( 'Super admin' ); 
     
    31483148                            <?php 
    31493149                                $actions = array(); 
    3150                                 $actions['edit'] = '<a href="' . esc_url( admin_url( $edit_link ) ) . '">' . __( 'Edit' ) . '</a>'; 
     3150                                $actions['edit'] = '<a href="' . esc_url( self_admin_url( $edit_link ) ) . '">' . __( 'Edit' ) . '</a>'; 
    31513151 
    31523152                                if ( ! in_array( $user->user_login, $super_admins ) ) { 
  • trunk/wp-admin/includes/menu.php

    r15481 r15717  
    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/ms.php

    r15679 r15717  
    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} 
Note: See TracChangeset for help on using the changeset viewer.