Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 04:43:48 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155544 Posts in 21714 Topics by 7736 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: check if a user is admin inside a module  (Read 500 times)
Olli

Offline Offline

Posts: 290


« on: January 12, 2011, 02:18:22 PM »

hey there,

what's the easiest way to check if a user is an admin inside the backend view of a module? the only thing i found was to check the user group for beeing "1", but what do you think?

is there another way?

thanks
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #1 on: January 12, 2011, 02:27:17 PM »

Hi,

I used this code. In modify.php insert this code:

Code:
// check if user has permissions to access the yourmodulename module
require_once('../../framework/class.admin.php');
$admin = new admin('Modules', 'module_view', false, false);
if (!($admin->is_authenticated() && $admin->get_permission('yourmodulename', 'module')))
die(header('Location: ../../index.php'));


where yourmodulename is your module name (it must be exact as in database)

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Olli

Offline Offline

Posts: 290


« Reply #2 on: January 12, 2011, 03:57:40 PM »

thanks dude smiley
that helped a lot!

greeting from germany
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!