The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Disallow guests to view threads, must register first Details »» | |||||||||||||||||||||||||||
Disallow guests to view threads, must register first
Developer Last Online: Jun 2020
Yes I know that there is already a a feature to stop guests from viewing threads, but then this also shows all the posts and threads counters to zero, and under Last Post it will say never (which sucks ). But, with my hack, it just asks guests to either login or register when viewing a thread and still shows all the right numbers
Instructions Open archive/index.php and find PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
Show Your Support
|
Comments |
#137
|
||||
|
||||
Quote:
$bbuserinfo, $usergroupid and print_no_permission() is the same for vB3 in all Versions right now. |
#138
|
|||
|
|||
Hi Onkel Tom,
Does it work with 3.0.3 ? I have tried Gary W's code but unfortunately it works for all usergroups (don't know why???) not just guest/not logged in, so if you could post the instruction from scratch for all the files, it would really help me. I think I'm in the same boat with IndyWebDesign. Quote:
|
#139
|
||||
|
||||
Quote:
Your find the instruction of the Hack in the first post. I only changed some parts for better fitting on my own wishes, so I posted my code which is working for the most recent search engines. This code can be placed in /archive/index.php to allow search engines which are written in the code to index this pages. If you want to use my code instead of Gary W's code for the archive just replace in /archive/index.php: Code:
if ($bbuserinfo['userid'] == 0 AND !preg_match("#(google|slurp@inktomi|yahoo! slurp)#si", $_SERVER['HTTP_USER_AGENT'])) { print_no_permission(); } Code:
$grouparray = array ( 3,4); if (in_array($bbuserinfo['usergroupid'],$grouparray) OR $bbuserinfo['userid'] == 0 AND !preg_match("#(google|slurp@inktomi|yahoo! slurp|lycos|ask jeeves|scooter|fast-webcrawler|turntinbot|msnbot|webcrawler|Infoseek|W3C_Val|googlebot)#si", $_SERVER['HTTP_USER_AGENT'])) { echo "<center><font face=verdana, arial, helvetica size=3>You are not allowed to show our archive.<br><br>Your have to <a href=\"$vboptions[bburl]/register.php?\">register</a> first at $vboptions[bbtitle] to show threads in our forums.<br><br>If you are registered at our forum it could be that you are not logged in our your account must first be checked and enabled from an Administrator.</font></center>\n<hr />\n"; print_no_permission(); } Code:
!preg_match("#(google|slurp@inktomi|yahoo! slurp|lycos|ask jeeves|scooter|fast-webcrawler|turntinbot|msnbot|webcrawler|Infoseek|W3C_Val|googlebot)#si", The echo syntax is only for index.php of archive because if you use this code and a unauthorised person will access the archive only a white page is shown. Therefore I added the echo information to the screen to show "what is wrong". I used the "$grouparray = array ( 3,4); " function to define my usergroups which are not allowed to access the archive. You can put here any usergroup ID you want not to access your archive separated by ",". Usergroup 8 and 11 are defined groups from my board, just remove that both group ID's. I hope I could help and the instructions are easy to understand |
#140
|
|||
|
|||
Very cool, I will try this. Thanks a lot man!!!
|
#141
|
|||
|
|||
Tried it, looks great! Many thanks to you....
|
#142
|
|||
|
|||
great job,
Install |
#143
|
|||
|
|||
I read a few pages of this topic and I don't see my question answered.
It might be in the other pages but anyway here it is: Is there a way to let my guests see the News forum topics and not be able to open the others? |
#144
|
||||
|
||||
installed
|
#145
|
|||
|
|||
I've been playing around with this hack and MAY have come up with a forumula to allow spiders to still view threads while denying permission to guest. I am not a coder by trade so please check this code out and see if it works for you. I've been running it about 3-4 hours and it seems spider friendly on my site.
There are three files to change and one file to upload. archive/index.php includes/functions.php showthread.php Upload this file and place in your forum root directory and the archive directory. spiders.txt Open archive/index.php and find: Code:
$title .= ' - ' . $foruminfo['title']; } else { $do = 'index'; } Code:
if (restrict_guest($bbuserinfo['userid'])) { print_no_permission(); } Code:
globalize($_REQUEST, array('perpage' => INT, 'pagenumber', 'highlight' => STR, 'goto')); Code:
if (restrict_guest($bbuserinfo['userid'])) { print_no_permission(); } Code:
if ($bbuserinfo['userid'] == 0 or $bbuserinfo['usergroupid'] == 3) { print_no_permission(); } Code:
if ($bbuserinfo['userid'] == 0 or $bbuserinfo['usergroupid'] == 3 and !$spider_flag) { print_no_permission(); } Code:
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR $bbuserinfo['userid'] == 0)) { print_no_permission(); } Code:
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR ($bbuserinfo['userid'] == 0 AND !$spider_flag))) { print_no_permission(); } Code:
?> Code:
function restrict_guest($user_id) { global $_SERVER, $spider_flag; $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); $spider_flag = false; if ($user_agent != "") { $spiders = file('./spiders.txt'); for ($i=0, $n=sizeof($spiders); $i<$n; $i++) { if (!empty($spiders[$i])) { if (is_integer(strpos($user_agent, trim($spiders[$i])))) { $spider_flag = true; break; } } } } if ($user_id == 0 AND !$spider_flag) { return true; } return false; } |
#146
|
|||
|
|||
Thanks Gary.
|
#147
|
|||
|
|||
Yea I needed this, I was waiting for this!!
|
#148
|
||||
|
||||
Quote:
I have installed this hack with gr8 results... my only problem is that i have a links partner section on the main forum itself... now what is happening is that when these link partners try to periodically locate their links in the forum they get the access denied message and they remove my links from their website. Just as we did with archive section... Can we also exclude a selected forum from being affected by this hack. i mean that single particular forum should available as usual to anyone and everyone without any restriction. Please guide me otherwise i am left with no option but to compromise on this hack. Regards |
#149
|
|||
|
|||
before i install this, does it work with vb 3.0.3?
|
#150
|
|||
|
|||
Quote:
Works on mine! See here, for a protected forum: http://www.allbowling.com/forum/forumdisplay.php?f=11 |
#151
|
||||
|
||||
Quote:
I am just about to install this and just wanted to check what you were doing. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|