MyBB Community Forums
Display stats in footer? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: Display stats in footer? (/thread-212858.html)

Pages: 1 2


Display stats in footer? - Livewire - 2017-09-09

Any ideas how I can display {$stats ['numposts']}, {$stats ['numusers']}, {$stats ['numthreads']}, and {$newestmember} in the footer please?

I've tried adding them manually but it doesn't work.. I've seen most forums have this feature I'm wondering is it a plugin or..?

Bump anybody?


RE: Display stats in footer? - Michael2014 - 2017-09-10

Try this:

Open ./global.php and find:

$plugins->run_hooks("global_start");

and add the following code just Below that..

$stats = $cache->read("stats");
$stats['newest_user'] = build_profile_link($stats['lastusername'], $stats['lastuid']);
$total_posts = my_number_format($stats['numposts']);
$total_users = my_number_format($stats['numusers']);

Stats vars will work globally now..

You are welcome.


RE: Display stats in footer? - Livewire - 2017-09-10

(2017-09-10, 10:29 PM)Michael2014 Wrote: Try this:

Open ./global.php and find:

$plugins->run_hooks("global_start");

and add the following code just Below that..

$stats = $cache->read("stats");
$stats['newest_user'] = build_profile_link($stats['lastusername'], $stats['lastuid']);
$total_posts = my_number_format($stats['numposts']);
$total_users = my_number_format($stats['numusers']);

Stats vars will work globally now..

You are welcome.

Tried that and I got an error..
A potential security issue was found in the template. Please review your changes or contact the MyBB Group for support.


RE: Display stats in footer? - Michael2014 - 2017-09-11

That is nothing, that just has to do with your vars, if you are using the vars above then you NEED to remove the spacing within them,
a mis-written var triggers the above error, try these vars below with the spacing removed.

{$stats['numposts']} {$stats['numusers']} {$stats['numthreads']} and {$newestmember}


RE: Display stats in footer? - Pulseeey - 2017-09-11

(2017-09-11, 12:53 AM)Michael2014 Wrote: That is nothing, that just has to do with your vars, if you are using the vars above then you NEED to remove the spacing within them,
a mis-written var triggers the above error, try these vars below with the spacing removed.

{$stats['numposts']} {$stats['numusers']} {$stats['numthreads']} and {$newestmember}

{$newestmember} not display.

[Image: Screenshot_2017_09_11_09_51_14.png]


RE: Display stats in footer? - Livewire - 2017-09-11

(2017-09-11, 02:52 AM)Pulseeey Wrote:
(2017-09-11, 12:53 AM)Michael2014 Wrote: That is nothing, that just has to do with your vars, if you are using the vars above then you NEED to remove the spacing within them,
a mis-written var triggers the above error, try these vars below with the spacing removed.

{$stats['numposts']} {$stats['numusers']} {$stats['numthreads']} and {$newestmember}

{$newestmember} not display.

[Image: Screenshot_2017_09_11_09_51_14.png]

Yeah newest member not working..


RE: Display stats in footer? - Michael2014 - 2017-09-12

Cool ---> {$stats['newest_user']}


RE: Display stats in footer? - Pulseeey - 2017-09-12

(2017-09-12, 12:24 AM)Michael2014 Wrote: Cool  ---> {$stats['newest_user']}

this work, thank you +1 rep for you.


RE: Display stats in footer? - Livewire - 2017-09-12

Thank you finally it works! Smile


RE: Display stats in footer? - Kiddo Monster - 2018-04-29

(2017-09-10, 10:29 PM)Michael2014 Wrote: Try this:

Open ./global.php and find:

$plugins->run_hooks("global_start");

and add the following code just Below that..

$stats = $cache->read("stats");
$stats['newest_user'] = build_profile_link($stats['lastusername'], $stats['lastuid']);
$total_posts = my_number_format($stats['numposts']);
$total_users = my_number_format($stats['numusers']);

Stats vars will work globally now..

You are welcome.

what should I do if I don't want to touch global.php ? actually I don't wanna touch Official Template files.