Skip to:
Content

BuddyPress.org

Ticket #8588: 8588.2.patch

File 8588.2.patch, 35.5 KB (added by oztaser, 4 years ago)
  • src/bp-core/admin/bp-core-admin-components.php

    diff --git src/bp-core/admin/bp-core-admin-components.php src/bp-core/admin/bp-core-admin-components.php
    index cfa810264..15f44111e 100644
    defined( 'ABSPATH' ) || exit; 
    1717 *
    1818 */
    1919function bp_core_admin_components_settings() {
    20 ?>
    21 
    22         <div class="wrap">
     20        bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Components', 'buddypress' ) );
     21        ?>
    2322
    24                 <h1 class="wp-heading-inline"><?php _e( 'BuddyPress Settings', 'buddypress' ); ?> </h1>
    25                 <hr class="wp-header-end">
     23        <div class="buddypress-body">
    2624
    27                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Components', 'buddypress' ) ); ?></h2>
    2825                <form action="" method="post" id="bp-admin-component-form">
    2926
    3027                        <?php bp_core_admin_components_options(); ?>
  • src/bp-core/admin/bp-core-admin-functions.php

    diff --git src/bp-core/admin/bp-core-admin-functions.php src/bp-core/admin/bp-core-admin-functions.php
    index ff5125048..5d301d7ea 100644
    function bp_do_activation_redirect() { 
    390390
    391391/** UI/Styling ****************************************************************/
    392392
     393/**
     394 * Outputs the BP Admin Tabbed header.
     395 *
     396 * @since 10.0.0
     397 *
     398 * @param string $title      The title of the Admin page.
     399 * @param string $active_tab The current displayed tab.
     400 * @param string $context    The context of use for the tabs. Defaults to 'settings'.
     401 *                           Possible values are 'settings' & 'tools'.
     402 */
     403function bp_core_admin_tabbed_screen_header( $title = '', $active_tab = '', $context = 'settings' ) {
     404        $bp = buddypress();
     405
     406        // Globalize the active tab for backcompat purpose.
     407        $bp->admin->active_nav_tab = $active_tab;
     408
     409        /**
     410         * Fires before the output of the BP Admin tabbed screen header.
     411         *
     412         * @since 10.0.0
     413         *
     414         * @param string $active_tab The BP Admin active tab.
     415         * @param string $context    The context of use for the tabs.
     416         */
     417        do_action( 'bp_core_admin_tabbed_screen_header', $active_tab, $context );
     418        ?>
     419        <div class="buddypress-header">
     420                <div class="buddypress-title-section">
     421                        <figure>
     422                                <img src="<?php echo esc_url( buddypress()->plugin_url . 'bp-core/images/bp-logo.svg' ); ?>" alt="<?php echo esc_html( $title ); ?>" />
     423                        </figure>
     424                        <h1><?php echo esc_html( $title ); ?></h1>
     425                </div>
     426                <nav class="buddypress-tabs-wrapper">
     427                        <?php if ( isset( $bp->admin->nav_tabs ) ) : ?>
     428                                <?php foreach ( $bp->admin->nav_tabs as $nav_tab ) : ?>
     429
     430                                        <?php echo $nav_tab; ?>
     431
     432                                <?php endforeach; ?>
     433                        <?php else : ?>
     434                                <?php bp_core_admin_tabs( esc_html( $active_tab ), $context ); ?>
     435                        <?php endif; ?>
     436                </nav>
     437        </div>
     438
     439        <hr class="wp-header-end">
     440        <?php
     441}
     442
    393443/**
    394444 * Output the tabs in the admin area.
    395445 *
    function bp_do_activation_redirect() { 
    400450 * @param string $context    The context of use for the tabs. Defaults to 'settings'.
    401451 *                           Possible values are 'settings' & 'tools'.
    402452 */
    403 function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) {
     453function bp_core_admin_tabs( $active_tab = '', $context = 'settings', $echo = true ) {
    404454        $tabs_html    = '';
    405         $idle_class   = 'nav-tab';
    406         $active_class = 'nav-tab nav-tab-active';
     455        $idle_class   = 'buddypress-nav-tab';
     456        $active_class = 'buddypress-nav-tab active';
    407457
    408458        /**
    409459         * Filters the admin tabs to be displayed.
    function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) { 
    412462         *
    413463         * @param array $value Array of tabs to output to the admin area.
    414464         */
    415         $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) );
     465        $tabs         = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) );
     466        $tabs_html    = array();
    416467
    417468        // Loop through tabs and build navigation.
    418469        foreach ( array_values( $tabs ) as $tab_data ) {
    419                 $is_current = (bool) ( $tab_data['name'] == $active_tab );
    420                 $tab_class  = $is_current ? $active_class : $idle_class;
    421                 $tabs_html .= '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>';
     470                $is_current     = (bool) ( $tab_data['name'] == $active_tab );
     471                $tab_class      = $is_current ? $active_class : $idle_class;
     472                $tabs_html[]    = '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>';
    422473        }
    423474
    424         echo $tabs_html;
     475        if ( ! $echo ) {
     476                return $tabs_html;
     477        }
    425478
     479        echo implode( "\n", $tabs_html );
    426480        /**
    427481         * Fires after the output of tabs for the admin area.
    428482         *
    429483         * @since 1.5.0
    430484         * @since 8.0.0 Adds the `$context` parameter.
     485         * @since 10.0.0 Adds the `$active_tab` parameter.
    431486         *
    432487         * @param string $context The context of use for the tabs.
    433488         */
    434         do_action( 'bp_admin_tabs', $context );
     489        do_action( 'bp_admin_tabs', $context, $active_tab );
     490}
     491
     492/**
     493 * Returns the BP Admin settings tabs.
     494 *
     495 * @since 10.0.0
     496 *
     497 * @param bool $apply_filters Whether to apply filters or not.
     498 * @return array              The BP Admin settings tabs.
     499 */
     500function bp_core_get_admin_settings_tabs( $apply_filters = true ) {
     501        $settings_tabs = array(
     502                '0' => array(
     503                        'id'   => 'bp-components',
     504                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
     505                        'name' => __( 'Components', 'buddypress' ),
     506                ),
     507                '2' => array(
     508                        'id'   => 'bp-settings',
     509                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
     510                        'name' => __( 'Options', 'buddypress' ),
     511                ),
     512                '1' => array(
     513                        'id'   => 'bp-page-settings',
     514                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
     515                        'name' => __( 'Pages', 'buddypress' ),
     516                ),
     517                '3' => array(
     518                        'id'   => 'bp-credits',
     519                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ),
     520                        'name' => __( 'Credits', 'buddypress' ),
     521                ),
     522        );
     523
     524        if ( ! $apply_filters ) {
     525                return $settings_tabs;
     526        }
     527
     528        /**
     529         * Filter here to edit the BP Admin settings tabs.
     530         *
     531         * @since 10.0.0
     532         *
     533         * @param array $settings_tabs The BP Admin settings tabs.
     534         */
     535        return apply_filters( 'bp_core_get_admin_settings_tabs', $settings_tabs );
     536}
     537
     538/**
     539 * Returns the BP Admin tools tabs.
     540 *
     541 * @since 10.0.0
     542 *
     543 * @param bool $apply_filters Whether to apply filters or not.
     544 * @return array              The BP Admin tools tabs.
     545 */
     546function bp_core_get_admin_tools_tabs( $apply_filters = true ) {
     547        $tools_page = 'tools.php';
     548        if ( bp_core_do_network_admin() ) {
     549                $tools_page = 'admin.php';
     550        }
     551
     552        $tools_tabs = array(
     553                '0' => array(
     554                        'id'   => 'bp-tools',
     555                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ),
     556                        'name' => __( 'Repair', 'buddypress' ),
     557                ),
     558                '1' => array(
     559                        'id'   => 'bp-members-invitations',
     560                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-members-invitations' ), $tools_page ) ),
     561                        'name' => __( 'Manage Invitations', 'buddypress' ),
     562                ),
     563                '2' => array(
     564                        'id'   => 'bp-optouts',
     565                        'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-optouts' ), $tools_page ) ),
     566                        'name' => __( 'Manage Opt-outs', 'buddypress' ),
     567                ),
     568        );
     569
     570        if ( ! $apply_filters ) {
     571                return $tools_tabs;
     572        }
     573
     574        /**
     575         * Filter here to edit the BP Admin tools tabs.
     576         *
     577         * @since 10.0.0
     578         *
     579         * @param array $tools_tabs The BP Admin tools tabs.
     580         */
     581        return apply_filters( 'bp_core_get_admin_tools_tabs', $tools_tabs );
    435582}
    436583
    437584/**
    function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) { 
    449596        $tabs = array();
    450597
    451598        if ( 'settings' === $context ) {
    452                 $tabs = array(
    453                         '0' => array(
    454                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ),
    455                                 'name' => __( 'Components', 'buddypress' ),
    456                         ),
    457                         '2' => array(
    458                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ),
    459                                 'name' => __( 'Options', 'buddypress' ),
    460                         ),
    461                         '1' => array(
    462                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ),
    463                                 'name' => __( 'Pages', 'buddypress' ),
    464                         ),
    465                         '3' => array(
    466                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ),
    467                                 'name' => __( 'Credits', 'buddypress' ),
    468                         ),
    469                 );
     599                $tabs = bp_core_get_admin_settings_tabs();
    470600        } elseif ( 'tools' === $context ) {
    471                 $tools_page = 'tools.php';
    472                 if ( bp_core_do_network_admin() ) {
    473                         $tools_page = 'admin.php';
    474                 }
    475 
    476                 $tabs = array(
    477                         '0' => array(
    478                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ),
    479                                 'name' => __( 'Repair', 'buddypress' ),
    480                         ),
    481                         '1' => array(
    482                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-members-invitations' ), $tools_page ) ),
    483                                 'name' => __( 'Manage Invitations', 'buddypress' ),
    484                         ),
    485                         '2' => array(
    486                                 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-optouts' ), $tools_page ) ),
    487                                 'name' => __( 'Manage Opt-outs', 'buddypress' ),
    488                         ),
    489                 );
     601                $tabs = bp_core_get_admin_tools_tabs();
    490602        }
    491603
    492604        /**
    function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) { 
    501613        return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context );
    502614}
    503615
     616/**
     617 * Makes sure plugins using `bp_core_admin_tabs()` to output their custom BP Admin Tabs are well displayed
     618 * inside the 10.0.0 tabbed header.
     619 *
     620 * @since 10.0.0
     621 *
     622 * @param string $context    The context of use for the tabs.
     623 * @param string $active_tab The active tab.
     624 */
     625function bp_backcompat_admin_tabs( $context = '', $active_tab = '' ) {
     626        $bp = buddypress();
     627
     628        // Only add the back compat for Settings or Tools sub pages.
     629        if ( 'settings' !== $context && 'tools' !== $context ) {
     630                return;
     631        }
     632
     633        // Globalize the active tab for backcompat purpose.
     634        if ( ! $bp->admin->active_nav_tab || $active_tab !== $bp->admin->active_nav_tab ) {
     635                _doing_it_wrong(
     636                        'bp_core_admin_tabs()',
     637                        __( 'BuddyPress Settings and Tools Screens are now using a new tabbed header. Please use `bp_core_admin_tabbed_screen_header()` instead of bp_core_admin_tabs() to output tabs.', 'buddypress' ),
     638                        '10.0.0'
     639                );
     640
     641                // Let's try to use JavaScript to force the use of the 10.0.0 Admin tabbed screen header.
     642                wp_enqueue_script(
     643                        'bp-backcompat-admin-tabs',
     644                        sprintf( '%1$sbackcompat-admin-tabs%2$s.js', $bp->admin->js_url, bp_core_get_minified_asset_suffix() ),
     645                        array(),
     646                        bp_get_version(),
     647                        true
     648                );
     649        }
     650}
     651add_action( 'bp_admin_tabs', 'bp_backcompat_admin_tabs', 1, 2 );
     652
    504653/** Help **********************************************************************/
    505654
    506655/**
    add_action( 'wp_ajax_bp_dismiss_notice', 'bp_core_admin_notice_dismiss_callback' 
    12911440 *
    12921441 * @since 2.8.0
    12931442 *
    1294  * @param string $classes CSS classes for the body tag in the admin, a comma separated string.
     1443 * @param string $classes CSS classes for the body tag in the admin, a space separated string.
    12951444 *
    12961445 * @return string
    12971446 */
    12981447function bp_core_admin_body_classes( $classes ) {
    1299         return $classes . ' buddypress';
     1448        $bp = buddypress();
     1449
     1450        $bp_class = ' buddypress';
     1451        if ( isset( $bp->admin->nav_tabs ) && $bp->admin->nav_tabs ) {
     1452                $bp_class .= ' bp-is-tabbed-screen';
     1453        }
     1454
     1455        return $classes . $bp_class;
    13001456}
    13011457add_filter( 'admin_body_class', 'bp_core_admin_body_classes' );
    13021458
  • src/bp-core/admin/bp-core-admin-optouts.php

    diff --git src/bp-core/admin/bp-core-admin-optouts.php src/bp-core/admin/bp-core-admin-optouts.php
    index 2ee4400e0..169039abe 100644
    function bp_core_optouts_admin_index() { 
    316316                $_SERVER['REQUEST_URI']
    317317        );
    318318
     319        bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' );
    319320        ?>
    320321
    321         <div class="wrap">
    322                 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1>
    323                 <hr class="wp-header-end">
    324 
    325                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?></h2>
    326 
     322        <div class="buddypress-body">
    327323                <?php
    328324                if ( $usersearch ) {
    329325                        $num_results = (int) $bp_optouts_list_table->total_items;
    function bp_core_optouts_admin_manage( $action = '' ) { 
    425421                'optouts_' . $action
    426422        );
    427423
     424        bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' );
    428425        ?>
    429426
    430         <div class="wrap">
    431                 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1>
    432                 <hr class="wp-header-end">
    433 
    434                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?></h2>
     427        <div class="buddypress-body">
    435428
    436429                <p><?php echo esc_html( $helper_text ); ?></p>
    437430
  • src/bp-core/admin/bp-core-admin-settings.php

    diff --git src/bp-core/admin/bp-core-admin-settings.php src/bp-core/admin/bp-core-admin-settings.php
    index b37b914ff..023d2cea4 100644
    function bp_core_admin_settings() { 
    288288
    289289        // We're saving our own options, until the WP Settings API is updated to work with Multisite.
    290290        $form_action = add_query_arg( 'page', 'bp-settings', bp_get_admin_url( 'admin.php' ) );
    291 
     291        bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Options', 'buddypress' ) );
    292292        ?>
    293293
    294         <div class="wrap">
    295 
    296                 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?></h1>
    297                 <hr class="wp-header-end">
    298 
    299                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Options', 'buddypress' ) ); ?></h2>
    300 
     294        <div class="buddypress-body">
    301295                <form action="<?php echo esc_url( $form_action ) ?>" method="post">
    302296
    303297                        <?php settings_fields( 'buddypress' ); ?>
  • src/bp-core/admin/bp-core-admin-slugs.php

    diff --git src/bp-core/admin/bp-core-admin-slugs.php src/bp-core/admin/bp-core-admin-slugs.php
    index d116eef9b..2dcf86146 100644
    defined( 'ABSPATH' ) || exit; 
    1717 * @todo Use settings API
    1818 */
    1919function bp_core_admin_slugs_settings() {
     20        bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Pages', 'buddypress' ) );
    2021?>
    2122
    22         <div class="wrap">
    23 
    24                 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?> </h1>
    25                 <hr class="wp-header-end">
    26 
    27                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Pages', 'buddypress' ) ); ?></h2>
     23        <div class="buddypress-body">
    2824                <form action="" method="post" id="bp-admin-page-form">
    2925
    3026                        <?php bp_core_admin_slugs_options(); ?>
  • src/bp-core/admin/bp-core-admin-tools.php

    diff --git src/bp-core/admin/bp-core-admin-tools.php src/bp-core/admin/bp-core-admin-tools.php
    index bd2a2d3f8..342eb82f2 100644
    defined( 'ABSPATH' ) || exit; 
    1616 * @since 2.0.0
    1717 */
    1818function bp_core_admin_tools() {
     19        bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Repair', 'buddypress' ), 'tools' );
    1920        ?>
    20         <div class="wrap">
    21 
    22                 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Tools', 'buddypress' ) ?></h1>
    23                 <hr class="wp-header-end">
    24 
    25                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Repair', 'buddypress' ), 'tools' ); ?></h2>
     21        <div class="buddypress-body">
    2622
    2723                <p><?php esc_html_e( 'BuddyPress keeps track of various relationships between members, groups, and activity items.', 'buddypress' ); ?></p>
    2824                <p><?php esc_html_e( 'Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?></p>
  • src/bp-core/admin/css/common-rtl.css

    diff --git src/bp-core/admin/css/common-rtl.css src/bp-core/admin/css/common-rtl.css
    index 0b52dac9f..502dc5b23 100644
    TABLE OF CONTENTS: 
    120120        margin-left: 10px;
    121121        padding-bottom: 15px;
    122122        height: 70px;
    123         width: 280px;
     123        width: 250px;
    124124}
    125125
    126126.bp-about-wrap .compact .wp-person {
    127127        height: auto;
    128         width: 180px;
     128        width: 150px;
    129129        padding-bottom: 0;
    130130        margin-bottom: 0;
    131131}
    body.post-type-bp-email .categorydiv label { 
    556556#buddypress-update.not-shiny .update-message:before {
    557557        content: "\f534";
    558558}
     559
     560/*------------------------------------------------------------------------------
     561 * 7.0 Admins page with tabbed nav.
     562 *----------------------------------------------------------------------------*/
     563body.bp-is-tabbed-screen #wpcontent {
     564        padding-right: 0;
     565}
     566
     567.buddypress-header {
     568        text-align: center;
     569        margin: 0 0 1rem;
     570        background: #fff;
     571        border-bottom: 1px solid #dcdcde;
     572}
     573
     574.buddypress-title-section {
     575        display: flex;
     576        align-items: center;
     577        justify-content: center;
     578        flex-direction: column;
     579        clear: both;
     580        padding: 1rem 0;
     581}
     582
     583.buddypress-title-section h1 {
     584        display: inline-block;
     585        font-weight: 600;
     586        margin: 0 0.8rem;
     587        font-size: 23px;
     588        padding: 9px 0 4px;
     589        line-height: 1.3;
     590}
     591
     592.buddypress-tabs-wrapper {
     593
     594        /* IE 11 */
     595        display: -ms-inline-grid;
     596        -ms-grid-columns: 1fr 1fr;
     597        vertical-align: top;
     598
     599        /* modern browsers */
     600        display: inline-grid; /* stylelint-disable-line declaration-block-no-duplicate-properties */
     601        grid-template-columns: 1fr 1fr;
     602}
     603
     604.buddypress-tabs-wrapper .buddypress-nav-tab {
     605        display: block;
     606        text-decoration: none;
     607        color: inherit;
     608        padding: 0.5rem 1rem 1rem;
     609        margin: 0 1rem;
     610        transition: box-shadow 0.5s ease-in-out;
     611}
     612
     613.buddypress-tabs-wrapper .buddypress-nav-tab.active {
     614        box-shadow: inset 0 -3px #3582c4;
     615        font-weight: 600;
     616}
     617
     618.buddypress-body {
     619        max-width: 800px;
     620        margin: 0 auto;
     621}
     622
     623.buddypress-body .form-table {
     624        border: 1px solid #dcdcde;
     625        background-color: #fff;
     626        padding: .5rem 1rem;
     627        border-collapse: inherit;
     628}
     629
     630/* Media queries */
     631@media screen and (max-width: 782px) {
     632        .buddypress-body {
     633                margin: 0 12px;
     634                width: auto;
     635        }
     636}
     637
     638@media only screen and (max-width: 1004px) {
     639        .buddypress-body {
     640                margin: 0 22px;
     641                width: auto;
     642        }
     643}
     644 No newline at end of file
  • src/bp-core/admin/css/common.css

    diff --git src/bp-core/admin/css/common.css src/bp-core/admin/css/common.css
    index 72d8f8803..6a13fc15f 100644
    TABLE OF CONTENTS: 
    120120        margin-right: 10px;
    121121        padding-bottom: 15px;
    122122        height: 70px;
    123         width: 280px;
     123        width: 250px;
    124124}
    125125
    126126.bp-about-wrap .compact .wp-person {
    127127        height: auto;
    128         width: 180px;
     128        width: 150px;
    129129        padding-bottom: 0;
    130130        margin-bottom: 0;
    131131}
    body.post-type-bp-email .categorydiv label { 
    556556#buddypress-update.not-shiny .update-message:before {
    557557        content: "\f534";
    558558}
     559
     560/*------------------------------------------------------------------------------
     561 * 7.0 Admins page with tabbed nav.
     562 *----------------------------------------------------------------------------*/
     563body.bp-is-tabbed-screen #wpcontent {
     564        padding-left: 0;
     565}
     566
     567.buddypress-header {
     568        text-align: center;
     569        margin: 0 0 1rem;
     570        background: #fff;
     571        border-bottom: 1px solid #dcdcde;
     572}
     573
     574.buddypress-title-section {
     575        display: flex;
     576        align-items: center;
     577        justify-content: center;
     578        flex-direction: column;
     579        clear: both;
     580        padding: 1rem 0;
     581}
     582
     583.buddypress-title-section h1 {
     584        display: inline-block;
     585        font-weight: 600;
     586        margin: 0 0.8rem;
     587        font-size: 23px;
     588        padding: 9px 0 4px;
     589        line-height: 1.3;
     590}
     591
     592.buddypress-title-section figure {
     593        margin: 0;
     594}
     595.buddypress-title-section figure img {
     596        width: 90px;
     597}
     598
     599.buddypress-tabs-wrapper {
     600
     601        /* IE 11 */
     602        display: -ms-inline-grid;
     603        -ms-grid-columns: 1fr 1fr;
     604        vertical-align: top;
     605
     606        /* modern browsers */
     607        display: inline-grid; /* stylelint-disable-line declaration-block-no-duplicate-properties */
     608        grid-template-columns: 1fr 1fr;
     609}
     610
     611.buddypress-tabs-wrapper .buddypress-nav-tab {
     612        display: block;
     613        text-decoration: none;
     614        color: inherit;
     615        padding: 0.5rem 1rem 1rem;
     616        margin: 0 1rem;
     617        transition: box-shadow 0.5s ease-in-out;
     618}
     619
     620.buddypress-tabs-wrapper .buddypress-nav-tab.active {
     621        box-shadow: inset 0 -3px #3582c4;
     622        font-weight: 600;
     623}
     624
     625.buddypress-body {
     626        max-width: 800px;
     627        margin: 0 auto;
     628}
     629
     630.buddypress-body .form-table {
     631        border: 1px solid #dcdcde;
     632        background-color: #fff;
     633        padding: .5rem 1rem;
     634        border-collapse: inherit;
     635}
     636
     637/* Media queries */
     638@media screen and (max-width: 782px) {
     639        .buddypress-body {
     640                margin: 0 12px;
     641                width: auto;
     642        }
     643}
     644
     645@media only screen and (max-width: 1004px) {
     646        .buddypress-body {
     647                margin: 0 22px;
     648                width: auto;
     649        }
     650}
     651 No newline at end of file
  • new file src/bp-core/admin/js/backcompat-admin-tabs.js

    diff --git src/bp-core/admin/js/backcompat-admin-tabs.js src/bp-core/admin/js/backcompat-admin-tabs.js
    new file mode 100644
    index 000000000..c8b31c732
    - +  
     1( function() {
     2        var bpBackCompatAdminTabs = function() {
     3                var wrap = document.querySelector( '.nav-tab-wrapper' ).closest( '.wrap' );
     4
     5                if ( wrap ) {
     6                        // 1. Add the tabbed class to the body tag.
     7                        document.body.classList.add( 'bp-is-tabbed-screen' );
     8
     9                        // 2. Make the wrapping div the BuddyPress body.
     10                        wrap.classList.add( 'buddypress-body' );
     11                        wrap.classList.remove( 'wrap' );
     12
     13                        // 3. Create the BuddyPress header.
     14                        var buddypressHeader = document.createElement( 'div' );
     15                        buddypressHeader.classList.add( 'buddypress-header' );
     16
     17                        var headings = wrap.querySelectorAll( 'h1' );
     18                        var buddypressTitleSection = document.createElement( 'div' );
     19                        buddypressTitleSection.classList.add( 'buddypress-title-section' );
     20
     21                        // 4. Move the document title in it.
     22                        if ( headings && headings[0] ) {
     23                                buddypressTitleSection.appendChild( headings[0] );
     24                        }
     25
     26                        buddypressHeader.appendChild( buddypressTitleSection );
     27
     28                        // 5. Move the tabs in it.
     29                        var headerNavTabs = document.createElement( 'nav' );
     30                        headerNavTabs.classList.add( 'buddypress-tabs-wrapper' );
     31
     32                        var bpAdminTabs = document.querySelectorAll( '.buddypress-nav-tab' );
     33                        var columns = [];
     34                        bpAdminTabs.forEach( function( tabItem ) {
     35                                headerNavTabs.appendChild( tabItem );
     36                                columns.push( '1fr' );
     37                        } );
     38
     39                        // 6. Add the header's nav tabs into the header.
     40                        buddypressHeader.appendChild( headerNavTabs );
     41
     42                        // 7. Edit the number of grid columns.
     43                        if ( columns.length > 0 ) {
     44                                headerNavTabs.setAttribute( 'style', '-ms-grid-columns: ' + columns.join( ' ' ) + '; grid-template-columns: ' + columns.join( ' ' ) + ';');
     45                        }
     46
     47                        // 8. Create the header's separator.
     48                        var headerSeparator = document.createElement( 'hr' );
     49                        headerSeparator.classList.add( 'wp-header-end' );
     50
     51                        // 9. Insert the BuddyPress header into the document.
     52                        document.querySelector('#wpbody-content').insertBefore( buddypressHeader, wrap );
     53                        document.querySelector('#wpbody-content').insertBefore( headerSeparator, wrap );
     54                }
     55        };
     56
     57        if ( 'loading' === document.readyState ) {
     58                document.addEventListener( 'DOMContentLoaded', bpBackCompatAdminTabs );
     59        } else {
     60                bpBackCompatAdminTabs;
     61        }
     62} )();
  • src/bp-core/classes/class-bp-admin.php

    diff --git src/bp-core/classes/class-bp-admin.php src/bp-core/classes/class-bp-admin.php
    index ee80328cc..b24b97701 100644
    class BP_Admin { 
    7575         */
    7676        public $notices = array();
    7777
     78        /**
     79         * BuddyPress admin screens nav tabs.
     80         *
     81         * @since 10.0.0
     82         * @var array()
     83         */
     84        public $nav_tabs = array();
     85
     86        /**
     87         * BuddyPress admin active nav tab.
     88         *
     89         * @since 10.0.0
     90         * @var string()
     91         */
     92        public $active_nav_tab = '';
     93
     94        /**
     95         * BuddyPress admin screens submenu pages.
     96         *
     97         * @since 10.0.0
     98         * @var array()
     99         */
     100        public $submenu_pages = array();
     101
    78102        /** Methods ***************************************************************/
    79103
    80104        /**
    class BP_Admin { 
    229253                );
    230254
    231255                // Add the option pages.
    232                 $hooks[] = add_submenu_page(
     256                $bp_components_page = add_submenu_page(
    233257                        $this->settings_page,
    234258                        __( 'BuddyPress Components', 'buddypress' ),
    235259                        __( 'BuddyPress', 'buddypress' ),
    class BP_Admin { 
    238262                        'bp_core_admin_components_settings'
    239263                );
    240264
    241                 $hooks[] = add_submenu_page(
     265                $this->submenu_pages['settings']['bp-components'] = $bp_components_page;
     266                $hooks[]                                          = $bp_components_page;
     267
     268                $bp_page_settings_page = add_submenu_page(
    242269                        $this->settings_page,
    243270                        __( 'BuddyPress Pages', 'buddypress' ),
    244271                        __( 'BuddyPress Pages', 'buddypress' ),
    class BP_Admin { 
    247274                        'bp_core_admin_slugs_settings'
    248275                );
    249276
    250                 $hooks[] = add_submenu_page(
     277                $this->submenu_pages['settings']['bp-page-settings'] = $bp_page_settings_page;
     278                $hooks[]                                             = $bp_page_settings_page;
     279
     280                $bp_settings_page = add_submenu_page(
    251281                        $this->settings_page,
    252282                        __( 'BuddyPress Options', 'buddypress' ),
    253283                        __( 'BuddyPress Options', 'buddypress' ),
    class BP_Admin { 
    256286                        'bp_core_admin_settings'
    257287                );
    258288
     289                $this->submenu_pages['settings']['bp-settings'] = $bp_settings_page;
     290                $hooks[]                                        = $bp_settings_page;
     291
    259292                // Credits.
    260                 $hooks[] = add_submenu_page(
     293                $bp_credits_page = add_submenu_page(
    261294                        $this->settings_page,
    262295                        __( 'BuddyPress Credits', 'buddypress' ),
    263296                        __( 'BuddyPress Credits', 'buddypress' ),
    class BP_Admin { 
    266299                        array( $this, 'credits_screen' )
    267300                );
    268301
     302                $this->submenu_pages['settings']['bp-credits'] = $bp_credits_page;
     303                $hooks[]                                       = $bp_credits_page;
     304
    269305                // For consistency with non-Multisite, we add a Tools menu in
    270306                // the Network Admin as a home for our Tools panel.
    271307                if ( is_multisite() && bp_core_do_network_admin() ) {
    class BP_Admin { 
    293329                        $tools_parent = 'tools.php';
    294330                }
    295331
    296                 $hooks[] = add_submenu_page(
     332                // Init the Tools submenu pages global.
     333                $this->submenu_pages['tools'] = array();
     334
     335                $bp_repair_tools = add_submenu_page(
    297336                        $tools_parent,
    298337                        __( 'BuddyPress Tools', 'buddypress' ),
    299338                        __( 'BuddyPress', 'buddypress' ),
    class BP_Admin { 
    302341                        'bp_core_admin_tools'
    303342                );
    304343
    305                 $hooks[] = add_submenu_page(
     344                $this->submenu_pages['tools']['bp-tools'] = $bp_repair_tools;
     345                $hooks[]                                  = $bp_repair_tools;
     346
     347                $bp_optouts_tools = add_submenu_page(
    306348                        $tools_parent,
    307349                        __( 'Manage Opt-outs', 'buddypress' ),
    308350                        __( 'Manage Opt-outs', 'buddypress' ),
    class BP_Admin { 
    311353                        'bp_core_optouts_admin'
    312354                );
    313355
     356                $this->submenu_pages['tools']['bp-optouts'] = $bp_optouts_tools;
     357                $hooks[]                                    = $bp_optouts_tools;
     358
    314359                // For network-wide configs, add a link to (the root site's) Emails screen.
    315360                if ( is_network_admin() && bp_is_network_activated() ) {
    316361                        $email_labels = bp_get_email_post_type_labels();
    class BP_Admin { 
    333378                foreach( $hooks as $hook ) {
    334379                        add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
    335380                }
     381
     382                /**
     383                 * Fires before adding inline styles for BP Admin tabs.
     384                 *
     385                 * @since 10.0.0
     386                 *
     387                 * @param array $submenu_pages The BP_Admin submenu pages passed by reference?
     388                 */
     389                do_action_ref_array( 'bp_admin_submenu_pages', array( &$this->submenu_pages ) );
     390
     391                foreach( $this->submenu_pages as $subpage_hooks ) {
     392                        foreach ( $subpage_hooks as $subpage_hook ) {
     393                                add_action( "admin_print_styles-{$subpage_hook}", array( $this, 'add_inline_styles' ), 20 );
     394                        }
     395                }
    336396        }
    337397
    338398        /**
    class BP_Admin { 
    810870         * @since 1.7.0
    811871         */
    812872        public function credits_screen() {
     873                bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Credits', 'buddypress' ) );
    813874        ?>
    814875
    815                 <div class="wrap bp-about-wrap">
    816 
    817                 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Settings', 'buddypress' ); ?></h1>
    818                 <hr class="wp-header-end">
    819 
    820                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( esc_html__( 'Credits', 'buddypress' ) ); ?></h2>
     876                <div class="buddypress-body bp-about-wrap">
    821877
    822878                        <p class="about-description"><?php esc_html_e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p>
    823879
    class BP_Admin { 
    12241280                        wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] );
    12251281                }
    12261282        }
     1283
     1284        /**
     1285         * Adds inline styles to adapt the number of grid columns according to the number of BP Admin tabs.
     1286         *
     1287         * @since 10.0.0
     1288         */
     1289        public function add_inline_styles() {
     1290                $screen                  = get_current_screen();
     1291                $current_settings_tab_id = array_search( $screen->id, $this->submenu_pages['settings'], true );
     1292                $current_tools_tab_id    = array_search( $screen->id, $this->submenu_pages['tools'], true );
     1293                $current_tab_id          = '';
     1294                $tabs                    = array();
     1295                $context                 = '';
     1296
     1297                if ( $current_settings_tab_id ) {
     1298                        $current_tab_id = $current_settings_tab_id;
     1299                        $tabs           = wp_list_pluck( bp_core_get_admin_settings_tabs(), 'name', 'id' );
     1300                        $context        = 'settings';
     1301                } elseif ( $current_tools_tab_id ) {
     1302                        $current_tab_id = $current_tools_tab_id;
     1303                        $tabs           = wp_list_pluck( bp_core_get_admin_tools_tabs(), 'name', 'id' );
     1304                        $context        = 'tools';
     1305                }
     1306
     1307                if ( $current_tab_id && isset( $tabs[ $current_tab_id ] ) ) {
     1308                        $this->nav_tabs = bp_core_admin_tabs( $tabs[ $current_tab_id ], $context, false );
     1309                        $grid_columns   = array_fill( 0, count( $this->nav_tabs ), '1fr');
     1310                        $help_tab_css   = '';
     1311
     1312                        if ( $screen->get_help_tabs() ) {
     1313                                $help_tab_css  = '#screen-meta { margin-right: 0; } #screen-meta-links { position: absolute; right: 0; }';
     1314                        }
     1315
     1316                        wp_add_inline_style(
     1317                                'bp-admin-common-css',
     1318                                sprintf(
     1319                                        '.buddypress-tabs-wrapper {
     1320                                                -ms-grid-columns: %1$s;
     1321                                                grid-template-columns: %1$s;
     1322                                        }
     1323                                        %2$s',
     1324                                        implode( " ", $grid_columns ),
     1325                                        $help_tab_css
     1326                                )
     1327                        );
     1328                }
     1329        }
    12271330}
    12281331endif; // End class_exists check.
  • new file src/bp-core/images/bp-logo.svg

    diff --git src/bp-core/images/bp-logo.svg src/bp-core/images/bp-logo.svg
    new file mode 100644
    index 000000000..09cdcb66e
    - +  
     1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" preserveAspectRatio="xMidYMid meet" enable-background="new 0 0 128 128"><g transform="translate(0,-924.36218)"><path d="m 126.5,988.37986 a 62.5,62.5 0 0 1 -124.999995,0 62.5,62.5 0 1 1 124.999995,0 z" style="fill:#ffffff" /><g transform="matrix(0.02335871,0,0,-0.02334121,-0.11965895,1052.4471)" style="fill:#d84800"><path d="M 2515,5484 C 1798,5410 1171,5100 717,4595 332,4168 110,3689 23,3105 -1,2939 -1,2554 24,2385 111,1783 363,1266 774,842 1492,102 2529,-172 3521,116 c 448,130 858,379 1195,726 413,426 667,949 751,1548 24,173 24,548 -1,715 -91,625 -351,1150 -781,1580 -425,425 -943,685 -1555,780 -101,16 -520,29 -615,19 z m 611,-143 C 4158,5186 4999,4440 5275,3435 5501,2611 5302,1716 4747,1055 4319,547 3693,214 3028,141 c -125,-14 -441,-14 -566,0 -140,15 -338,55 -468,95 C 722,621 -58,1879 161,3188 c 41,249 115,474 234,717 310,631 860,1110 1528,1330 213,70 374,102 642,129 96,10 436,-4 561,-23 z" /><path d="M 2575,5090 C 1629,5020 813,4386 516,3490 384,3089 362,2641 456,2222 643,1386 1307,696 2134,479 c 233,-61 337,-73 611,-73 274,0 378,12 611,73 548,144 1038,500 1357,986 193,294 315,629 363,995 20,156 15,513 -10,660 -42,241 -108,448 -215,665 -421,857 -1325,1375 -2276,1305 z m 820,-491 c 270,-48 512,-261 608,-537 26,-76 31,-104 35,-222 4,-115 1,-149 -17,-220 -62,-250 -237,-457 -467,-553 -63,-27 -134,-48 -134,-41 0,2 15,35 34,72 138,274 138,610 0,883 -110,220 -334,412 -564,483 -30,10 -62,20 -70,23 -21,7 77,56 175,88 126,41 255,49 400,24 z m -610,-285 c 310,-84 541,-333 595,-641 18,-101 8,-278 -20,-368 -75,-236 -220,-401 -443,-505 -109,-51 -202,-70 -335,-70 -355,0 -650,217 -765,563 -28,84 -31,104 -31,232 -1,118 3,152 22,220 89,306 335,528 650,585 67,13 257,3 327,-16 z M 4035,2940 c 301,-95 484,-325 565,-710 21,-103 47,-388 37,-414 -6,-14 -30,-16 -182,-16 -96,0 -175,3 -175,6 0,42 -37,236 -60,313 -99,334 -315,586 -567,661 -24,7 -43,17 -43,21 0,5 32,45 72,90 l 72,82 106,-6 c 67,-3 130,-13 175,-27 z m -1703,-510 258,-255 92,90 c 51,49 183,178 293,286 l 200,197 75,-9 c 207,-26 404,-116 547,-252 170,-161 267,-361 308,-632 15,-100 21,-394 9,-454 l -6,-31 -1519,0 c -1074,0 -1520,3 -1524,11 -14,21 -18,297 -6,407 59,561 364,896 866,950 97,10 55,41 407,-308 z" /></g></g></svg>
     2 No newline at end of file
  • src/bp-members/classes/class-bp-members-admin.php

    diff --git src/bp-members/classes/class-bp-members-admin.php src/bp-members/classes/class-bp-members-admin.php
    index 8027051b1..9f5b822f0 100644
    class BP_Members_Admin { 
    149149                if ( ! empty( $this->subsite_activated ) ) {
    150150                        $this->capability = 'manage_network_users';
    151151                }
     152
     153                /*
     154                 * For consistency with non-Multisite, we add a Tools menu in
     155                 * the Network Admin as a home for our Tools panel.
     156                 */
     157                if ( is_multisite() && bp_core_do_network_admin() ) {
     158                        $this->tools_parent = 'network-tools';
     159                } else {
     160                        $this->tools_parent = 'tools.php';
     161                }
    152162        }
    153163
    154164        /**
    class BP_Members_Admin { 
    246256                        // Filter WP admin users list table to include users of the specified type.
    247257                        add_filter( 'pre_get_users', array( $this, 'users_table_filter_by_type' ) );
    248258                }
     259
     260                // Add the Members invitations submenu page to the tools submenu pages.
     261                add_action( 'bp_admin_submenu_pages', array( $this, 'set_submenu_page' ), 10, 1 );
    249262        }
    250263
    251264        /**
    class BP_Members_Admin { 
    501514                        );
    502515                }
    503516
    504                 // For consistency with non-Multisite, we add a Tools menu in
    505                 // the Network Admin as a home for our Tools panel.
    506                 if ( is_multisite() && bp_core_do_network_admin() ) {
    507                         $tools_parent = 'network-tools';
    508                 } else {
    509                         $tools_parent = 'tools.php';
    510                 }
    511 
    512517                $hooks['members_invitations'] = $this->members_invites_page = add_submenu_page(
    513                         $tools_parent,
     518                        $this->tools_parent,
    514519                        __( 'Manage Invitations',  'buddypress' ),
    515520                        __( 'Manage Invitations',  'buddypress' ),
    516521                        $this->capability,
    class BP_Members_Admin { 
    562567                add_action( "admin_head-{$this->members_invites_page}", 'bp_core_modify_admin_menu_highlight' );
    563568        }
    564569
     570        /**
     571         * Include the Members Invitations tab to the Admin tabs needing specific inline styles.
     572         *
     573         * @since 10.0.0
     574         *
     575         * @param array $submenu_pages The BP_Admin submenu pages passed by reference.
     576         */
     577        public function set_submenu_page( &$submenu_pages ) {
     578                if ( isset( $submenu_pages['tools'] ) ) {
     579                        $submenu_pages['tools']['bp-members-invitations'] = get_plugin_page_hookname( 'bp-members-invitations', $this->tools_parent );
     580                }
     581        }
     582
    565583        /**
    566584         * Highlight the Users menu if on Edit Profile and check if on the user's admin profile.
    567585         *
    class BP_Members_Admin { 
    29903008                        ), $_SERVER['REQUEST_URI']
    29913009                );
    29923010
     3011                bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Invitations', 'buddypress' ), 'tools' );
    29933012                ?>
    29943013
    2995                 <div class="wrap">
    2996                         <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1>
    2997                         <hr class="wp-header-end">
    2998 
    2999                         <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Invitations', 'buddypress' ), 'tools' ); ?></h2>
    3000 
     3014                <div class="buddypress-body">
    30013015                        <?php
    30023016                        if ( $usersearch ) {
    30033017                                printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;', 'buddypress' ) . '</span>', esc_html( $usersearch ) );
    class BP_Members_Admin { 
    31113125                        'invitations_' . $action
    31123126                );
    31133127
     3128                bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Invitations', 'buddypress' ), 'tools' );
    31143129                ?>
    31153130
    3116                 <div class="wrap">
    3117                         <h1 class="wp-heading-inline"><?php echo esc_html( $header_text ); ?></h1>
    3118                         <hr class="wp-header-end">
     3131                <div class="buddypress-body">
     3132                        <h2><?php echo esc_html( $header_text ); ?></h2>
    31193133
    31203134                        <p><?php echo esc_html( $helper_text ); ?></p>
    31213135