Is there a way...

Started by sarahwhite42, July 23, 2014, 12:27:00 PM

Previous topic - Next topic

sarahwhite42

Our site has a membergroup called "Inactive" for people that have left the site but might return.  Does anyone know if there is a (hopefully easy) way to keep the people in this group from showing up in our total member count?  We're on SMF 2.0.4 I believe

margarett

First of all, if you're really on 2.0.4, then you should update your forum ASAP. You are 2 security versions behind (and another 2 of other improvements)

As for your main question, do you want them to be decreased from the total members count only or do you also want to hide them, eg, from Memberlist?
Is this "Inactive" the primary membergroup of said members?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sarahwhite42

We would like them removed (total count decreased) and hidden from member list if possible.  And yes it's the primary membergroup of said members.

Also, we have now upgraded to 2.0.8

Kindred

There is actually no good way to do that.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

sarahwhite42

our main goal is to have them removed from the total count.  There's no way to do that without deleting the accounts?

Arantor

Well, there's banning them and there's forcibly deactivating their accounts, both of which would remove them from the list, but neither are especially desirable. SMF is sadly not designed to accommodate such a situation.

margarett

I see that you already marked this as solved but anyway, here goes nothing.

For the memberlist I would need to take a deeper look at it. But for the members total that shows up in BoardIndex/InfoCenter, you can actually do something like this:

Subs.php, find:
// This looks weird, but it's because BoardIndex.php references the variable.
Add before:
//How many members are "inactive"?
$request = $smcFunc['db_query']('', '
SELECT COUNT(*)
FROM {db_prefix}members AS total
WHERE id_group = {int:group}',
array(
'group' => 9,
)
);
list ($total) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

(you need to adapt that "9" to your actual group ID)

Find (few lines below):
'total_members' => comma_format($modSettings['totalMembers']),
Replace with:
'total_members' => comma_format($modSettings['totalMembers'] - $total),

Please note that this is not actually very efficient as it will add a query to pretty much every page load. It should be cached or , better yet, handled at the membergroup edit stage by storing the current number of members of said group in a "settings" record so that the value is always available without any additional query. But that's what I can get out in a 5-minutes test :P
Depending on how busy your forum is, this can affect it negatively for little gain. If it isn't very busy than you probably won't even note it's there.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

Hmm, that presumes group 9 won't be a secondary group at all (which makes it even more expensive) and won't do anything for the member list which is what seems to be even more imposing.

margarett

Yup. (S)he said that it was primary membergroup. The memberlist would take me the time that I can't really spend now :(
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: