Allow ONLY one user to browse forum 0.1
This plugin (made by me, Pirata Nervo) locks the access to EVERY user (except one) to a desired forum.
This plugin blocks the access to any user who wants to browse a specific forum.It requires 2 very simple code modifications.
It is useful if you want to keep data on your site that you dont want to share with anyone.
IN ADMIN/MODULES/CONFIG/SETTINGS.PHP
FIND
PHP Code:
// Change settings for a specified group.
if($mybb->input['action'] == "change")
{
BELOW ADD:
PHP Code:
if ($mybb->user['uid'] != 1 && $mybb->input['gid'] == 42)
{
flash_message("Error: you do not have permissions to edit this setting", 'error');
admin_redirect("index.php?module=config/settings");
}
CHANGE "42" (WITHOUT QUOTES) TO THE GROUP ID OF THIS PLUGIN. (The group ID
can be found in settings, place the mouse over "Allow user to browse forum
by Pirata Nervo" and you should see the url on the bottom. the Group ID is
the &gid=NUMBER HERE.
This part of the code allows only the user #1 to edit the settings of this
plugin.
IN FORUMDISPLAY.PHP
FIND
PHP Code:
$plugins->run_hooks("forumdisplay_start");
$fid = intval($mybb->input['fid']);
ADD BELOW:
PHP Code:
if ($mybb->settings['allowuser_uid'] > 0 && $mybb->settings['allowuser_fid'] > 0)
{
if ($mybb->user['uid'] != $mybb->settings['allowuser_uid'] && $fid == $mybb->settings['allowuser_fid'])
{
error_no_permission();
}
}
This part of the code blocks the access to every user (except the one
specified in the settings).