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.

redirect unauthorized viewers

edited January 2008 in Vanilla 1.0 Help
Hey guys. I have the SubCatagories and the CatagoryRoles add-ons set-up so the unauthorized can see the Catagories but can not see the threads inside without signing in.
I have SubCatagories on all main Catagories of the same name. Unauthorized people can view the first set, but only members can actually go inside the second set and post. As I have it setup now, If the Unauthorized click on a Catagory, they can go inside the catagory but all of the threads are invisible. Instead, I would like to redirect them to a to a sign-in instruction page or my website page instead when they try to go inside a Catagory they do not have access rights to. How should I go about doing this?
Thanks for your time.

Comments

  • edited January 2008
    This will re-direct them to the sign in form. Just pop the code in a php file called "default", save it in some folder, and install it as an extension.

    [edit] I changed this so that it displays a message and then automatically re-directs the guest to the main index. I believe that should work, though I haven't actually played with AddNotice before. [/edit]

    [edit #2] OK, I tested it. It works now. [/edit]

    <?php /* Extension Name: Redirect Categories Extension Url: n/a Description: n/a Version: 0.3 Author: Timothy Walters Kleinert Author Url: n/a */ $Context->SetDefinition('REDIRECTCATEGORIES_Notice', 'You do not have permission to view this category. To view this category, please <a href="people.php">sign in</a>. <br />You will be automatically re-directed in just a moment.'); if ($Context->Session->UserID == 0 && $Context->SelfUrl == 'index.php') { $CategoryID = ForceIncomingInt('CategoryID', 0); if (in_array($CategoryID, array(1, 2, 3))) { // list all CategoryIDs you don't want guests viewing $NoticeCollector->AddNotice($Context->GetDefinition('REDIRECTCATEGORIES_Notice')); header('refresh: 4, url='.GetUrl($Context->Configuration, 'index.php')); } } ?>
This discussion has been closed.