#6287 closed defect (bug) (worksforme)
get_invite_count_for_user returning incorrect value (0)
Reported by: | rogercoathup | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | reporter-feedback |
Cc: |
Description
We are seeing no group invites, even though several exist, on the invitations page for a user (/members/single/groups/inivites.php),
We have a plugin that runs a bp_has_groups() loop on the init action. On the invitations page this causes the subsequent invitations bp_has_groups() loop to fail.
The problem seems to be the wp_cache_get call in get_invite_count_for_user() (line 2425 of bp-groups-classes.php), which is returning 0 (the value from the loop on init in the plugin), rather than the correct value for the invite loop in the invite template.
Change History (4)
#2
@
10 years ago
I wasn't able to reproduce the problem on a clean test install, so suggest we mark it as invalid.
If time allows I'll reinvestigate on the development site (in the immediate term, I'd worked around by not running the plugin on the invites page).
A little further info -- the loop was being called in a register_taxonomies() function on a new BP Component (it sets up associated taxonomies for each group). The has_groups was parameterised ( show_hidden => 'true', 'per_page' => 10000 ).
I've done the following in an mu-plugin:
Then, in the /members/single/groups/invites.php template,
The latter is returning the correct number invitations for the current user.
It's possible that there is some cache pollution going on here, but I'm not reproducing it given the above. Can you please give additional information on how to reproduce the error? Where is the cache being set during the first call to
bp_has_groups()
? And why would the value being cached be incorrect?