miniBB ®

miniBB

®
Support Forums
  
 · Start · Sign in · Register · Search · Statistics · File Bank · Manual ·
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

How to make addons such as File Bank, Checker, Polls available for Admin & Moderators only?

 
Author Steve Shaw
Partaker
#1 · Posted: Yesterday 14:37
Hi Paul,

One of our forums really doesn't use File Bank, Checker, and Polls, while another does.
For the forum that doesn't use them, I would like to remove access for Users, but keep the options available for Admin & Moderators.
(And for this forum I probably don't want the users having access to the File Bank anyway...)

I've been searching the addons files, as well as searching this Forum, and I can't find if there are setting options readily available?

Steve

Author Paul
Lead Lead Developer
#2 · Posted: Yesterday 15:57
Steve Shaw:
I can't find if there are setting options readily available?
They could be surely available, coded as the custom plugin — or actually additions to the current add-ons' codes.

In all cases below, look up/edit the codes in bb_plugins.php.

******************************

File Bank

1. The solution below affects the File Upload button displayed in BB-buttons list above the posting form.

— Look up for the string code which says: /* if you would like to enable access to storage for registered users only, uncomment the code line below */ — it's met 2 times. Under the first string, there will be the code like //if($user_id>0){ and after the second it's followed by the closing bracket like //}

— In both cases, remove the double slash in front of the code

— In the first case, replace

if($user_id>0){
with

if($logged_admin==1 or checkModerator($mods,$user_id)){
2. The solution below affects the File Bank link displayed in the top navigation menu items for the forum.

— Look up for the string code which says: /* if you would like to display link to storage in forums menu for registered users only, uncomment the code below and alter it with the next line */ — in this code section, you will find three lines of codes commented with double slashes:

//if($user_id>0) {
...
...
...
//}
//else $storageLink='';
— Remove double slashes in front of these codes

— Replace the code which says

if($user_id>0) {
with

if($logged_admin==1 or checkModerator($mods,$user_id)){
3. The solution below affects the access to all File Bank functions, not just menus.

— Look up for the string code which says: /* if you would like to enable access to storage for registered users only, uncomment the code below, and comment the line after it */

— Below this line, you'll see the code like:

//if($action=='storage' and $user_id>0) include($pathToFiles.'addon_storage.php');
if($action=='storage') include($pathToFiles.'addon_storage.php');
Change it to:

if($action=='storage' and ($logged_admin==1 or checkModerator($mods,$user_id))) include($pathToFiles.'addon_storage.php');
For this add-on, also make sure that in addon_storage_options.php you've set this option with the value:

$anonymousAccess=FALSE;
******************************

Checker

— Locate the block of the code which starts with /* Checker top link */

— Below this comment, you'll see the code like this:

if($user_id>0 and $action!='checker'){
Change it to:

if(($logged_admin==1 or checkModerator($mods,$user_id)) and $action!='checker'){
— If you'd like to completely disable users access to the Checker, look up for this code:

if($action=='checker') include($pathToFiles.'addon_checker.php');
You have to put the condition inside of this code:

if(($logged_admin==1 or checkModerator($mods,$user_id)) and $action=='checker') include($pathToFiles.'addon_checker.php');
******************************

Polls

— Open addon_polls_options.php file for editing, and there you have to set the option like this:

$createPolls=1;
This should allow only Admin/Moderators to create Polls, and if it's set this way, regular users should not see the Polls BB-button above the posting form, nor they should be able to do via from the Polls list link. If it doesn't work that simple way, let me know.

If you'd like to remove the link to Polls from the forum navigation menu, look up for the code containing $menuPolls, it would look like:

if(!(isset($is_mobile) and $is_mobile)) $menuPolls="<a href=\"{$main_url}/{$indexphp}action=polls\" class=\"mnblnk\">{$l_plPolls}</a> {$l_sepr} ";
else $menuPolls="<option value=\"{$main_url}/{$indexphp}action=polls\">{$l_plPolls}</option>";
You have to put the conditions above and below this code, similarly to the solutions above for the other add-ons:

if($logged_admin==1 or checkModerator($mods,$user_id)){
if(!(isset($is_mobile) and $is_mobile)) $menuPolls="<a href=\"{$main_url}/{$indexphp}action=polls\" class=\"mnblnk\">{$l_plPolls}</a> {$l_sepr} ";
else $menuPolls="<option value=\"{$main_url}/{$indexphp}action=polls\">{$l_plPolls}</option>";
}

Author Steve Shaw
Partaker
#3 · Posted: Yesterday 19:33
Thanks Paul — but I guess I have an old 'bb_plugins.php' file.
I have no line that say: /* if you would like to display link to storage in forums menu for registered users only, uncomment the code below and alter it with the next line */

I also have no line in 'addon_polls_options.php' I have no line that says:
if(!(isset($is_mobile) and $is_mobile)) $menuPolls="<a href=\"{$main_url}/{$indexphp}action=polls\" class=\"mnblnk\">{$l_plPolls}</a> {$l_sepr} ";
else $menuPolls="<option value=\"{$main_url}/{$indexphp}action=polls\">{$l_plPolls}</option>";

Steve

Author Paul
Lead Lead Developer
#4 · Posted: Yesterday 21:48
Steve Shaw:
I have no line that say
Ok, but did you find the line from the 1st solution mentioned above?

You could try to search just by $storageLink
The code which should be extended with the provided conditions, should look similar.

As about the Polls, the code mentioned to change is in bb_plugins.php.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 How to make addons such as File Bank, Checker, Polls available for Admin & Moderators only?
Share Link Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.