BuddyDev

Search

BuddyPress Member Types Pro – Count "All members" wrong

  • Participant
    Level: Enlightened
    Posts: 41
    Linklusion on #25314

    Hi

    Using BuddyPress Member Types Pro I include in directory only some Member type.
    I also exclude some role using BP Custom Functionalities https://fr.wordpress.org/plugins/bp-custom-functionalities/
    To avoid onflict with , I deactivated BP Custom Functionalities

    In member directory, count of “All members” displays number of all members in database not number of all members in directory
    Screenshot https://prnt.sc/p6n0ru
    Is it the way it should work ?

    I would like to have numbers of “All member” in directory not all members in database
    Is there a way to get this ?

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25323

    Hi Johan,
    Thank you for reporting. I am aware of the issue.

    The counts in BuddyPress do not behave correctly as they do not take into consideration the current query. They only take consideration of the global state.

    There is a solution but these are not efficient, that’s why I haven’t included it in the plugin..

    I will share the code to help fix it.

    regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 41
    Linklusion on #25492

    HI Brajesh

    Can you please share the code to fix this issue

    Thanks

    Johan

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25539

    Hi Johan,
    I am sorry I haven’t been able to put the code. Please allow me till tuesday to post it.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25584

    Hi Johan,
    Thank you for the patience.

    Please put this code in your bp-custom.php
    https://gist.github.com/sbrajesh/9fd25a8071cd2a90fc0b3a62ed89d8dc

    and then visit dashboard->Tools->BuddyPress and check ” Repair total members count.”

    and then click on Repair items. That will take care of it.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 41
    Linklusion on #25589

    Hi Brajesh

    It works !

    The count of total member is also right when a user is deactviated but the count ot member types is wrong when a user is deactviated
    Screenshot https://prnt.sc/pd94x5

    Is it something you can fix in this code or is it related to an other code in Member Type pro ?

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25590

    Hi Johan,
    Thank you.

    Currently, to optimize the query, we do not count member types based on users. We are using the term count(member types is a taxonomy) to fetch all count in one query. The down side is it does not keep track if a user got deactivated or is active currently.

    The other solution is to count for each member type on page load. I am not in favour of it as it will be too may db queries.

    I am going to solve it in the Member Types Pro code. Will need 3-4 days to provide the plugin update.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved