Ticket #20307: 20307.2.patch
File 20307.2.patch, 1.4 KB (added by , 8 years ago) |
---|
-
src/wp-includes/admin-bar.php
549 549 * @param WP_Admin_Bar $wp_admin_bar 550 550 */ 551 551 function wp_admin_bar_edit_menu( $wp_admin_bar ) { 552 global $tag, $wp_the_query ;552 global $tag, $wp_the_query, $user_id; 553 553 554 554 if ( is_admin() ) { 555 555 $current_screen = get_current_screen(); … … 587 587 'title' => $tax->labels->view_item, 588 588 'href' => get_term_link( $tag ) 589 589 ) ); 590 } elseif ( 'user-edit' == $current_screen->base 591 && isset( $user_id ) 592 && ( $user_object = get_userdata( $user_id ) ) 593 && $user_object->exists() 594 && $view_link = get_author_posts_url( $user_object->ID ) ) 595 { 596 $wp_admin_bar->add_menu( array( 597 'id' => 'view', 598 'title' => __( 'View User' ), 599 'href' => $view_link, 600 ) ); 590 601 } 591 602 } else { 592 603 $current_object = $wp_the_query->get_queried_object(); … … 615 626 'title' => $tax->labels->edit_item, 616 627 'href' => $edit_term_link 617 628 ) ); 629 } elseif ( is_a( $current_object, 'WP_User' ) 630 && current_user_can( 'edit_user', $current_object->ID ) 631 && $edit_user_link = get_edit_user_link( $current_object->ID ) ) 632 { 633 $wp_admin_bar->add_menu( array( 634 'id' => 'edit', 635 'title' => __( 'Edit User' ), 636 'href' => $edit_user_link, 637 ) ); 618 638 } 619 639 } 620 640 }