PDA

View Full Version : Guests cannot view threads


LanciaStratos
08 Sep 2001, 18:24
I want to block guests from viewing individual topics. (e.g. A guest enters the forum home page, clicks on a forum, sees the topic titles, click on a topic title, and is then asked to log-in or register.)

I know that there is a similar option in the AdminCP that prevents guests from "viewing other's topics", but it makes each forum appear blank, as if there were no topics at all. :(

Hopefully someone can help, as I believe this would be a hack that others would appreciate as well. :)

tweak
08 Sep 2001, 22:20
All done in your CNTRL panel

User Groups and Permissions
Add | Modify
Modify forums <-------HERE

LanciaStratos
09 Sep 2001, 03:38
Tweak, please read my post again.

I know that there is a similar option in the AdminCP that prevents guests from "viewing other's topics", but it makes each forum appear blank, as if there were no topics at all.This is the "similar option" that I'm mentioning, and that's the effect that it creates (which isn't what I want).

showthread.php is really the only thing I don't want guests to see...

Chen
09 Sep 2001, 09:07
Try this.
In your showthread.php, add the code in red


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


and also this


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


This should work (untested).

LanciaStratos
09 Sep 2001, 18:12
Thanks FireFly, but it didn't work. :( Showthread.php only returned this error:

Fatal error: Call to undefined function: show_nopermission() in /home/gtplanet/public_html/forums/showthread.php on line 442

Chen
09 Sep 2001, 18:14
Oh right, global.php was yet to be included. I'll work something out and post it here. :)

LanciaStratos
09 Sep 2001, 18:15
Sounds great, thanks! :)

Chen
09 Sep 2001, 18:18
Undo all changes. :)

Add the code in red in all 4 places.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Now it has to work. :)

LanciaStratos
09 Sep 2001, 18:40
Uh-oh, now I'm getting a new error:

Parse error: parse error in /home/gtplanet/public_html/forums/showthread.php on line 448

I'm almost positive I placed the code in all the right places, I've checked and re-checked. But, here's a copy of my (modified) showthread.php file, if you'd like to look at it.

Chen
09 Sep 2001, 18:42
You dropped one } right before that ### block that says showthread.

(also remove that file)

LanciaStratos
09 Sep 2001, 18:54
Ah, it works like a charm! You are the man, and I appreciate all your help! :D

(also remove that file)Oops...I hadn't even thought about that. :eek: Thanks for letting me know!

amykhar
11 Sep 2001, 00:41
Any way this could be set up on a forum by forum basis? I only have a handful of forums that guests are not allowed to read. The rest are open to lurkers in order to lure in new members.

I know, I am a royal pain :D I guess I just like to do things the hard way.

Amy

p.s. Firefly you have been cranking out some darn good stuff lately. Thank you for your efforts.

Chen
11 Sep 2001, 13:04
Thanks amykhar. :)

To do it per forum, undo all changes you (might) did to showthread.php.

Now, add what's in red (in showthread.php):


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Note: appears twice, add in both places.
This will prevent all guests from viewing threads in forums 1, 2, 3 and 4.

LanciaStratos, undo all changes.
Add what's in red:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Same note, do it twice.
(no difference, just "nicer")

amykhar
12 Sep 2001, 14:53
One small oops firefly :)

$thread['forumid']!=1 should be $thread['forumid']==1

(and for the other forums as well).

It works like a charm though. Thank you.

See it in action:

http://www.eaforums.com/forumdisplay.php?forumid=28


Amy

Chen
12 Sep 2001, 15:01
D'oh, of course. :)
You're welcome.

Scott MacVicar
12 Sep 2001, 15:54
The ability to ban certain user groups from certain forums is already integrated in to vBulletin.

Within the Admin Panel there is a Groups are Permissions section, click the "modify forums" part and you can edit access permission for certain user groups within certain forums. Which includes stopping them from reading posts within certain forums.

Chen
12 Sep 2001, 16:16
Yes, but
Originally posted by LanciaStratos
I know that there is a similar option in the AdminCP that prevents guests from "viewing other's topics", but it makes each forum appear blank, as if there were no topics at all. :(
and that's not what he wants.

Scott MacVicar
12 Sep 2001, 20:18
simply remove
if (!$getperms[canviewothers]) {
$limitothers="AND postuserid='$bbuserinfo[userid]'";
}

from forumdisplay.php
around line 276.

There is something similar to that in viewthread.php so settings Can View Others to NO will allow them to view a list of threads but not the thread itself.

I already removed those 3 lines from my board as it was an annoyance.

LanciaStratos
13 Sep 2001, 00:51
Originally posted by PPN
simply remove
if (!$getperms[canviewothers]) {
$limitothers="AND postuserid='$bbuserinfo[userid]'";
}

from forumdisplay.php
around line 276.

There is something similar to that in viewthread.php so settings Can View Others to NO will allow them to view a list of threads but not the thread itself.

I already removed those 3 lines from my board as it was an annoyance. Ah, that also works very well! :)

NYI Fan
04 Nov 2001, 20:22
Hi all

I had Firefly's tweak working perfectly in 2.0.3, but now in 2.2.0 no go
The fix may be obvious, but I can't seem to get it working again...

any help would be most appreciated!

(I think i goofed and posted this in the wrong place - if so can a mod please move it to correct forum for me? Sorry!!)

Scott MacVicar
04 Nov 2001, 21:02
Mine will work on vb 2.2.0

its located on line 306-308 now and its changed format

looks like

if (!$getperms[canviewothers]) {
$limitothers="AND postuserid='$bbuserinfo[userid]'";
}

NYI Fan
04 Nov 2001, 21:10
Thanks PPN
will try that

any specific directions I need, other than what you posted??

Scott MacVicar
04 Nov 2001, 21:23
Go to the guest permissions and set Can View Others to NO.

This will stop guests from viewing threads in all forums but they can see the thread titles.

NYI Fan
04 Nov 2001, 21:39
Worked like a charm!

Thanks much!

Scott MacVicar
04 Nov 2001, 22:51
look at
http://www.vbulletin.org/forum/showthread.php?s=&threadid=32132

for a better solution, this allows you to turn it on in a forum by forum basis.

freakyshiat
27 Oct 2002, 07:20
I need to restric usergroup 0 and 4.
How can i change this to add 0 and 4?

if ($bbuserinfo[userid]==0) {
show_nopermission();
}