miniBB ® 

miniBB

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

Guests should not be able to even view the forums / Disable viewing of /hide forums unless logged in

 
 
Page  Page 1 of 2:  1  2  Next »

Author Xonium
Partaker
#1 | Posted: 11 Oct 2005 21:26 
Hello!

I want to make so that people who are not logged in should not be able to view the topics in my forum. I bet there is an easy way to do this. I just don't know how ;). All help is appreciated.

EDIT: i made that 3:rd post :P

/Simon

Author lime
Partaker
#2 | Posted: 11 Oct 2005 21:43 
In setup_options.php uncomment the line
//$allForumsReg=TRUE

Author Anonymous
Guest
#3 | Posted: 11 Oct 2005 21:55 
No it just makes so unregistered users can't post.

They should not even be able to view topics!

Author lime
Partaker
#4 | Posted: 12 Oct 2005 01:08 
Oh ok try this then (also from the manual)

$protectWholeForum = 0; Should we protect all forums by one password? If value is 1, two values below are defined as well. Else set to 0.
$protectWholeForumPwd = 'SOME_PWD'; Password for protecting the whole forum.

Author Team
8-)
#5 | Posted: 12 Oct 2005 10:59 
Here is also another solution which we use on one community - it has all closed forums set up with $clForums and $clForumsUsers arrays (RTFM for more), but the following manner:

$clForums=array(1,2,3,4,5,6,7,8,9);
$clForumsUsers=array();
foreach($clForums as $k) $clForumsUsers[$k]=array();

So we automatically define all private forums here, but not allow any users enter here.

Further, at the end of your language pack(s), paste this code:

if(!isset($clForums)) $clForums=array();
if($user_id!=0) {
foreach($clForums as $k) if(!in_array($user_id, $clForumsUsers[$k])) $clForumsUsers[$k][]=$user_id;
}
else $startPageModern=FALSE;

Author Xonium
Partaker
#6 | Posted: 12 Oct 2005 14:31 
Ok, thx alot! I will try this

Author vinok
Guest
#7 | Posted: 13 Oct 2005 17:23 
Team

the solution you suggested does it display a message like these forums are for registered members only! or something like that?

Author Team
8-)
#8 | Posted: 13 Oct 2005 18:11 
You need to create this message yourself. At the forums header, footer or whatever. miniBB doesn't know what is your community created for, so use your imagination.

With this solution, when you visit forums and if you are unlogged, you just see login/password box and not forums listing. Until you log-in.

Author vinok
Guest
#9 | Posted: 14 Oct 2005 20:25 
cheers Team just to re-assure everyone the code works :D

Author Anonymous
Guest
#10 | Posted: 8 Nov 2006 16:54 
9 Nov 2006 03:54 - Attached on merging:
Disable viewing of forums unless logged in

Hi

I have looked at the forums extensively but I am unsure how to proceed.

I do not want the forum list to be viewable at all until a user has logged in.

I read in the forums to use

$clForums=array();
$clForumsUsers[]=array();

in the bb_specials.php file.

However this seems to me that an administrator would have to edit this code each time a new forum is added by the administrator.

I owuld like it that an administrator does not have to do this

Have you any fixes.

I got this hack in the forums:

/* Hack - hiding all forums from not logged users */
if($forum!=0 and $user_id==0) {
if(!isset($clForums[$forum]
)) $clForums[]=$forum;
if(!isset($clForumsUsers[$forum])) $clForumsUsers[$forum]=array();
}
/* --Hack - hiding all threads from not logged users */

Its a start but the forums are still listed under the username and password entry. I do not want them listed until a user has successfully logged in.

Many thanks for your help

Fergal.

Author Team
8-)
#11 | Posted: 9 Nov 2006 04:07 
Check the above solution.

If you want all forums hidden automatically, then additional SQL request is needed. You need to paste at the very top of bb_plugins.php the following:

if($action=='' and $user_id==0){
$startPageModern=FALSE;
$clForums=array();
$clForumsUsers=array();
if($rf=db_simpleSelect(0,$Tf,'forum_id')){
do{
$clForums[]=$rf[0];
if(!isset($clForumsUsers[$rf[0]])) $clForumsUsers[$rf[0]]=array();
}
while($rf=db_simpleSelect(1));
}
}

This is a not-core-destructive solution and will work a bit slow, if you have large amount of forums... but if you want to make it faster, you need straight to modify files like bb_func_vforum.php, bb_func_ldisc.php and include if($user_id>0)... condition there, when forums and latest discussions are displayed. Don't ask how... we're not providing free core-destructive solutions here.

You also need to keep Hack - hiding all forums from not logged users, and $clForums=array(); must be kept in bb_specials.php amongst the piece of code shown above.

Author hubba
Guest
#12 | Posted: 7 Sep 2007 14:01 
thanks a lot. it works pretty well.

one last thing though:
is it possible to prevent the empty <table .forums> (the table-header) from being displayed? how to do this?

Author Paul
Lead Developer 
#13 | Posted: 8 Sep 2007 11:03 
hubba
Try to implement the following:

- in bb_plugins.php, top part, paste:

/* Hiding forums header for non-visible forums for guests */
if($action=='' and $user_id==0){
$forumOutput1=''; $forumOutput2='';
$startPageModern=FALSE;
}
elseif($action=='' and $user_id>0){
$forumOutput1=<<<out
<table class="tbTransparent">
<tr>
<td class="tbTransparentCell"><span class="views txtSm">( {$l_forums} | <span class="author">{$l_num_topics}</span> | <span class="latest">{$l_replies}</span> )</span></td>
</tr>
</table>
<table class="forums">
out;

$forumOutput2=<<<out
<tr>
<td style="width:25px;"><img src="https://www.minibb.com/forums/img/p.gif" style="width:25px;height:1px" alt="" /></td>
<td style="width:90%"><img src="https://www.minibb.com/forums/img/p.gif" style="width:1px;height:1px" alt="" /></td>
<td style="width:5%;"><img src="https://www.minibb.com/forums/img/p.gif" style="width:1px;height:1px" alt="" /></td>
<td style="width:5%;"><img src="https://www.minibb.com/forums/img/p.gif" style="width:1px;height:1px" alt="" /></td>
</tr>
</table>
out;
}
/* --Hiding forums header */

(this is actually what stand for the parts of the table heading code)

- instead of the straight HTML templates/main_forums.html contains, there should be this:

{$forumOutput1}
{$list_forums}
{$forumOutput2}

note that you still need to keep the part of the code which provides {$user_logging}.

Author hubba
Guest
#14 | Posted: 18 Sep 2007 11:13 
took me a while to find it in templates/main_forums.html :)
works perfectly!
thanks!

Author Sir Igor
Guest
#15 | Posted: 27 Feb 2008 03:09 
These solutions didn't work any more with the newest version 2.2.

This one makes the username and password fields invisible.

if($action=='' and $user_id==0){
$clForums=array();
$clForumsUsers=array();
if($rf=db_simpleSelect(0,$Tf,'forum_id')){
do{
$clForums[]=$rf[0];
if(!isset($clForumsUsers[$rf[0]])) $clForumsUsers[$rf[0]]=array();
}
while($rf=db_simpleSelect(1));
}
}


And with this solution I confronted also problems (I don't know however is this a minibb version problem at all). I think this works fine if one doesn't need to specify more restrictions.

$clForums=array(1,2,3,4,5,6,7,8,9);
$clForumsUsers=array();
foreach($clForums as $k) $clForumsUsers[$k]=array();


If I for example want to have a separate moderator forum in addition to hide all forums for guests. The solution I tried didn't work at all:


// hide for guests
$clForums=array(1,3,4,5,6,7,8,9);
$clForumsUsers=array();
foreach($clForums as $k) $clForumsUsers[$k]=array();

// hide all but the moderator
$clForums=array(2);
$clForumsUsers[2]=array(2);

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Guests should not be able to even view the forums / Disable viewing of /hide forums unless logged in
 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
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑