I wanted to disable the server settings part of the acp to all hosted forums but not my base install so I thought id share how I did it.
Open the php file with the content you want to disable. For me and most acp actions /admin/index.php will do.
paste in this code below "require_once MYBB_ADMIN_DIR."/inc/functions.php";"
PHP Code:
$disabledpage = "INSERT PAGE HERE"
if($_SERVER['REQUEST_URI'] == $disabledpage)
{
error('Sorry this area of the ACP is disabled for security reasons. Please press your browsers back button to continue.');
}
Make sure to replace "INSERT PAGE HERE" in the code above with the path from a hosted forums subdomain to the end or the url of the page you want to disable (including the preceding slash).
for instance:
I want to disable "http://www.testboard.ardougne.net/admin/index.php?module=config/settings&action=change&gid=17" so I replace it with "/admin/index.php?module=config/settings&action=change&gid=17"
Oh, cool. I never thought of that. This will prevent users from changing the mod_rewrite settings.
Nice! You can also use the table_prefix from the DB to do the same too though. There's also one other way I think I built in to do this as well, but this is very simple.

Aye! Also note: If an error comes up "Call to undefined function" then either move the code to below the functions include as I said above or change error to die. I prefer to use error though

. Also you can make the error appear in the standard acp theme by including the file with the page class and running $page->output_header() and the same for footer etc.
Also note this isn't very secure as I could get round it by adding an extra "GET bit" (phpers will know what I means) into the url so only use it for bits that you "prefer" people dont have access to. Gzip settings for example, i'd rather they don't change em but if they do its not the end of the world.
Hi. I tried to add
PHP Code:
$disabledpage = "/mybb/admin/index.php?module=config/settings&action=change&gid=17"
if($_SERVER['REQUEST_URI'] == $disabledpage)
{
error('Sorry this area of the ACP is disabled for security reasons. Please press your browsers back button to continue.');
}
after
PHP Code:
require_once MYBB_ADMIN_DIR."/inc/functions.php";
in admin/index.php
but I get this error:
Quote:Parse error: syntax error, unexpected T_IF in /home/eforum/public_html/mybb/admin/index.php on line 37
Any ideas what's wrong? I tried replacing " with ' but that didn't help. Thanks in advance..
(04-16-2009 10:44 PM)Shade Wrote: [ -> ]Hi. I tried to add
PHP Code:
$disabledpage = "/mybb/admin/index.php?module=config/settings&action=change&gid=17"
if($_SERVER['REQUEST_URI'] == $disabledpage)
{
error('Sorry this area of the ACP is disabled for security reasons. Please press your browsers back button to continue.');
}
after PHP Code:
require_once MYBB_ADMIN_DIR."/inc/functions.php";
in admin/index.php
but I get this error:
Quote:Parse error: syntax error, unexpected T_IF in /home/eforum/public_html/mybb/admin/index.php on line 37
Any ideas what's wrong? I tried replacing " with ' but that didn't help. Thanks in advance..
Use this instead:
PHP Code:
$disabledpage = "/mybb/admin/index.php?module=config/settings&action=change&gid=17";
if($_SERVER['REQUEST_URI'] == $disabledpage)
{
error('Sorry this area of the ACP is disabled for security reasons. Please press your browsers back button to continue.');
}
It was missing a semi-colon.
Also, I would suggest not using /mybb/admin and instead just using /admin since doing it the other way will only block you and not your members.
Hi,
It'd be better if you could add a "higher" admin, that could access this. So you could change it for one board, but they can't change it themselves.
Cool mod though.
I think you can change it in the database though if you really needed to.
Please wrote step on step what i must do to disable any element on my multiforums to forums
It says in the first post?