Ticket #19541: admin_bar_create_content.patch
| File admin_bar_create_content.patch, 1.8 KB (added by , 14 years ago) |
|---|
-
wp-includes/admin-bar.php
473 473 */ 474 474 function wp_admin_bar_new_content_menu( $wp_admin_bar ) { 475 475 $actions = array(); 476 $position = array(); 476 477 477 478 $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' ); 478 479 479 480 if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->edit_posts ) ) { 480 481 $actions[ 'post-new.php' ] = array( $cpts['post']->labels->name_admin_bar, 'new-post' ); 482 $position[] = 5; 481 483 unset( $cpts['post'] ); 482 484 } 483 485 484 if ( current_user_can( 'upload_files' ) ) 486 if ( current_user_can( 'upload_files' ) ) { 485 487 $actions[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'new-media' ); 488 $position[] = 10; 489 } 486 490 487 if ( current_user_can( 'manage_links' ) ) 491 if ( current_user_can( 'manage_links' ) ) { 488 492 $actions[ 'link-add.php' ] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' ); 493 $position[] = 15; 494 } 489 495 490 496 if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->edit_posts ) ) { 491 497 $actions[ 'post-new.php?post_type=page' ] = array( $cpts['page']->labels->name_admin_bar, 'new-page' ); 498 $position[] = 20; 492 499 unset( $cpts['page'] ); 493 500 } 494 501 … … 499 506 500 507 $key = 'post-new.php?post_type=' . $cpt->name; 501 508 $actions[ $key ] = array( $cpt->labels->name_admin_bar, 'new-' . $cpt->name ); 509 $position[] = ( $cpt->menu_position ? $cpt->menu_position + 1 : max( $position ) + 1 ); 502 510 } 503 511 512 // Menu position order 513 array_multisort( $position, $actions ); 514 504 515 if ( current_user_can( 'create_users' ) || current_user_can( 'promote_users' ) ) 505 516 $actions[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), 'new-user' ); 506 517