It works fine of my test system, have you ruled out plugin and theme conflicts?
Yes, I’ve tried deactivating all plugins, deleted
everything in bp_customs, and tried with a WP default theme. Nothing worked. I’ve tried adding a test user and the (All Members (count)) is still and one. I’m guessing that one is for admin. The weird thing is the count is fine in BP Legacy 3.1.0. all users in question are already, verified logged in, so, active users. The friends count works fine. bp_get_total_member_count works when placed in a custom function in functions.php. Scratching my head on this one.
BP Nouveau uses a different function to display the members count – bp_nouveau_pagination()
it’s in the file plugins/buddypress/bp-template/bp-nouveau/members/membes-loop.php
The same code is used to display the counts for friends. does your friends list display the right number?
Just checking, on the Nouveau Members page the member count is displayed in two places on my test bed. One place is the pagination, where it says it’s displaying 1-20 of 200 members for example. The other place is the All Members tab, which also shows the members count. do both get it wrong?
I’m aware ( <?php bp_nouveau_pagination( 'top' ); ?>
) but that’s a template tag, the real magic is taking place in common->nav->directory-nav
<a href="<?php bp_nouveau_nav_link(); ?>">
<?php bp_nouveau_nav_link_text(); ?>
<?php if ( bp_nouveau_nav_has_count() ) : ?>
<span class="count">
<?php bp_nouveau_nav_count(); ?>
</span>
<?php endif; ?>
</a>
the problem is this calls all the different counts on every single nav.
I’ve also checked out bp-templates->bp-nouveau->includes->members->fuctions.php all seems well.
It’s a brain buster because as I said, everythings works fine with the Legacy template.
Don’t know what it can be. Database maybe refusing to play nice with Nouveau :(. I’m going to kick
myself if the solution is a simple one hiding in my face.
No, the 1-20 of 200 members is perfect, My Friends “Number” is fine. The one and only problem is the (All Members ‘#’) Count number.
All Members are shown with the Legacy Template and that’s what I can’t figure out. It is my opinion it should show the same number.
Ah so it’s includes/members/functions.php
you need to look at, line 50 is calling bp_get_total_member_count()
, it’s called by the legacy theme also so there’s a thing – the same function returning two different numbers depending on the theme, and only on one site.
Everything is fine inside includes/members/functions.php it’s calling bp_get_total_member_count().
I’ve used bp_get_total_member_count() elsewhere in my theme to see if it would return the members count and it works. For some reason it just doesn’t work with the Nouveau template.
Yep switching theme should not affect it, and it’s only this one call that it’s doing it on. One thing you could try, is calling the master function direct – bp_core_get_active_member_count()
just to see if that behaves any differently. If that does not shed light then it’s down to the workings of the core function, something is different about how it’s applying the excludes list.
That worked, thanks. Will it be a fix in an update? We know what happens to altered core files on updates :).
I’m not sure we have found the problem, we’ve just ruled out a lot of the code. All bp_get_total_member_count
is doing is running a filter, it’s so simple there’s nothing to fix. Could you still have something that’s messing with it?
Inside includes/members/functions.php there’s this function:
bp_nouveau_get_members_directory_nav_items()
I replaced bp_get_total_member_count with bp_core_get_active_member_count() as you stated above and I got the Total Members count.
The bp_core_get_active_member_count() in that function was only returning one member for some reason.
I was wondering, if it’s a bug fix would it be done in the next update?
If not then I know I would have to add a filter to bp_nouveau_get_members_directory_nav_items
to avoid having to have to make that change every time an update is issued.
No it’s not a bugfix so that change will be overwritten next update.
Ok, thanks for your help today, it was much appreciated. And yes, I kicked myself. 🙂