[buddypress-trac] [BuddyPress Trac] #8036: Sanity checks for member/group widget limits

buddypress-trac noreply at wordpress.org
Thu Jan 10 20:18:29 UTC 2019


#8036: Sanity checks for member/group widget limits
-----------------------------------+---------------------
 Reporter:  boonebgorges           |       Owner:  (none)
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  5.0.0
Component:  Core                   |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |
-----------------------------------+---------------------
Changes (by boonebgorges):

 * keywords:  2nd-opinion => 2nd-opinion has-patch
 * milestone:  Awaiting Review => 5.0.0


Comment:

 Thanks, @dcavins !

 [attachment:8036.diff] is a proof-of-concept for the main Members widget.

 - New function `bp_get_widget_max_count_limit()` (awkward name for an
 awkward concept) provides a single point of filter if you want to change
 the value across the install. The class name passed to the function means
 you can be more fine-grained if you want. Default is 50.
 - Validate that you're not exceeding the max in `form()` and `widget()`
 (this will catch existing instances that are upgraded to 5.0) and also in
 `update()`
 - I added `min` and `max` attributes to the form `input` (and changed to
 `type="number"`). This gives a visual indication that it's for numbers
 only, and prevents you from clicking up above the limit. You can still
 enter a higher number, but the widget then won't save. There's no other
 visual feedback - it's hard to write JS that'll work well both on
 widgets.php and in the Customizer. Since this is likely to affect very few
 users, it may not be worth it.

 Anyone care to weigh in on the approach before I apply across other
 widgets?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8036#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list