Ticket #8448: 8448.3-tools-tabs.patch
File 8448.3-tools-tabs.patch, 11.6 KB (added by , 4 years ago) |
---|
-
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 26f549d8f..456fdcdca 100644
function bp_core_modify_admin_menu_highlight() { 81 81 } 82 82 83 83 // Network Admin > Tools. 84 if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' , 'bp-optouts') ) ) {84 if ( in_array( $plugin_page, array( 'bp-tools', 'available-tools' ) ) ) { 85 85 $submenu_file = $plugin_page; 86 86 } 87 88 // Keep the BuddyPress tools menu highlighted. 89 if ( 'bp-optouts' === $plugin_page ) { 90 $submenu_file = 'bp-tools'; 91 } 87 92 } 88 93 89 94 /** … … function bp_do_activation_redirect() { 389 394 * Output the tabs in the admin area. 390 395 * 391 396 * @since 1.5.0 397 * @since 8.0.0 Adds the `$context` parameter. 392 398 * 393 399 * @param string $active_tab Name of the tab that is active. Optional. 400 * @param string $context The context of use for the tabs. Defaults to 'settings'. 401 * Possible values are 'settings' & 'tools'. 394 402 */ 395 function bp_core_admin_tabs( $active_tab = '' ) {403 function bp_core_admin_tabs( $active_tab = '', $context = 'settings' ) { 396 404 $tabs_html = ''; 397 405 $idle_class = 'nav-tab'; 398 406 $active_class = 'nav-tab nav-tab-active'; … … function bp_core_admin_tabs( $active_tab = '' ) { 404 412 * 405 413 * @param array $value Array of tabs to output to the admin area. 406 414 */ 407 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab ) );415 $tabs = apply_filters( 'bp_core_admin_tabs', bp_core_get_admin_tabs( $active_tab, $context ) ); 408 416 409 417 // Loop through tabs and build navigation. 410 418 foreach ( array_values( $tabs ) as $tab_data ) { … … function bp_core_admin_tabs( $active_tab = '' ) { 419 427 * Fires after the output of tabs for the admin area. 420 428 * 421 429 * @since 1.5.0 430 * @since 8.0.0 Adds the `$context` parameter. 431 * 432 * @param string $context The context of use for the tabs. 422 433 */ 423 do_action( 'bp_admin_tabs' );434 do_action( 'bp_admin_tabs', $context ); 424 435 } 425 436 426 437 /** 427 438 * Get the data for the tabs in the admin area. 428 439 * 429 440 * @since 2.2.0 441 * @since 8.0.0 Adds the `$context` parameter. 430 442 * 431 443 * @param string $active_tab Name of the tab that is active. Optional. 444 * @param string $context The context of use for the tabs. Defaults to 'settings'. 445 * Possible values are 'settings' & 'tools'. 432 446 * @return string 433 447 */ 434 function bp_core_get_admin_tabs( $active_tab = '' ) { 435 $tabs = array( 436 '0' => array( 437 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-components' ), 'admin.php' ) ), 438 'name' => __( 'Components', 'buddypress' ), 439 ), 440 '2' => array( 441 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-settings' ), 'admin.php' ) ), 442 'name' => __( 'Options', 'buddypress' ), 443 ), 444 '1' => array( 445 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-page-settings' ), 'admin.php' ) ), 446 'name' => __( 'Pages', 'buddypress' ), 447 ), 448 '3' => array( 449 'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bp-credits' ), 'admin.php' ) ), 450 'name' => __( 'Credits', 'buddypress' ), 451 ), 452 ); 448 function bp_core_get_admin_tabs( $active_tab = '', $context = 'settings' ) { 449 $tabs = array(); 450 451 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 ); 470 } 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-optouts' ), $tools_page ) ), 483 'name' => __( 'Manage Opt-outs', 'buddypress' ), 484 ), 485 ); 486 } 453 487 454 488 /** 455 489 * Filters the tab data used in our wp-admin screens. 456 490 * 457 491 * @since 2.2.0 492 * @since 8.0.0 Adds the `$context` parameter. 458 493 * 459 * @param array $tabs Tab data. 494 * @param array $tabs Tab data. 495 * @param string $context The context of use for the tabs. 460 496 */ 461 return apply_filters( 'bp_core_get_admin_tabs', $tabs );497 return apply_filters( 'bp_core_get_admin_tabs', $tabs, $context ); 462 498 } 463 499 464 500 /** Help **********************************************************************/ -
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 5df6047d0..f446669b1 100644
function bp_core_optouts_admin_index() { 315 315 ?> 316 316 317 317 <div class="wrap"> 318 <h1 class="wp-heading-inline"><?php _e( 'Nonmember Opt-outs', 'buddypress' ); ?></h1> 318 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1> 319 <hr class="wp-header-end"> 320 321 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?></h2> 319 322 320 323 <?php 321 324 if ( $usersearch ) { 322 325 $num_results = (int) $bp_optouts_list_table->total_items; 323 printf( '< span class="subtitle">' . esc_html( _n( 'Opt-out with an email address matching “%s”', 'Opt-outs with an email address matching “%s”', $num_results, 'buddypress' ) ) . '</span>', esc_html( $usersearch ) );326 printf( '<p><span class="subtitle">' . esc_html( _n( 'Opt-out with an email address matching “%s”', 'Opt-outs with an email address matching “%s”', $num_results, 'buddypress' ) ) . '</span></p>', esc_html( $usersearch ) ); 324 327 } 325 328 ?> 326 <p class="description"><?php esc_html_e( 'This table shows opt-out requests from people who are not members of this site, but have been contacted via communication from this site, and wish to receive no further communications.', 'buddypress' ); ?></p> 327 328 <hr class="wp-header-end"> 329 <p><?php esc_html_e( 'This table shows opt-out requests from people who are not members of this site, but have been contacted via communication from this site, and wish to receive no further communications.', 'buddypress' ); ?></p> 329 330 330 331 <?php // Display each opt-out on its own row. ?> 331 332 <?php $bp_optouts_list_table->views(); ?> … … function bp_core_optouts_admin_manage( $action = '' ) { 379 380 // Check optout IDs and set up strings. 380 381 switch ( $action ) { 381 382 case 'delete' : 382 $header_text = __( 'Delete optouts', 'buddypress' );383 383 if ( 1 == count( $optouts ) ) { 384 384 $helper_text = __( 'You are about to delete the following opt-out request:', 'buddypress' ); 385 385 } else { … … function bp_core_optouts_admin_manage( $action = '' ) { 415 415 ?> 416 416 417 417 <div class="wrap"> 418 <h1 class="wp-heading-inline"><?php e cho esc_html( $header_text); ?></h1>418 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress tools', 'buddypress' ); ?></h1> 419 419 <hr class="wp-header-end"> 420 420 421 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Manage Opt-outs', 'buddypress' ), 'tools' ); ?></h2> 422 421 423 <p><?php echo esc_html( $helper_text ); ?></p> 422 424 423 425 <ol class="bp-optouts-list"> -
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 0d49c0d6f..047e11b37 100644
function bp_core_admin_tools() { 22 22 <h1 class="wp-heading-inline"><?php esc_html_e( 'BuddyPress Tools', 'buddypress' ) ?></h1> 23 23 <hr class="wp-header-end"> 24 24 25 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Repair', 'buddypress' ), 'tools' ); ?></h2> 26 25 27 <p><?php esc_html_e( 'BuddyPress keeps track of various relationships between members, groups, and activity items.', 'buddypress' ); ?></p> 26 28 <p><?php esc_html_e( 'Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?></p> 27 29 <p><?php esc_html_e( 'Use the tools below to manually recalculate these relationships.', 'buddypress' ); ?> … … function bp_core_admin_available_tools_intro() { 541 543 $page = bp_core_do_network_admin() ? 'admin.php' : 'tools.php' ; 542 544 $url = add_query_arg( $query_arg, bp_get_admin_url( $page ) ); 543 545 ?> 544 <div class="card tool-box ">546 <div class="card tool-box bp-tools"> 545 547 <h2><?php esc_html_e( 'BuddyPress Tools', 'buddypress' ) ?></h2> 546 <p> 547 <?php esc_html_e( 'BuddyPress keeps track of various relationships between users, groups, and activity items. Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?> 548 <?php 549 printf( 550 /* translators: %s: the link to the BuddyPress repair tools */ 551 esc_html_x( 'Use the %s to repair these relationships.', 'buddypress tools intro', 'buddypress' ), 552 '<a href="' . esc_url( $url ) . '">' . esc_html__( 'BuddyPress Tools', 'buddypress' ) . '</a>' 553 ); 554 ?> 555 </p> 548 549 <dl> 550 <dt><?php esc_html_e( 'Repair Tools', 'buddypress' ) ?></dt> 551 <dd> 552 <?php esc_html_e( 'BuddyPress keeps track of various relationships between users, groups, and activity items. Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?> 553 <?php 554 printf( 555 /* translators: %s: the link to the BuddyPress repair tools */ 556 esc_html_x( 'Use the %s to repair these relationships.', 'buddypress tools intro', 'buddypress' ), 557 '<a href="' . esc_url( $url ) . '">' . esc_html__( 'BuddyPress Repair Tools', 'buddypress' ) . '</a>' 558 ); 559 ?> 560 </dd> 561 <dt><?php esc_html_e( 'Manage Opt-outs', 'buddypress' ) ?></dt> 562 <dd> 563 <?php esc_html_e( 'Some introduction text to replace with something more meaningful.', 'buddypress' ); ?> 564 <?php 565 $url = add_query_arg( 'page', 'bp-optouts', bp_get_admin_url( $page ) ); 566 printf( 567 /* translators: %s: the link to the BuddyPress Nonmember Opt-outs */ 568 esc_html_x( 'Checkout %s to eventually do something great!', 'buddypress opt-outs intro', 'buddypress' ), 569 '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Nonmember Opt-outs', 'buddypress' ) . '</a>' 570 ); 571 ?> 572 </dd> 573 </dl> 556 574 </div> 557 575 <?php 558 576 } -
src/bp-core/admin/css/common.css
diff --git src/bp-core/admin/css/common.css src/bp-core/admin/css/common.css index c0af4884c..631305fba 100644
TABLE OF CONTENTS: 306 306 content: ""; 307 307 } 308 308 309 body.tools-php .bp-tools dt { 310 font-size: 1.1em; 311 color: #646970; 312 font-weight: 600; 313 margin: 1em 0 0.5em 0; 314 } 315 316 body.tools-php .bp-tools dd { 317 margin: 0; 318 } 319 309 320 /* 310 321 * 2.4 Tooltips 311 322 */ -
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 2edd975c5..f71113e67 100644
class BP_Admin { 544 544 // About and Credits pages. 545 545 remove_submenu_page( 'index.php', 'bp-about' ); 546 546 remove_submenu_page( 'index.php', 'bp-credits' ); 547 548 // Nonmembers Opt-outs page. 549 remove_submenu_page( 'tools.php', 'bp-optouts' ); 547 550 } 548 551 549 552 /**