XF 2.1 How to turn off forum via config.php or CLI?

djbaxter

in memoriam 1947-2022
Long story but one of the XF2 forums is being restored from backups after a major server crash.

I need to make sure no one can log in and post when the site comes back online until I have a chance to check everything out.

How can I turn the forum off remotely, perhaps via config.php or CLI?

I did do a search but couldn't find anything directly relevant to this.
 
As far as I know there is no CLI option, but you can adjust your .htaccess file in the root folder, and put something like 'deny from all'.
This way nobody can access your forum. You can add 'allow from <your ip>' so you can take a look.
Code:
order deny,allow
deny from all
allow from <your ip>
 
You can programmatically set option values at run time via src/config.php:

PHP:
$c->extend('options', function(\ArrayObject $options)
{
   $options->boardActive = false;
   return $options;
});
@Chris D

So I just add those lines to config.php?

I still need admins to be able to access the forum.
 
Last edited:
Top Bottom