Changeset 12324 for trunk/src/bp-groups/classes/class-bp-groups-widget.php
- Timestamp:
- 01/11/2019 02:37:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-widget.php
r12323 r12324 103 103 echo $before_title . $title . $after_title; 104 104 105 $max_limit = bp_get_widget_max_count_limit( __CLASS__ ); 105 106 $max_groups = ! empty( $instance['max_groups'] ) ? (int) $instance['max_groups'] : 5; 107 108 if ( $max_groups > $max_limit ) { 109 $max_groups = $max_limit; 110 } 106 111 107 112 $group_args = array( … … 184 189 $instance = $old_instance; 185 190 191 $max_limit = bp_get_widget_max_count_limit( __CLASS__ ); 192 186 193 $instance['title'] = strip_tags( $new_instance['title'] ); 187 $instance['max_groups'] = strip_tags( $new_instance['max_groups'] );194 $instance['max_groups'] = $new_instance['max_groups'] > $max_limit ? $max_limit : intval( $new_instance['max_groups'] ); 188 195 $instance['group_default'] = strip_tags( $new_instance['group_default'] ); 189 196 $instance['link_title'] = ! empty( $new_instance['link_title'] ); … … 209 216 $instance = bp_parse_args( (array) $instance, $defaults, 'groups_widget_form' ); 210 217 218 $max_limit = bp_get_widget_max_count_limit( __CLASS__ ); 219 211 220 $title = strip_tags( $instance['title'] ); 212 $max_groups = strip_tags( $instance['max_groups'] );221 $max_groups = $instance['max_groups'] > $max_limit ? $max_limit : intval( $instance['max_groups'] ); 213 222 $group_default = strip_tags( $instance['group_default'] ); 214 223 $link_title = (bool) $instance['link_title']; … … 219 228 <p><label for="<?php echo $this->get_field_id('link_title') ?>"><input type="checkbox" name="<?php echo $this->get_field_name('link_title') ?>" id="<?php echo $this->get_field_id('link_title') ?>" value="1" <?php checked( $link_title ) ?> /> <?php _e( 'Link widget title to Groups directory', 'buddypress' ) ?></label></p> 220 229 221 <p><label for="<?php echo $this->get_field_id( 'max_groups' ); ?>"><?php _e( 'Max groups to show:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_groups' ); ?>" name="<?php echo $this->get_field_name( 'max_groups' ); ?>" type="text" value="<?php echo esc_attr( $max_groups ); ?>" style="width: 30%" /></label></p>230 <p><label for="<?php echo $this->get_field_id( 'max_groups' ); ?>"><?php _e( 'Max groups to show:', 'buddypress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_groups' ); ?>" name="<?php echo $this->get_field_name( 'max_groups' ); ?>" type="number" min="1" max="<?php echo esc_attr( $max_limit ); ?>" value="<?php echo esc_attr( $max_groups ); ?>" style="width: 30%" /></label></p> 222 231 223 232 <p>
Note: See TracChangeset
for help on using the changeset viewer.