Jump to content


- - - - -

RESOLVED: Not count some groups


This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1 Sandi

Sandi

    Coder

  • IM Supporters
  • PipPipPipPipPipPipPip
  • 812 posts

Posted 01 April 2010 - 12:49 AM

I have three non-human groups on my forum that are bots for a game mod. I'm trying to skip counting them as members for board stats count. Reason is because the non-humans outnumber the members. The non-human groups are 8, 10 and 11.

Once I get it to skip the non-human groups I have a php function that finds which groups are non-human instead of hard coding the group numbers.

I have found two places and tried by changing a query that counts the members with no luck.

In members.php from:
$r = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'count(id) as members', 'from' => 'members', 'where' => "mgroup <> '".$this->ipsclass->vars['auth_group']."'" ) );

To:
$r = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'count(id) as members', 'from' => 'members', 'where' => "(mgroup != 8 OR mgroup != 10 OR mgroup != 11) AND mgroup <> '".$this->ipsclass->vars['auth_group']."'" ) );

Also tried a similar query with no luck in the action_admin/rebuild.php tool which recounts the members.

Thanks for any help.

Posted Image


#2 AndyF

AndyF

    Cogito ergo sum

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 8,414 posts

Posted 01 April 2010 - 12:28 PM

One possible work-around, although you need to know how many 'members' you want to remove in total...

Open /sources/lib/func_boardstats.php

Around line 575 or so, find:
$this->total_members  = $stats['mem_count'];

Change to:
$this->total_members  = $stats['mem_count'] = $stats['mem_count'] - X;

Replace X with the number you want to remove, example:

You have 10,000 members, you want to remove 500 'bot' members, change X to 500, your stats will now display 9500 ;)

I did a quick test on my dev board and it appears to work. It's not as neat as changing a query though but would suffice if you are not going to be adding more 'bots'

View my tutorials

Please do NOT pm me with support related questions unless requested.
If you are in need of help or assistance, please post on the forum in the appropriate section!



A Look Back - 1.0.1 - 1.3.1 - 2.0.0 - 2.1.7 - 2.2.0 - 2.3.6

#3 Sandi

Sandi

    Coder

  • IM Supporters
  • PipPipPipPipPipPipPip
  • 812 posts

Posted 01 April 2010 - 02:05 PM

Thanks Andy,

I had thoughts similar to your work-a-round, but wanted to share it with other sites that also have use game mod. This works for me now though as my bot groups are pretty much set and to the max I will ever use.

When I find more time perhaps I will look again for the proper query to edit.

Posted Image


#4 tartan lady

tartan lady

    Member

  • Members
  • PipPipPip
  • 40 posts

Posted 01 April 2010 - 02:29 PM

excellent thats fantastic for now lol

#5 AndyF

AndyF

    Cogito ergo sum

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 8,414 posts

Posted 02 April 2010 - 11:29 AM

The issue this topic was opened for has now been resolved. ;)

View my tutorials

Please do NOT pm me with support related questions unless requested.
If you are in need of help or assistance, please post on the forum in the appropriate section!



A Look Back - 1.0.1 - 1.3.1 - 2.0.0 - 2.1.7 - 2.2.0 - 2.3.6