Opened 9 years ago
Closed 9 years ago
#6813 closed defect (bug) (fixed)
Count & no-count classes not working properly for Groups
Reported by: | wp_new_user | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | 2.4.0 |
Component: | Groups | Keywords: | |
Cc: |
Description
Hi,
In the in the user profile main navigation there are numbers next to each tab (like groups, messages etc.) showing the total number of groups, messages etc.
When they are 0, the <span> has a class="no-count", when not 0, class="count".
However, for the Groups, though the number is 0, the <span> class is still "count".
My website is not translated and is in English only.
I have tried checked on multiple themes, including WP Twenty themes, the problem exists anyway.
I have deactivated/removed all the plugins, the problem exists anyway.
Regards,
Levon Avetyan
P.S. my BuddyPress version is 2.4.3 (there's no option like that below)
P.S.S. I can still live without groups tab 0 span class=no-count, just was advised me to open a ticket here, so hope it helps.
Change History (5)
#2
@
9 years ago
- Component changed from API to Component - Groups
- Milestone changed from Awaiting Review to 2.5
The 'count' and 'no-count' classes were introduced in [7758].
The problem is that the check is strict 0 === $count
, but $count
is a string. As far as I can see, this issue has always existed. bp_get_total_group_count_for_user()
, groups_total_groups_for_user()
, and BP_Groups_Member::total_group_count()
all claim in their documentation to return integers, but none of them do.
There's a possibility for some breakage, but I recommend we fix this by casting the return values of all of these functions to integers. (We have to do all of them because of the filters and cache support.) I'm going to make the change and see if anyone complains about it :)
Related to https://buddypress.org/support/topic/count-no-count-seem-not-to-be-working-properly-for-groups/
I don't think this has been confirmed yet, so someone needs to check against trunk. I though we had a fix for something like this in 2.4