MyBB Community Forums

Full Version: Display stats in footer?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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?
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.
(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.
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}
(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]
(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..
Cool ---> {$stats['newest_user']}
(2017-09-12, 12:24 AM)Michael2014 Wrote: [ -> ]Cool  ---> {$stats['newest_user']}

this work, thank you +1 rep for you.
Thank you finally it works! Smile
(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.
Pages: 1 2