Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options
Changing the default page for unathenticated users?
dan39
New
If you have a private forum, and you want the unauthenticated users to be forwarded to an "about" page, for example, (rather than the sign-in page, which is currently the default behavior), how do you set that up? I feel like this should be pretty easy, but I don't want to do it incorrectly.
Any help would be greatly appreciated. Thanks.
0
This discussion has been closed.
Comments
I think I found the part of the Vanilla Core that handles this (in library/People/People.Class.Session.php):
function Check(&$Context) { if (($this->UserID == 0 && !$Context->Configuration['PUBLIC_BROWSING']) || ($this->UserID > 0 && !$this->User->PERMISSION_SIGN_IN)) { if ($this->UserID > 0 && !$this->User->PERMISSION_SIGN_IN) $this->End($Context->Authenticator); header('location: '.AppendUrlParameters($Context->Configuration['SAFE_REDIRECT'], 'ReturnUrl='.GetRequestUri())); die(); } }
How exactly does one modify that and turn that into a sound extension? (Or is that not the way to go.)
1. Using PageManager, make the 2 pages, we'll call them MEMBER and GUEST.
2. Using PageManager make another page we'll call it DOOR
The PageManager DOOR contains this...
<?php if ($this->Context->Session->UserID > 0) { $URL="http://path.to/forum/?Page=MEMBER"; header ("Location: $URL"); } else { $URL="http://path.to/forum/?Page=GUEST"; header ("Location: $URL"); } ?>
3. One more step, in your .htaccess file put this...
RewriteEngine On Options +FollowSymLinks -Multiviews RewriteCond %{QUERY_STRING} ^$ RewriteRule ^$ ?Page=DOOR [L]
How does it work?
The .htaccess file makes the PageManager page DOOR the default, it then discriminates between MEMBER or GUEST and re-directs accordingly.
Simple enough?
Posted: Sunday, 1 April 2007 at 3:37PM
But, your solution is a bit more than I needed. I already had an html page handy, so I just needed a simple redirect. I used Mr. Do's approach, but I used the logic from the People.Class.Session file to do a check to see if the forum was set to "Private" before performing the redirect on users that weren't logged in. I also allowed people.php to be exempt from the redirect so that users would be allowed to login.
The addon is now available here for anyone who wants it.
Massive edit:
I don't have mod_rewrite installed, apparently.
This guide has a good paragraph on how to check to see if it's installed or not:
http://www.workingwith.me.uk/articles/scripting/mod_rewrite
Posted: Sunday, 9 September 2007 at 11:59AM
thanks
$Context->Configuration['SAFE_REDIRECT']
to whatever URL you desire...The downside is that if your forum is public, SAFE_REDIRECT will never be used, but given the scenario that was set-up in the first post, we're dealing with private forum anyway.
i have tried the default page extension, but i have a couple of issues with it
(i' ve added the lines wanderer suggested in the .htaccess file that dinoboff showed somewhere here)
It's been in use on my forum for over a year and it works flawlessly.
Changing the default page for unathenticated users? # 4
Posted: Thursday, 29 May 2008 at 6:32AM
i'll try again tomorrow (1 a.m. here :P) to see if it's some incompatibility between the configuration in the httpd.conf and the .htaccess or what