Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/11/2019 02:37:16 AM (8 years ago)
Author:
boonebgorges
Message:

Widgets: Place an upper bound on item counts in widget forms.

This prevents widgets from triggering performance problems when initialized
with unreasonably high max item counts.

Use the bp_get_widget_max_count_limit filter to increase the default
ceiling of 50.

Fixes #8036.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-functions.php

    r12303 r12324  
    39293929        return (bool) apply_filters( 'bp_is_large_install', $is_large );
    39303930}
     3931
     3932/**
     3933 * Returns the upper limit on the "max" item count, for widgets that support it.
     3934 *
     3935 * @since 5.0.0
     3936 *
     3937 * @param string $widget_class Optional. Class name of the calling widget.
     3938 * @return int
     3939 */
     3940function bp_get_widget_max_count_limit( $widget_class = '' ) {
     3941        /**
     3942         * Filters the upper limit on the "max" item count, for widgets that support it.
     3943         *
     3944         * @since 5.0.0
     3945         *
     3946         * @param int    $count        Defaults to 50.
     3947         * @param string $widget_class Class name of the calling widget.
     3948         */
     3949        return apply_filters( 'bp_get_widget_max_count_limit', 50, $widget_class );
     3950}
Note: See TracChangeset for help on using the changeset viewer.