[wp-trac] [WordPress Trac] #17273: Admin Bar Edit link should support Attachments

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 29 10:19:18 UTC 2011


#17273: Admin Bar Edit link should support Attachments
----------------------------+-----------------------
 Reporter:  dd32            |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  3.2
Component:  Administration  |    Version:
 Severity:  normal          |   Keywords:  has-patch
----------------------------+-----------------------
 Currently the Admin bar presents a Edit link for any post type for which
 the user can edit the post and, show_ui = true.

 Attachments pass every check, except due to their inbuilt nature, show_ui
 is false.

 {{{
 #!text/x-diff
 Index: wp-includes/admin-bar.php
 ===================================================================
 --- wp-includes/admin-bar.php   (revision 17764)
 +++ wp-includes/admin-bar.php   (working copy)
 @@ -165,7 +165,7 @@
         if ( empty($current_object) )
                 return;

 -       if ( ! empty( $current_object->post_type ) && ( $post_type_object
 = get_post_type_object( $current_object->post_type ) ) &&
 current_user_can( $post_type_object->cap->edit_post, $current_object->ID )
 && $post_type_object->show_ui ) {
 +       if ( ! empty( $current_object->post_type ) && ( $post_type_object
 = get_post_type_object( $current_object->post_type ) ) &&
 current_user_can( $post_type_object->cap->edit_post, $current_object->ID )
 && ( $post_type_object->show_ui || 'attachment' ==
 $current_object->post_type ) ) {
                 $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' =>
 $post_type_object->labels->edit_item,  'href' => get_edit_post_link(
 $current_object->ID ) ) );
         } elseif ( ! empty( $current_object->taxonomy ) &&  ( $tax =
 get_taxonomy( $current_object->taxonomy ) ) && current_user_can(
 $tax->cap->edit_terms ) && $tax->show_ui ) {
                 $wp_admin_bar->add_menu( array( 'id' => 'edit', 'title' =>
 $tax->labels->edit_item, 'href' => get_edit_term_link(
 $current_object->term_id, $current_object->taxonomy ) ) );
 }}}

 Can anyone see a better method other than the above patch?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17273>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list