News:

Wondering if this will always be free?  See why free is better.

Main Menu

Buttons

Started by a454nova, November 02, 2008, 11:55:52 PM

Previous topic - Next topic

a454nova

How do you control when the buttons show?  Like the admin button, I want to make a button that only shows for a certain member group.

Nathaniel

You will need to edit the "setupMenuContext()" function from your Subs.php file.

You can change the 'show' value for each button (see below). You will have to change the 'true' value to the condition that you want to check. If they have to be admin then use 'allowedTo('admin_forum')'
'show' => true,

The post below covers how to add a new button to your menu:
http://www.simplemachines.org/community/index.php?topic=256570.msg1667966#msg1667966
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

a454nova

Still doesn't make sense. I know how to add the button, I can use the line from admin, guest, or calender so that it only shows with admin, logged out, logged in, or with calender. I need to know how or pointed in a better direction to make it so that the new button I just made, lets say button "MAIL". I only want the button to show up for the Member Group I made called "VIP". If one of my users is a VIP then they can see and have access to the "MAIL" button. Is it easy or more trouble than its worth?

Nathaniel

That should be relatively easy to do.

Use this code for your 'show part':
'show' => in_array({id}, $user_info['groups']),

Replace '{id}' with the ID of the group that you want to be able to see that button. You can find it by going to the 'Modify' page for that membergroup, the id will in the the url of that page, 'group=id'.

And end result might look like this:
         'mail' => array(
            'title' => 'MAIL,
            'href' => 'http://www.domain.com',
            'show' => in_array(1, $user_info['groups']),
            'sub_buttons' => array(
            ),
         ),

SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

a454nova

#4
I'll try that here when my eyes are not so heavy. : ) If it works then mad props and thank you tons LHVWB!




NOTE: I got some rest and tried it and it worked....  YOU DA MAN!!

THANKS!

Advertisement: