Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8283 closed defect (bug) (fixed)

Bug in groups count

Reported by: etatus's profile etatus Owned by: imath's profile 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)

groups-count-issue.jpg (20.9 KB) - added by etatus 4 years ago.
Groups count before and after fixing.
8283.patch (1.1 KB) - added by imath 4 years ago.

Download all attachments as: .zip

Change History (5)

@etatus
4 years ago

Groups count before and after fixing.

@imath
4 years ago

#1 @imath
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 @imath
4 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 12634:

BP Nouveau: make sure to format the total groups count once only

Props etatus

Fixes #8283

#3 @etatus
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).

Version 0, edited 4 years ago by etatus (next)
Note: See TracTickets for help on using tickets.