• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

moderators can access board when it's not active like admins

Mutt

Well-known member
this is a minor hack but since I couldn't find it anywhere, here it is. I wanted the moderators to be able to access the site when I have it off too.

in \library\XenForo\ControllerPublic\Abstract.php
change line #107 from
PHP:
        if (!$options->boardActive && !XenForo_Visitor::getInstance()->get('is_admin'))

to
PHP:
        if (!$options->boardActive && !XenForo_Visitor::getInstance()->get('is_admin') && !XenForo_Visitor::getInstance()->get('is_moderator'))

I also edited the phrase "forum_is_currently_closed_only_admins_may_access" to change the word Administrators to Staff for the closed message but that's not really necessary.

----

I considered adding a ACP option to toggle where or not the mods could get in when the board was closed but then decided I was going overboard.
 
I'm getting ready to upgrade to 1.12 & realized I don't want the staff on the board for this. Here's a small edit that allows you to decide via the ACP.

you need to be in debug mode to edit ACP options

go to ACP / Options / Board Active

click "Add Option" and fill out the form as follows
Option ID: boardInactiveAllowStaff
Add-on: Xenforo ( no, i didn't make an addon name for this. I'm not sure if it's bad form to do this but whatever )
Title: Allow moderators when inactive
Explanation: Moderators can still browse board while it is inactive / closed
Edit Format: On/Off Check Box
Data Type: Boolean
Default Value: 0 ( that's a zero )

and the edit from the previous post would now be

Code:
        if (!$options->boardActive && !XenForo_Visitor::getInstance()->get('is_admin') && !(XenForo_Visitor::getInstance()->get('is_moderator') AND $options->boardInactiveAllowStaff))

now the mods can only browse if I check the "allow mods" box.

I checked & the line is still #107 in v1.1.2
 

Attachments

  • Screenshot_1.webp
    Screenshot_1.webp
    14.7 KB · Views: 68
Top Bottom