$mbname to include # total members

Started by macmike78, July 02, 2012, 02:27:16 PM

Previous topic - Next topic

macmike78

Hello everyone,

I'm very new to php and this should be simple enough but can't figure it out for the life of me.
How do I incorporate just the total members count from the ssi_boardStats() in my message board name?

I've tried dropping echo $txt['total_members'],' :',$modSettings['totalMembers']; into my settings.php but am forgetting something since I'm getting scripting errors.

Basically, I want my $mbname to read "Population XXXX" XXXX will be the number of members which is to change dynamically.

Thanks folks,

Mike

Arantor

That's not really a good idea. There are a surprising number of places the forum name ($mbname) is called for, including in emails and so on.

Would you really want it *everywhere* the forum name is used? Or just in specific places?

In any case, 1) DO NOT SCREW AROUND WITH SETTINGS.PHP, things will badly, badly break.

2) Even if the code were not going to get regularly mangled when Settings.php gets updated, $modSettings isn't loaded until way after Settings.php is loaded anyway. Hence my point about asking where you really want it, since there are a bunch of places that would have to be changed whatever you do.

macmike78

Thanks for the reply Arantor. Really good point about it showing up everywhere. Really didn't think about that. But let's just say I was cool with that. Any idea how I would go about pulling it off?  I think it would still be a cool idea to have my name as "[City Name Here] ~ Population XXX" where XXX is a dynamically changing number even if it does appear everywhere.

Mike

Arantor

Assuming you were cool with it being everywhere, you could just hack it in as soon as $modSettings is loaded (which, upon just triple checking, is before $mbname is used anywhere else)

Load.php, find:
// Call pre load integration functions.
call_integration_hook('integrate_pre_load');


After it add:

global $mbname;
$mbname .= ' ~ Population ' . $modSettings['totalMembers'];


That is, of course, not multi-language, and doing that is where it gets very very tricky to make it work, but that will work for now.

macmike78

Thanks for all your help Arantor! You rock!

Advertisement: