Skip to:
Content

BuddyPress.org

Ticket #9195: 9195.01.patch

File 9195.01.patch, 1.4 KB (added by emaralive, 12 months ago)

Initial patch

  • 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 469c8bf73..98e40b113 100644
     
    1010// Exit if accessed directly.
    1111defined( 'ABSPATH' ) || exit;
    1212
     13// Per_page screen option.
     14if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-optouts' == $_REQUEST['page'] ) {
     15        add_filter( 'set-screen-option', 'bp_core_optouts_screen_options', 10, 3 );
     16}
     17
    1318/**
    1419 * Set up the Opt-outs admin page.
    1520 *
    function bp_core_optouts_admin_manage( $action = '' ) { 
    484489
    485490        <?php
    486491}
     492
     493/**
     494 * Handle save/update of screen options for the BP Tools Optouts screen.
     495 *
     496 * @since 14.0.0
     497 *
     498 * @param  string     $value     Will always be false unless another plugin filters it first.
     499 * @param  string     $option    Screen option name.
     500 * @param  string     $new_value Screen option form value.
     501 * @return string|int            Option value. False to abandon update.
     502 */
     503function bp_core_optouts_screen_options( $value, $option, $new_value ) {
     504        if ( 'tools_page_bp_optouts_per_page' !== $option && 'tools_page_bp_optouts_network_per_page' !== $option ) {
     505                        return $value;
     506                }
     507
     508                // Per page.
     509                $new_value = (int) $new_value;
     510                if ( $new_value < 1 || $new_value > 999 ) {
     511                        return $value;
     512                }
     513
     514                return $new_value;
     515}