miniBB ® 

miniBB

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

Hide certain forums from specific users?

 
Author Februs
Partaker
#1 | Posted: 10 Jun 2014 21:19 
I know that it's possible to define closed forums and that those forums are only visible to users whose ids have been specified but is it possible to create a forum which is visible/postable to by everyone EXCEPT a particular set of defined user ids?

Author Paul
Lead Developer 
#2 | Posted: 14 Jun 2014 16:55 
Not sure how it could matter, but you may try this code:

$deniedUsers=array(
FORUM1=>array(USER1, USER2...),
FORUM2=>array(USER1, USER2...)
);
if($forum>0 and isset($deniedUsers[$forum]) and !in_array($forum, $deniedUsers[$forum])) {
die('Not allowed');
}

Author Februs
Partaker
#3 | Posted: 15 Jun 2014 06:03 
Thanks for responding but presumably using that code the forum would still be visible. What I wanted to do was hide certain forums from certain users. Basically, the opposite of a closed forum, which is only visible to pre-defined user ids, instead what I wanted to do was have the forum visible to everyone except a pre-defined list of user ids.

Author tom322
Active Member
#4 | Posted: 15 Jun 2014 07:55 
To me Paul's reasoning and code correct (there may be a spelling mistake, ie. should probably be 'and isset'). If there is a die('Not allowed') message it logically means forum is not 'visible/accessible', isn't it :

Author Februs
Partaker
#5 | Posted: 16 Jun 2014 03:13 
tom322:
If there is a die('Not allowed') message it logically means forum is not 'visible/accessible', isn't it :
That pre-supposes the forum is either visible in the first place and a user who doesn't have access to it has tried to view it or that the user is aware of the hidden forum and is trying to access it by manipulating the URL of the forum. Also issung a die (exit) command is a little drastic.

Author Jaime
Partaker
#6 | Posted: 16 Jun 2014 08:00 
Februs:
Also issung a die (exit) command is a little drastic.
You can give the user a longer message why he has no access. Look at this example.

Author Paul
Lead Developer 
#7 | Posted: 16 Jun 2014 16:32 
I have issued just a basic code. You may take a look on how other add-ons work and how they throw out warning template instead just of die statement. If you want something more smarter and adjusted to your task, this may only come in terms of our non-free support.

I don't understand the purpose of this code, because whatever it protects, could be easily accessed.

Author Februs
Partaker
#8 | Posted: 16 Jun 2014 17:40 
Paul:
I don't understand the purpose of this code, because whatever it protects, could be easily accessed.
I've probably not explained it clearly by the sound of it.

At present, using minibb, you can create a forum which is closed and only visible to those users that you specify. All other users are unaware of its existence.

That's fine and very useful but I was asking whether it was possible to specify the ability to specify which forums are visible in a different way which was that they were visible to everyone, just like a normal open forum, EXCEPT for a list of users which you specify.

Why am I asking about this? Well let's say just as an example that your forum site has 10,000 users. One of the forums is just for admins and mods and you create that as a closed forum and just make it visible to those users, perhaps there's just 10 of them so very easy just to input the 10 ids.

But perhaps one of the other forums on your site is for, let's say, those over 18 only and your site has, again let's say as an example, just 50 users who are under 18. So, you want to make that particular forum not visible to just those 50 users. OK, you could do this by creating a closed forum and specifying 9950 user ids as being able to view it but that would be a crazy way to go about it. On top of that you'd have to keep updating the list as new members joined. So, I was asking whether it was possible to define a forum that was open, i.e. visible, to everyone EXCEPT for a list of defined user ids. Please don't take the example above literally, it's just a simple means of trying to explain the concept.

Anyway, I can try coding it for myself, I just thought it was worth asking if there was already a way of doing it.

Author tom322
Active Member
#9 | Posted: 17 Jun 2014 21:28 
Februs:
EXCEPT for a list of users which you specify.
Knowing typical forum users, they would register multiple usernames to see the 'hidden' forums and cat-mouse game starts. Unless you have invitation-only membership..

Author Februs
Partaker
#10 | Posted: 17 Jun 2014 21:36 
tom322:
Knowing typical forum users, they would register multiple usernames to see the 'hidden' forums and cat-mouse game starts. Unless you have invitation-only membership..
That's not an issue as new users apply for registration using my own bespoke software which makes numerous checks for possible duplicates. If accepted we do the registration for them. We already have several forums which are "hidden" to the general user and no-one has made a fuss about it to date so I really don't agree with your observation nor does it contribute to my original question.

Anyway, as I said previously I'll code it myself so I consider the matter closed.

Author Paul
Lead Developer 
#11 | Posted: 20 Jun 2014 17:05 
Instead of die, you may use the following code for interruption the process (it will display forum header and footer):

{
header('Status: 403 Forbidden');
$metaRobots='NOINDEX,NOFOLLOW';
$errorMSG='You are not granted to enter this forum'; $correctErr='';
$title=$title.'Not allowed';
echo load_header(); echo ParseTpl(makeUp('main_warning'));

//Loading footer
$endtime=get_microtime();
$totaltime=sprintf ("%01.3f", ($endtime-$starttime));
if(isset($includeFooter) and $includeFooter!='') include($includeFooter); else echo ParseTpl(makeUp('main_footer'));
exit;
}
My initial code above is correct so you may use it as the basic.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Hide certain forums from specific users?
 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
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑