#8283 closed defect (bug) (fixed)
Bug in groups count
Reported by: | etatus | Owned by: | imath |
---|---|---|---|
Milestone: | 6.0.0 | Priority: | high |
Severity: | major | Version: | 3.0.0 |
Component: | Templates | Keywords: | has-patch commit |
Cc: |
Description
There is a bug in the groups counter when the number of groups is greater than 999, becasue the thousand separator is not well managed and the number is trunked because the separator is considered as a decimal number.
Possible fix (Buddypress 5.2.0):
In file:
buddypress/bp-templates/bp-nouveau/includes/template-tags.php
Line 1247:
$count = (int) $nav_item->count;
should be:
$count = (int) filter_var($nav_item->count, FILTER_SANITIZE_NUMBER_INT);
Line 1260:
$count = (int) substr( $nav_item->name, $count_start, $count_end - $count_start );
should be:
$count = (int) filter_var(substr( $nav_item->name, $count_start, $count_end - $count_start ), FILTER_SANITIZE_NUMBER_INT);
--> Maybe Legacy template also needs to be fixed.
Attachments (2)
Change History (5)
#1
@
4 years ago
- Keywords has-patch commit added
- Milestone changed from Awaiting Review to 6.0.0
- Version changed from 5.2.0 to 3.0.0
Hi @etatus
Thanks a lot for your feedback. I confirm. This is happening for the same reason that it was also happening to the members directory count (see #8269).
8283.patch is applying the same strategy to make sure we are not formatting the groups count twice.
#2
@
4 years ago
- Owner set to imath
- Resolution set to fixed
- Status changed from new to closed
In 12634:
#3
@
4 years ago
After upating to 6.0.0 with this issue supposedly fixed, I've realized that this problem still happens in "My groups" counter (and also it should be checked counters of "My friends", "Notifications" and "Messages" despite I guess some of them probably never reach 1000).
Groups count before and after fixing.