News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[Tip] Stats Tab

Started by Joe N, June 27, 2009, 11:16:24 AM

Previous topic - Next topic

Joe N

Hi

This adds a Stats tab to your menu!

First, Go to index.template.php

Find:
// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'mlist' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
</td>' , $current_action == 'mlist' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Code (Add After:) Select
// Show the [Stats] button
echo ($current_action == 'stats' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'stats' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=stats">' , $txt['stats_mod'] , '</a>
</td>' , $current_action == 'stats' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';




Now you will see a space after the member button

Now we have to go to modifications.english.php

Code (find (at the end of the file:) Select
?>

Code (add before) Select
$txt['stats_mod']= 'Stats';

Thanks For reading and I hope this helps!

Joe N

p.s. Also, if anyone has used it, please put there forum url so I can take a look

Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


Marcus Forsberg

Hello.

Would oyu like to have this moved to Tips and Tricks?

Joe N

Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


[Core]


Joe N

Quote from: [Core28] on June 30, 2009, 10:54:18 PM
Nice...

Thank You!

Also, if anyone has used it, please put there forum url so I can take a look
Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


LHW

Very nice!  I just added it to my place, and it works like a charm.  ;D

Thank you!

Oh...just click the gold image in my sig for the forum link.


[Core]

Quote from: Joe N on July 01, 2009, 10:18:28 AM
Quote from: [Core28] on June 30, 2009, 10:54:18 PM
Nice...

Thank You!

Also, if anyone has used it, please put there forum url so I can take a look

your welcome.

LHW

I added this after the comment line:

   if ($context['user']['is_logged'])

Now the Stats aren't viewable by Guests: only Members.


Bulakbol

If you want to use the group permission, use this
if (isset($context['show_stats']) && $context['show_stats'])
To enable permission for guests, go to Admin => Permissions => Permission by Membergroups, modify "Guests" permission, tick the  "View forum statistics" checkbox.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

LHW

Quote from: Bulakbol on July 04, 2009, 02:11:31 PM
If you want to use the group permission, use this
if (isset($context['show_stats']) && $context['show_stats'])
To enable permission for guests, go to Admin => Permissions => Permission by Membergroups, modify "Guests" permission, tick the  "View forum statistics" checkbox.

I tried that.  After you click on the STATS button, the button disappears from the menu bar when the Stats Page is displayed.

Also, if you use the Tip as posted, or with
Quote from: Lord High Warlock on July 02, 2009, 04:51:19 PM
if ($context['user']['is_logged'])

The STATS button is not selected / highlighted as others would be when the Stats Page is displayed...it selects the HOME button.  Is there a way to correct this??


Bulakbol

Yes. Sorry 'bout that. I forgot that the $context['show_stats'] is only available in board index.
To highlight the stats tab, in index,template.php, look for
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

and add after
if ($context['current_action'] == 'stats')
$current_action = 'stats';
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

LHW

Thanks, Bulakbol!  That worked perfectly!

Kudos to you!  :D


JeremyB.

"The most overlooked advantage to owning a computer is that if they foul up, there's no law against whacking them around a little."

JeremyB.

Some Translations:

Spanish:
$txt['stats_mod']= 'Estadísticas';

Polish:
$txt['stats_mod']= 'Statystyki';

Do you mind if I add to those boards?

-JB
"The most overlooked advantage to owning a computer is that if they foul up, there's no law against whacking them around a little."

Joe N

Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


JeremyB.

"The most overlooked advantage to owning a computer is that if they foul up, there's no law against whacking them around a little."

Joe N

Quote from: JeremyB. on July 16, 2009, 08:37:20 PM
Thanks.

Hey

Could I have the link for ur site so I can take a look?
Microsoft: "We Need to Imagine Life Without Walls."
I Say: "If There are No Walls Who needs Windows."



My Mods (6) All My Mods Updated To SMF 2.0 RC2 and SMF 1.1.10!


JeremyB.

"The most overlooked advantage to owning a computer is that if they foul up, there's no law against whacking them around a little."

H

Quote from: JeremyB. on July 17, 2009, 08:07:20 AM
A link to what site?

The site where you're using this tip.
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

JeremyB.

Oh I'm not using just translated it.
"The most overlooked advantage to owning a computer is that if they foul up, there's no law against whacking them around a little."

Advertisement: