Changeset 13937
- Timestamp:
- 06/24/2024 05:29:42 PM (6 months ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-admin.php
r13871 r13937 15 15 16 16 // Include WP's list table class. 17 if ( ! class_exists( 'WP_List_Table' ) ) require( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); 18 19 // Per_page screen option. Has to be hooked in extremely early. 20 if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-activity' == $_REQUEST['page'] ) { 21 add_filter( 'set-screen-option', 'bp_activity_admin_screen_options', 10, 3 ); 17 if ( ! class_exists( 'WP_List_Table' ) ) { 18 require ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; 22 19 } 23 20 … … 139 136 } 140 137 add_action( 'wp_ajax_bp-activity-admin-reply', 'bp_activity_admin_reply' ); 141 142 /**143 * Handle save/update of screen options for the Activity component admin screen.144 *145 * @since 1.6.0146 *147 * @param string $value Will always be false unless another plugin filters it first.148 * @param string $option Screen option name.149 * @param string $new_value Screen option form value.150 * @return string|int Option value. False to abandon update.151 */152 function bp_activity_admin_screen_options( $value, $option, $new_value ) {153 if ( 'toplevel_page_bp_activity_per_page' != $option && 'toplevel_page_bp_activity_network_per_page' != $option )154 return $value;155 156 // Per page.157 $new_value = (int) $new_value;158 if ( $new_value < 1 || $new_value > 999 )159 return $value;160 161 return $new_value;162 }163 138 164 139 /** -
trunk/src/bp-core/admin/bp-core-admin-functions.php
r13928 r13937 1700 1700 <?php 1701 1701 } 1702 1703 /** 1704 * Sets the "per page" screen option for BP Items WP Admin lists. 1705 * 1706 * @since 14.0.0 1707 * 1708 * @param bool $value Will always be false unless another plugin filters it first. 1709 * @param string $option Screen option name. 1710 * @param string $new_value Screen option form value. 1711 * @return string|int Option value. False to abandon update. 1712 */ 1713 function bp_admin_set_screen_options( $value, $option, $new_value ) { 1714 // Sanitize the new value. 1715 $new_value = (int) $new_value; 1716 1717 // Make sure it's a reasonable value to paginate results. 1718 if ( $new_value < 1 || $new_value > 999 ) { 1719 return $value; 1720 } 1721 1722 return $new_value; 1723 } 1724 add_filter( 'set_screen_option_toplevel_page_bp_activity_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1725 add_filter( 'set_screen_option_toplevel_page_bp_activity_network_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1726 add_filter( 'set_screen_option_toplevel_page_bp_groups_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1727 add_filter( 'set_screen_option_toplevel_page_bp_groups_network_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1728 add_filter( 'set_screen_option_tools_page_bp_optouts_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1729 add_filter( 'set_screen_option_tools_page_bp_optouts_network_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1730 add_filter( 'set_screen_option_tools_page_bp_members_invitations_per_page', 'bp_admin_set_screen_options', 10, 3 ); 1731 add_filter( 'set_screen_option_tools_page_bp_members_invitations_network_per_page', 'bp_admin_set_screen_options', 10, 3 ); -
trunk/src/bp-core/deprecated/14.0.php
r13936 r13937 99 99 return false; 100 100 } 101 102 /** 103 * Handle save/update of screen options for the Activity component admin screen. 104 * 105 * @since 1.6.0 106 * @deprecated 14.0.0 107 * 108 * @param string $value Will always be false unless another plugin filters it first. 109 * @param string $option Screen option name. 110 * @param string $new_value Screen option form value. 111 * @return string|int Option value. False to abandon update. 112 */ 113 function bp_activity_admin_screen_options( $value, $option, $new_value ) { 114 _deprecated_function( __FUNCTION__, '14.0.0', 'bp_admin_set_screen_options' ); 115 116 return bp_admin_set_screen_options( $value, $option, $new_value ); 117 } 118 119 /** 120 * Handle save/update of screen options for the Groups component admin screen. 121 * 122 * @since 1.7.0 123 * @deprecated 14.0.0 124 * 125 * @param string $value Will always be false unless another plugin filters it first. 126 * @param string $option Screen option name. 127 * @param string $new_value Screen option form value. 128 * @return string|int Option value. False to abandon update. 129 */ 130 function bp_groups_admin_screen_options( $value, $option, $new_value ) { 131 _deprecated_function( __FUNCTION__, '14.0.0', 'bp_admin_set_screen_options' ); 132 133 return bp_admin_set_screen_options( $value, $option, $new_value ); 134 } -
trunk/src/bp-groups/bp-groups-admin.php
r13890 r13937 17 17 if ( ! class_exists( 'WP_List_Table' ) ) { 18 18 require ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; 19 }20 21 // The per_page screen option. Has to be hooked in extremely early.22 if ( is_admin() && ! empty( $_REQUEST['page'] ) && 'bp-groups' == $_REQUEST['page'] ) {23 add_filter( 'set-screen-option', 'bp_groups_admin_screen_options', 10, 3 );24 19 } 25 20 … … 525 520 526 521 /** 527 * Handle save/update of screen options for the Groups component admin screen.528 *529 * @since 1.7.0530 *531 * @param string $value Will always be false unless another plugin filters it first.532 * @param string $option Screen option name.533 * @param string $new_value Screen option form value.534 * @return string|int Option value. False to abandon update.535 */536 function bp_groups_admin_screen_options( $value, $option, $new_value ) {537 if ( 'toplevel_page_bp_groups_per_page' != $option && 'toplevel_page_bp_groups_network_per_page' != $option ) {538 return $value;539 }540 541 // Per page.542 $new_value = (int) $new_value;543 if ( $new_value < 1 || $new_value > 999 ) {544 return $value;545 }546 547 return $new_value;548 }549 550 /**551 522 * Select the appropriate Groups admin screen, and output it. 552 523 *
Note: See TracChangeset
for help on using the changeset viewer.