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

djbaxter

Well-known member
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.
 

Mr. Jinx

Well-known member
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>
 

Chris D

XenForo developer
Staff member
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;
});
 

djbaxter

Well-known member
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:

Chris D

XenForo developer
Staff member
Yes, that is all you do. It works exactly the same as doing it via the Admin CP so admins can still access.
 
Top