WordPress.org

Make WordPress Core

Ticket #17516: 17516-2.diff

File 17516-2.diff, 2.0 KB (added by technosailor, 7 years ago)

Dont' do cap check because each action should provide its own checks.

  • wp-includes/admin-bar.php

     
    303303}
    304304
    305305/**
     306 * Displays a dropdown of filterable "quick actions"
     307 *
     308 * @since 3.2.0
     309 */
     310function wp_admin_bar_favorite_actions( $wp_admin_bar ) {
     311        $actions = favorite_actions( null, true );
     312        $wp_admin_bar->add_menu( array( 'id' => 'favorite_actions', 'title' => 'Quick Actions', 'href' => '#' ) );
     313       
     314        foreach( $actions as $slug => $action )
     315                $wp_admin_bar->add_menu( array( 'parent' => 'favorite_actions', 'id' => 'favorite_actions-' . $action, 'title' => __( $action ), 'href' => admin_url( $slug ) ) );
     316       
     317}
     318
     319/**
    306320 * Style and scripts for the admin bar.
    307321 *
    308322 * @since 3.1.0
  • wp-includes/class-wp-admin-bar.php

     
    184184                add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
    185185                add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
    186186                add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
     187                add_action( 'admin_bar_menu', 'wp_admin_bar_favorite_actions', 90 );
    187188
    188189                if ( !is_network_admin() && !is_user_admin() ) {
    189190                        add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
  • wp-admin/includes/template.php

     
    13931393 *
    13941394 * @since 2.7.0
    13951395 */
    1396 function favorite_actions( $screen = null ) {
     1396function favorite_actions( $screen = null, $return = false ) {
    13971397        $default_action = false;
    13981398
    13991399        if ( is_string($screen) )
     
    14831483
    14841484        if ( empty($allowed_actions) )
    14851485                return;
     1486               
     1487        if( $return )
     1488                return $allowed_actions;
    14861489
    14871490        $first = array_keys($allowed_actions);
    14881491        $first = $first[0];