Skip to:
Content

BuddyPress.org

Ticket #8458: 8458.01.patch

File 8458.01.patch, 2.1 KB (added by dcavins, 3 years ago)

Use a radio button group instead of checkboxes on bp tools screen.

  • 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..3daeca67e 100644
    function bp_core_admin_tools() { 
    2626                <p><?php esc_html_e( 'Occasionally these relationships become out of sync, most often after an import, update, or migration.', 'buddypress' ); ?></p>
    2727                <p><?php esc_html_e( 'Use the tools below to manually recalculate these relationships.', 'buddypress' ); ?>
    2828                </p>
    29                 <p class="attention"><?php esc_html_e( 'Some of these tools create substantial database overhead. Avoid running more than one repair job at a time.', 'buddypress' ); ?></p>
    3029
    31                 <h2><?php esc_html_e( 'Activate checkboxe(s) to select the operation(s) to perform', 'buddypress' ); ?></h2>
     30                <h2><?php esc_html_e( 'Select the operation to perform', 'buddypress' ); ?></h2>
    3231
    3332                <form class="settings" method="post" action="">
    3433
    function bp_core_admin_tools() { 
    3837                                <?php foreach ( bp_admin_repair_list() as $item ) : ?>
    3938                                        <p>
    4039                                                <label for="<?php echo esc_attr( str_replace( '_', '-', $item[0] ) ); ?>">
    41                                                         <input type="checkbox" class="checkbox" name="<?php echo esc_attr( $item[0] ) . '" id="' . esc_attr( str_replace( '_', '-', $item[0] ) ); ?>" value="1" /> <?php echo esc_html( $item[1] ); ?>
     40                                                        <input type="radio" class="radio" name="bp-tools-run[]" id="<?php echo esc_attr( str_replace( '_', '-', $item[0] ) ); ?>" value="<?php echo esc_attr( $item[0] ); ?>" /> <?php echo esc_html( $item[1] ); ?>
    4241                                                </label>
    4342                                        </p>
    4443                                <?php endforeach; ?>
    function bp_admin_repair_handler() { 
    7978        $messages = array();
    8079
    8180        foreach ( (array) bp_admin_repair_list() as $item ) {
    82                 if ( isset( $item[2] ) && isset( $_POST[$item[0]] ) && 1 === absint( $_POST[$item[0]] ) && is_callable( $item[2] ) ) {
     81                if ( isset( $item[2] ) && isset( $_POST['bp-tools-run'] ) && in_array( $item[0], (array) $_POST['bp-tools-run'], true ) && is_callable( $item[2] ) ) {
    8382                        $messages[] = call_user_func( $item[2] );
    8483                }
    8584        }