SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 24, 2012, 05:39:21 pm

Login with username, password and session length
Members
Total Members: 10071
Latest: cdavidson012
Stats
Total Posts: 28687
Total Topics: 4977
Online Today: 94
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 1
Guests: 41
Total: 42
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 2 Guests are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Help with permissions with a new mod i am creating-URGENT!  (Read 1561 times)
jameselder232
Newbie
*
Offline Offline

Posts: 2


View Profile
« on: January 16, 2007, 11:13:18 am »

Hiya i have created an smf mod package, which works perfectly apart from one thing, the permissions. I have managed to add the options to the permissions admin page, but whether the permissions are or are not selected doesn't matter as anyone can view the menu tab for my mod.

So can anyone help me? As this is the first mod i have created and so far so good, but i need to get these permissions sorted as i am sure most forum owners will only want to allow members to view this mods main page on the menu tab, and to not allow guests to use this mod.

Thanks,
james
« Last Edit: January 16, 2007, 02:45:55 pm by jameselder232 » Logged
SBB
Newbie
*
Offline Offline

Posts: 9


View Profile
« Reply #1 on: January 17, 2007, 12:35:17 am »

Take a look in index.template.php in your theme directory.

Down near the bottom, you'll have the function that spits out the menu tabs, which is where you put your new entry.

What'cha need to do is throw an IF around it, with the permission you created. There's two ways to do this, which you'll see as you inspect other php files -

Code:
if (allowedTo('myPermission'))
{
   spit out my menu item;
}

-- or --

Code:
if ($context['myPermission'])
{
   spit out my menu item;
}


Take a look at how the other menu entries did it, a good example would be the Calendar item. Obviously, you'll need to repeat this with any other themes you have installed.


Also make certain to assert that the user has the permission, in your mod your mod itself, in case they call it directly. Somewhere up top, you'll probably wish to throw in a

Code:
isAllowedTo('myPermission');

...before they are able to do anything bad.

Note that allowedTo( ) returns true or false; isAllowedTo( )  will invoke the "F** Off!" screen should the user not have the right.

Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Recent
[Today at 08:02:50 am]

[Today at 04:11:41 am]

[May 21, 2012, 08:54:11 am]

[May 20, 2012, 11:06:52 am]

[May 20, 2012, 05:58:11 am]

[May 19, 2012, 06:16:58 pm]

[May 19, 2012, 05:42:37 pm]

[May 18, 2012, 03:08:38 pm]

[May 17, 2012, 06:07:46 pm]

[May 17, 2012, 02:22:07 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.16 | SMF © 2006-2011, Simple Machines LLC
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 4.704 seconds with 19 queries.