Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorlegolas
    • CommentTimeJan 3rd 2008
     # 1
    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.
    • CommentAuthortimfire
    • CommentTimeJan 3rd 2008 edited
     # 2
    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'));
    }
    }
    ?>
Add your comments
    Username Password
  • Format comments as