MyBB Community Forums

Full Version: Require Admin ONLY permission.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi People,

I have this syntax to check the "User"

if($mybb->user['uid'] !== "0") 

Echo "etc...................


Can someone tell me what the syntax is for checking user-Admin ONLY ??

Thanks.
Never mind... I found it. Toungue
Umm!

Well I thought I had it... Sad

But I'm using a mix of html and php.

I realise (I think) that the 'else' command has to be encapsulated in <php quotes.

I also found that Admin-type permission needs an argument (I think)..

Anyone want help by giving me two arguments, as I would like to make any MODS that I make Hacker-Free.. It's not a desperate situation, as any hacker would have to break the existing MOD's code anyway.. But it can only help to improve the integrity of MyBB MODS.

So what I need is: (Because I can't find examples outside of MyBB).

Admin permission: using Pure-php code.

Admin permission: using html and php code.

And Appropriate credits will be given such as:

Put together by Ozidave and "Rescued" by 'whoever', or something MORE serious.. Toungue
Try these:
<?php
if($mybb->user['usergroup'] != "4")
{
nopermission();
}
else
{
// Your Code
}
?>
<?php
if($mybb->user['usergroup'] != "4")
{
nopermission();
}
else
{
?>
// Your HTML-Code
<?php
}
?>
Toungue

Michael,

You're a blessing disguised as an angel.. Big Grin

So the group permission has bearing on who can access what, (I assume).

I'll try that tomorrow, as time is pushing on here... If it was flat-file/perl, I could work it out in 5 mins... But it ain't. Toungue

Ciao!
If you have more than one administrators group:

if($mybb->usergroup['cancp'] == 'yes')

That's what you should use.
Wink

Thank you very much to both of you. That should now secure the editors against any mischievous member who is logged in and would be able to access the .php file.

Big Grin