Make WordPress Core

Ticket #49040: 49040.diff

File 49040.diff, 1.1 KB (added by henry.wright, 5 years ago)
  • wp-includes/admin-bar.php

    diff --git wp-includes/admin-bar.php wp-includes/admin-bar.php
    index 77ab5848ee..3c3a116535 100644
    function wp_admin_bar_new_content_menu( $wp_admin_bar ) { 
    849849                $actions['post-new.php?post_type=content'][1] = 'add-new-content';
    850850        }
    851851
     852        if ( current_user_can( 'create_sites' ) && is_multisite() ) {
     853                $actions['wp-login.php?action=register'] = array( _x( 'Site', 'add new from admin bar' ), 'new-site' );
     854        }
     855
    852856        if ( current_user_can( 'create_users' ) || ( is_multisite() && current_user_can( 'promote_users' ) ) ) {
    853857                $actions['user-new.php'] = array( _x( 'User', 'add new from admin bar' ), 'new-user' );
    854858        }
    function wp_admin_bar_new_content_menu( $wp_admin_bar ) { 
    870874        foreach ( $actions as $link => $action ) {
    871875                list( $title, $id ) = $action;
    872876
     877                if ( 'new-site' === $id ) {
     878                        $href = wp_registration_url();
     879                } else {
     880                        $href = admin_url( $link );
     881                }
     882
    873883                $wp_admin_bar->add_node(
    874884                        array(
    875885                                'parent' => 'new-content',
    876886                                'id'     => $id,
    877887                                'title'  => $title,
    878                                 'href'   => admin_url( $link ),
     888                                'href'   => $href,
    879889                        )
    880890                );
    881891        }