Ticket #8588: 8588.3.patch
| File 8588.3.patch, 33.4 KB (added by , 5 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; 17 17 * 18 18 */ 19 19 function bp_core_admin_components_settings() { 20 ?> 21 22 <div class="wrap"> 20 bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Components', 'buddypress' ) ); 21 ?> 23 22 24 <h1 class="wp-heading-inline"><?php _e( 'BuddyPress Settings', 'buddypress' ); ?> </h1> 25 <hr class="wp-header-end"> 23 <div class="buddypress-body"> 26 24 27 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Components', 'buddypress' ) ); ?></h2>28 25 <form action="" method="post" id="bp-admin-component-form"> 29 26 30 27 <?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..12284c6eb 100644
function bp_do_activation_redirect() { 390 390 391 391 /** UI/Styling ****************************************************************/ 392 392 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 */ 403 function 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 <h1><span class="bp-badge"></span> <?php echo esc_html( $title ); ?></h1> 422 </div> 423 <nav class="buddypress-tabs-wrapper"> 424 <?php if ( isset( $bp->admin->nav_tabs ) ) : ?> 425 <?php foreach ( $bp->admin->nav_tabs as $nav_tab ) : ?> 426 427 <?php echo $nav_tab; ?> 428 429 <?php endforeach; ?> 430 <?php else : ?> 431 <?php bp_core_admin_tabs( esc_html( $active_tab ), $context ); ?> 432 <?php endif; ?> 433 </nav> 434 </div> 435 436 <hr class="wp-header-end"> 437 <?php 438 } 439 393 440 /** 394 441 * Output the tabs in the admin area. 395 442 * … … function bp_do_activation_redirect() { 400 447 * @param string $context The context of use for the tabs. Defaults to 'settings'. 401 448 * Possible values are 'settings' & 'tools'. 402 449 */ 403 function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) {450 function bp_core_admin_tabs( $active_tab = '', $context = 'settings', $echo = true ) { 404 451 $tabs_html = ''; 405 $idle_class = ' nav-tab';406 $active_class = ' nav-tab nav-tab-active';452 $idle_class = 'buddypress-nav-tab'; 453 $active_class = 'buddypress-nav-tab active'; 407 454 408 455 /** 409 456 * Filters the admin tabs to be displayed. … … function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) { 412 459 * 413 460 * @param array $value Array of tabs to output to the admin area. 414 461 */ 415 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) ); 462 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) ); 463 $tabs_html = array(); 416 464 417 465 // Loop through tabs and build navigation. 418 466 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>';467 $is_current = (bool) ( $tab_data['name'] == $active_tab ); 468 $tab_class = $is_current ? $active_class : $idle_class; 469 $tabs_html[] = '<a href="' . esc_url( $tab_data['href'] ) . '" class="' . esc_attr( $tab_class ) . '">' . esc_html( $tab_data['name'] ) . '</a>'; 422 470 } 423 471 424 echo $tabs_html; 472 if ( ! $echo ) { 473 return $tabs_html; 474 } 425 475 476 echo implode( "\n", $tabs_html ); 426 477 /** 427 478 * Fires after the output of tabs for the admin area. 428 479 * 429 480 * @since 1.5.0 430 481 * @since 8.0.0 Adds the `$context` parameter. 482 * @since 10.0.0 Adds the `$active_tab` parameter. 431 483 * 432 484 * @param string $context The context of use for the tabs. 433 485 */ 434 do_action( 'bp_admin_tabs', $context ); 486 do_action( 'bp_admin_tabs', $context, $active_tab ); 487 } 488 489 /** 490 * Returns the BP Admin settings tabs. 491 * 492 * @since 10.0.0 493 * 494 * @param bool $apply_filters Whether to apply filters or not. 495 * @return array The BP Admin settings tabs. 496 */ 497 function bp_core_get_admin_settings_tabs( $apply_filters = true ) { 498 $settings_tabs = array( 499 '0' => array( 500 'id' => 'bp-components', 501 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ), 502 'name' => __( 'Components', 'buddypress' ), 503 ), 504 '2' => array( 505 'id' => 'bp-settings', 506 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ), 507 'name' => __( 'Options', 'buddypress' ), 508 ), 509 '1' => array( 510 'id' => 'bp-page-settings', 511 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ), 512 'name' => __( 'Pages', 'buddypress' ), 513 ), 514 '3' => array( 515 'id' => 'bp-credits', 516 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ), 517 'name' => __( 'Credits', 'buddypress' ), 518 ), 519 ); 520 521 if ( ! $apply_filters ) { 522 return $settings_tabs; 523 } 524 525 /** 526 * Filter here to edit the BP Admin settings tabs. 527 * 528 * @since 10.0.0 529 * 530 * @param array $settings_tabs The BP Admin settings tabs. 531 */ 532 return apply_filters( 'bp_core_get_admin_settings_tabs', $settings_tabs ); 533 } 534 535 /** 536 * Returns the BP Admin tools tabs. 537 * 538 * @since 10.0.0 539 * 540 * @param bool $apply_filters Whether to apply filters or not. 541 * @return array The BP Admin tools tabs. 542 */ 543 function bp_core_get_admin_tools_tabs( $apply_filters = true ) { 544 $tools_page = 'tools.php'; 545 if ( bp_core_do_network_admin() ) { 546 $tools_page = 'admin.php'; 547 } 548 549 $tools_tabs = array( 550 '0' => array( 551 'id' => 'bp-tools', 552 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-tools' ), $tools_page ) ), 553 'name' => __( 'Repair', 'buddypress' ), 554 ), 555 '1' => array( 556 'id' => 'bp-members-invitations', 557 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-members-invitations' ), $tools_page ) ), 558 'name' => __( 'Manage Invitations', 'buddypress' ), 559 ), 560 '2' => array( 561 'id' => 'bp-optouts', 562 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-optouts' ), $tools_page ) ), 563 'name' => __( 'Manage Opt-outs', 'buddypress' ), 564 ), 565 ); 566 567 if ( ! $apply_filters ) { 568 return $tools_tabs; 569 } 570 571 /** 572 * Filter here to edit the BP Admin tools tabs. 573 * 574 * @since 10.0.0 575 * 576 * @param array $tools_tabs The BP Admin tools tabs. 577 */ 578 return apply_filters( 'bp_core_get_admin_tools_tabs', $tools_tabs ); 435 579 } 436 580 437 581 /** … … function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) { 449 593 $tabs = array(); 450 594 451 595 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 ); 596 $tabs = bp_core_get_admin_settings_tabs(); 470 597 } 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 ); 598 $tabs = bp_core_get_admin_tools_tabs(); 490 599 } 491 600 492 601 /** … … function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) { 501 610 return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context ); 502 611 } 503 612 613 /** 614 * Makes sure plugins using `bp_core_admin_tabs()` to output their custom BP Admin Tabs are well displayed 615 * inside the 10.0.0 tabbed header. 616 * 617 * @since 10.0.0 618 * 619 * @param string $context The context of use for the tabs. 620 * @param string $active_tab The active tab. 621 */ 622 function bp_backcompat_admin_tabs( $context = '', $active_tab = '' ) { 623 $bp = buddypress(); 624 625 // Only add the back compat for Settings or Tools sub pages. 626 if ( 'settings' !== $context && 'tools' !== $context ) { 627 return; 628 } 629 630 // Globalize the active tab for backcompat purpose. 631 if ( ! $bp->admin->active_nav_tab || $active_tab !== $bp->admin->active_nav_tab ) { 632 _doing_it_wrong( 633 'bp_core_admin_tabs()', 634 __( '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' ), 635 '10.0.0' 636 ); 637 638 // Let's try to use JavaScript to force the use of the 10.0.0 Admin tabbed screen header. 639 wp_enqueue_script( 640 'bp-backcompat-admin-tabs', 641 sprintf( '%1$sbackcompat-admin-tabs%2$s.js', $bp->admin->js_url, bp_core_get_minified_asset_suffix() ), 642 array(), 643 bp_get_version(), 644 true 645 ); 646 } 647 } 648 add_action( 'bp_admin_tabs', 'bp_backcompat_admin_tabs', 1, 2 ); 649 504 650 /** Help **********************************************************************/ 505 651 506 652 /** … … add_action( 'wp_ajax_bp_dismiss_notice', 'bp_core_admin_notice_dismiss_callback' 1291 1437 * 1292 1438 * @since 2.8.0 1293 1439 * 1294 * @param string $classes CSS classes for the body tag in the admin, a commaseparated string.1440 * @param string $classes CSS classes for the body tag in the admin, a space separated string. 1295 1441 * 1296 1442 * @return string 1297 1443 */ 1298 1444 function bp_core_admin_body_classes( $classes ) { 1299 return $classes . ' buddypress'; 1445 $bp = buddypress(); 1446 1447 $bp_class = ' buddypress'; 1448 if ( isset( $bp->admin->nav_tabs ) && $bp->admin->nav_tabs ) { 1449 $bp_class .= ' bp-is-tabbed-screen'; 1450 } 1451 1452 return $classes . $bp_class; 1300 1453 } 1301 1454 add_filter( 'admin_body_class', 'bp_core_admin_body_classes' ); 1302 1455 -
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() { 316 316 $_SERVER['REQUEST_URI'] 317 317 ); 318 318 319 bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); 319 320 ?> 320 321 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"> 327 323 <?php 328 324 if ( $usersearch ) { 329 325 $num_results = (int) $bp_optouts_list_table->total_items; … … function bp_core_optouts_admin_manage( $action = '' ) { 425 421 'optouts_' . $action 426 422 ); 427 423 424 bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); 428 425 ?> 429 426 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"> 435 428 436 429 <p><?php echo esc_html( $helper_text ); ?></p> 437 430 -
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() { 288 288 289 289 // We're saving our own options, until the WP Settings API is updated to work with Multisite. 290 290 $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' ) ); 292 292 ?> 293 293 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"> 301 295 <form action="<?php echo esc_url( $form_action ) ?>" method="post"> 302 296 303 297 <?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; 17 17 * @todo Use settings API 18 18 */ 19 19 function bp_core_admin_slugs_settings() { 20 bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Pages', 'buddypress' ) ); 20 21 ?> 21 22 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"> 28 24 <form action="" method="post" id="bp-admin-page-form"> 29 25 30 26 <?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; 16 16 * @since 2.0.0 17 17 */ 18 18 function bp_core_admin_tools() { 19 bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Repair', 'buddypress' ), 'tools' ); 19 20 ?> 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"> 26 22 27 23 <p><?php esc_html_e( 'BuddyPress keeps track of various relationships between members, groups, and activity items.', 'buddypress' ); ?></p> 28 24 <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..fe919e5ed 100644
TABLE OF CONTENTS: 35 35 .bp-badge { 36 36 color: #d84800; 37 37 display: inline-block; 38 font: 400 150px/1 dashicons !important;38 font: 400 150px/1 dashicons; 39 39 } 40 40 41 41 .bp-badge:before { … … TABLE OF CONTENTS: 120 120 margin-left: 10px; 121 121 padding-bottom: 15px; 122 122 height: 70px; 123 width: 2 80px;123 width: 250px; 124 124 } 125 125 126 126 .bp-about-wrap .compact .wp-person { 127 127 height: auto; 128 width: 1 80px;128 width: 150px; 129 129 padding-bottom: 0; 130 130 margin-bottom: 0; 131 131 } … … body.post-type-bp-email .categorydiv label { 556 556 #buddypress-update.not-shiny .update-message:before { 557 557 content: "\f534"; 558 558 } 559 560 /*------------------------------------------------------------------------------ 561 * 7.0 Admins page with tabbed nav. 562 *----------------------------------------------------------------------------*/ 563 body.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-title-section h1 .bp-badge { 593 font-size: 32px; 594 vertical-align: top; 595 } 596 597 .buddypress-tabs-wrapper { 598 599 /* IE 11 */ 600 display: -ms-inline-grid; 601 -ms-grid-columns: 1fr 1fr; 602 vertical-align: top; 603 604 /* modern browsers */ 605 display: inline-grid; /* stylelint-disable-line declaration-block-no-duplicate-properties */ 606 grid-template-columns: 1fr 1fr; 607 } 608 609 .buddypress-tabs-wrapper .buddypress-nav-tab { 610 display: block; 611 text-decoration: none; 612 color: inherit; 613 padding: 0.5rem 1rem 1rem; 614 margin: 0 1rem; 615 transition: box-shadow 0.5s ease-in-out; 616 } 617 618 .buddypress-tabs-wrapper .buddypress-nav-tab.active { 619 box-shadow: inset 0 -3px #3582c4; 620 font-weight: 600; 621 } 622 623 .buddypress-body { 624 max-width: 800px; 625 margin: 0 auto; 626 } 627 628 .buddypress-body .form-table { 629 border: 1px solid #dcdcde; 630 background-color: #fff; 631 padding: 0.5rem 1rem; 632 border-collapse: inherit; 633 } 634 635 /* Media queries */ 636 @media screen and (max-width: 782px) { 637 638 .buddypress-body { 639 margin: 0 12px; 640 width: auto; 641 } 642 } 643 644 @media only screen and (max-width: 1004px) { 645 646 .buddypress-body { 647 margin: 0 22px; 648 width: auto; 649 } 650 } -
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..0807929c2 100644
TABLE OF CONTENTS: 35 35 .bp-badge { 36 36 color: #d84800; 37 37 display: inline-block; 38 font: 400 150px/1 dashicons !important;38 font: 400 150px/1 dashicons; 39 39 } 40 40 41 41 .bp-badge:before { … … TABLE OF CONTENTS: 120 120 margin-right: 10px; 121 121 padding-bottom: 15px; 122 122 height: 70px; 123 width: 2 80px;123 width: 250px; 124 124 } 125 125 126 126 .bp-about-wrap .compact .wp-person { 127 127 height: auto; 128 width: 1 80px;128 width: 150px; 129 129 padding-bottom: 0; 130 130 margin-bottom: 0; 131 131 } … … body.post-type-bp-email .categorydiv label { 556 556 #buddypress-update.not-shiny .update-message:before { 557 557 content: "\f534"; 558 558 } 559 560 /*------------------------------------------------------------------------------ 561 * 7.0 Admins page with tabbed nav. 562 *----------------------------------------------------------------------------*/ 563 body.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 h1 .bp-badge { 593 font-size: 32px; 594 vertical-align: top; 595 } 596 597 .buddypress-tabs-wrapper { 598 599 /* IE 11 */ 600 display: -ms-inline-grid; 601 -ms-grid-columns: 1fr 1fr; 602 vertical-align: top; 603 604 /* modern browsers */ 605 display: inline-grid; /* stylelint-disable-line declaration-block-no-duplicate-properties */ 606 grid-template-columns: 1fr 1fr; 607 } 608 609 .buddypress-tabs-wrapper .buddypress-nav-tab { 610 display: block; 611 text-decoration: none; 612 color: inherit; 613 padding: 0.5rem 1rem 1rem; 614 margin: 0 1rem; 615 transition: box-shadow 0.5s ease-in-out; 616 } 617 618 .buddypress-tabs-wrapper .buddypress-nav-tab.active { 619 box-shadow: inset 0 -3px #3582c4; 620 font-weight: 600; 621 } 622 623 .buddypress-body { 624 max-width: 800px; 625 margin: 0 auto; 626 } 627 628 .buddypress-body .form-table { 629 border: 1px solid #dcdcde; 630 background-color: #fff; 631 padding: 0.5rem 1rem; 632 border-collapse: inherit; 633 } 634 635 /* Media queries */ 636 @media screen and (max-width: 782px) { 637 638 .buddypress-body { 639 margin: 0 12px; 640 width: auto; 641 } 642 } 643 644 @media only screen and (max-width: 1004px) { 645 646 .buddypress-body { 647 margin: 0 22px; 648 width: auto; 649 } 650 } -
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 index e69de29bb..c8b31c732 100644
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 { 75 75 */ 76 76 public $notices = array(); 77 77 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 78 102 /** Methods ***************************************************************/ 79 103 80 104 /** … … class BP_Admin { 229 253 ); 230 254 231 255 // Add the option pages. 232 $ hooks[]= add_submenu_page(256 $bp_components_page = add_submenu_page( 233 257 $this->settings_page, 234 258 __( 'BuddyPress Components', 'buddypress' ), 235 259 __( 'BuddyPress', 'buddypress' ), … … class BP_Admin { 238 262 'bp_core_admin_components_settings' 239 263 ); 240 264 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( 242 269 $this->settings_page, 243 270 __( 'BuddyPress Pages', 'buddypress' ), 244 271 __( 'BuddyPress Pages', 'buddypress' ), … … class BP_Admin { 247 274 'bp_core_admin_slugs_settings' 248 275 ); 249 276 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( 251 281 $this->settings_page, 252 282 __( 'BuddyPress Options', 'buddypress' ), 253 283 __( 'BuddyPress Options', 'buddypress' ), … … class BP_Admin { 256 286 'bp_core_admin_settings' 257 287 ); 258 288 289 $this->submenu_pages['settings']['bp-settings'] = $bp_settings_page; 290 $hooks[] = $bp_settings_page; 291 259 292 // Credits. 260 $ hooks[]= add_submenu_page(293 $bp_credits_page = add_submenu_page( 261 294 $this->settings_page, 262 295 __( 'BuddyPress Credits', 'buddypress' ), 263 296 __( 'BuddyPress Credits', 'buddypress' ), … … class BP_Admin { 266 299 array( $this, 'credits_screen' ) 267 300 ); 268 301 302 $this->submenu_pages['settings']['bp-credits'] = $bp_credits_page; 303 $hooks[] = $bp_credits_page; 304 269 305 // For consistency with non-Multisite, we add a Tools menu in 270 306 // the Network Admin as a home for our Tools panel. 271 307 if ( is_multisite() && bp_core_do_network_admin() ) { … … class BP_Admin { 293 329 $tools_parent = 'tools.php'; 294 330 } 295 331 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( 297 336 $tools_parent, 298 337 __( 'BuddyPress Tools', 'buddypress' ), 299 338 __( 'BuddyPress', 'buddypress' ), … … class BP_Admin { 302 341 'bp_core_admin_tools' 303 342 ); 304 343 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( 306 348 $tools_parent, 307 349 __( 'Manage Opt-outs', 'buddypress' ), 308 350 __( 'Manage Opt-outs', 'buddypress' ), … … class BP_Admin { 311 353 'bp_core_optouts_admin' 312 354 ); 313 355 356 $this->submenu_pages['tools']['bp-optouts'] = $bp_optouts_tools; 357 $hooks[] = $bp_optouts_tools; 358 314 359 // For network-wide configs, add a link to (the root site's) Emails screen. 315 360 if ( is_network_admin() && bp_is_network_activated() ) { 316 361 $email_labels = bp_get_email_post_type_labels(); … … class BP_Admin { 333 378 foreach( $hooks as $hook ) { 334 379 add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' ); 335 380 } 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 } 336 396 } 337 397 338 398 /** … … class BP_Admin { 810 870 * @since 1.7.0 811 871 */ 812 872 public function credits_screen() { 873 bp_core_admin_tabbed_screen_header( __( 'BuddyPress Settings', 'buddypress' ), __( 'Credits', 'buddypress' ) ); 813 874 ?> 814 875 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"> 821 877 822 878 <p class="about-description"><?php esc_html_e( 'Meet the contributors behind BuddyPress:', 'buddypress' ); ?></p> 823 879 … … class BP_Admin { 1224 1280 wp_register_script( $id, $script['file'], $script['dependencies'], $version, $script['footer'] ); 1225 1281 } 1226 1282 } 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 } 1227 1330 } 1228 1331 endif; // End class_exists check. -
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 { 149 149 if ( ! empty( $this->subsite_activated ) ) { 150 150 $this->capability = 'manage_network_users'; 151 151 } 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 } 152 162 } 153 163 154 164 /** … … class BP_Members_Admin { 246 256 // Filter WP admin users list table to include users of the specified type. 247 257 add_filter( 'pre_get_users', array( $this, 'users_table_filter_by_type' ) ); 248 258 } 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 ); 249 262 } 250 263 251 264 /** … … class BP_Members_Admin { 501 514 ); 502 515 } 503 516 504 // For consistency with non-Multisite, we add a Tools menu in505 // 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 512 517 $hooks['members_invitations'] = $this->members_invites_page = add_submenu_page( 513 $t ools_parent,518 $this->tools_parent, 514 519 __( 'Manage Invitations', 'buddypress' ), 515 520 __( 'Manage Invitations', 'buddypress' ), 516 521 $this->capability, … … class BP_Members_Admin { 562 567 add_action( "admin_head-{$this->members_invites_page}", 'bp_core_modify_admin_menu_highlight' ); 563 568 } 564 569 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 565 583 /** 566 584 * Highlight the Users menu if on Edit Profile and check if on the user's admin profile. 567 585 * … … class BP_Members_Admin { 2990 3008 ), $_SERVER['REQUEST_URI'] 2991 3009 ); 2992 3010 3011 bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Invitations', 'buddypress' ), 'tools' ); 2993 3012 ?> 2994 3013 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"> 3001 3015 <?php 3002 3016 if ( $usersearch ) { 3003 3017 printf( '<span class="subtitle">' . __( 'Search results for “%s”', 'buddypress' ) . '</span>', esc_html( $usersearch ) ); … … class BP_Members_Admin { 3111 3125 'invitations_' . $action 3112 3126 ); 3113 3127 3128 bp_core_admin_tabbed_screen_header( __( 'BuddyPress tools', 'buddypress' ), __( 'Manage Invitations', 'buddypress' ), 'tools' ); 3114 3129 ?> 3115 3130 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> 3119 3133 3120 3134 <p><?php echo esc_html( $helper_text ); ?></p> 3121 3135