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.
Land on first page, but need to sign-in to read
Hi,
I wanted to check if it would be possible to configure vanilla, so that unauthenticated users can come to first page, to see all the discussion topics but would need to sign in, to read the discussions and also to comment.
At the moment if I uncheck the configuration 'Allow non-members to browse the forum', the visitor is taken directly to sign-in form, but I want him to come to front page to see all the discussion topics and sign in to read them.
Something like it happens in on forum at softwareceo.com
http://www.softwareceo.com/forums/forumdisplay.php?f=4
Thanks a lot in advance.
- Vinx
0
This discussion has been closed.
Comments
Something like:
if ($Context->Session->UserID == 0 && !in_array($Context->SelfUrl, array(people.php, index.php)) { header('location: '.AppendUrlParameters($Context->Configuration['SAFE_REDIRECT'], 'ReturnUrl='.GetRequestUri())); die(); }
Open up the folder and create a new file called "default.php".
Open up default.php and put this inside:
<?php /* Extension Name: Sign In To Read Extension Url: http://lussumo.com/addons Description: Makes it so that unauthenticated users can see the discussions, but not the comments. Version: 1.0 Author: Mark O'Sullivan Author Url: http://lussumo.com */ if ($Context->Session->UserID == 0 && !in_array($Context->SelfUrl, array(people.php, index.php)) { header('location: '.AppendUrlParameters($Context->Configuration['SAFE_REDIRECT'], 'ReturnUrl='.GetRequestUri())); die(); } ?>
Save the file. Then sign into vanilla as an administrator and go to the settings tab > extensions. Find the extension in the list and enable it.
<?php /* Extension Name: Sign In To Read Extension Url: http://lussumo.com/addons Description: Makes it so that unauthenticated users can see the discussions, but not the comments. Version: 1.0 Author: Mark O'Sullivan Author Url: http://lussumo.com */ if ($Context->Session->UserID == 0 && !in_array($Context->SelfUrl, array(people.php, index.php)) { header('location: people.php?ReturnUrl=index.php'); die(); } ?>