Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43261
Total Topics: 7519
Most Online Today: 297
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 282
Total: 282

Author Topic: Help with permissions with a new mod i am creating-URGENT!  (Read 4399 times)

0 Members and 1 Guest are viewing this topic.

Offline jameselder232

  • Member
  • *
  • Posts: 2
    • View Profile
Help with permissions with a new mod i am creating-URGENT!
« 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 »

Offline SBB

  • Member
  • *
  • Posts: 9
    • View Profile
Re: Help with permissions with a new mod i am creating-URGENT!
« 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: [Select]
if (allowedTo('myPermission'))
{
   spit out my menu item;
}

-- or --

Code: [Select]
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: [Select]
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.


 

Related Topics

  Subject / Started by Replies Last post
1 Replies
5880 Views
Last post September 25, 2009, 07:34:04 am
by SMFHacks
[urgent] bug

Started by exit Bugs

3 Replies
5985 Views
Last post July 02, 2010, 01:45:35 pm
by exit
6 Replies
4545 Views
Last post December 14, 2010, 12:44:20 pm
by SMFHacks
1 Replies
4207 Views
Last post December 20, 2010, 09:43:21 am
by SMFHacks
4 Replies
2881 Views
Last post August 23, 2017, 04:40:16 pm
by shuban

+- Recent Topics

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
Today at 08:27:36 am

No thumbnails on new uploads by Tonyvic
Today at 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Powered by EzPortal