ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Hiding the Forum Module behind a login

October 05, 2010 1:16pm

Subscribe [3]
  • #1 / Oct 05, 2010 1:16pm

    hd 

    156 posts

    I just thought I’d ask before I dive into php…

    I need the entire Forum module to be hidden within an extranet (behind a login).

    I’m assuming this can be done if I enable php in the forums, and in the main header put in some kind of conditional to check the user group of the current user. If the user isn’t in the correct group I should be able to die() or forward to a login template.

    Possible? Has it been done? Anybody have a code example of how to accomplish this?

  • #2 / Oct 05, 2010 7:09pm

    Sue Crocker

    26054 posts

    The easiest way to do this is to run the forum from a template. That way you can set the permissions level based on the template. Does that help?

  • #3 / Oct 05, 2010 7:15pm

    hd 

    156 posts

    yes, but when running the forum from a template, will the forum still be accessible outside the template ie. /forum/?

  • #4 / Oct 05, 2010 11:52pm

    hd 

    156 posts

    I figure this method is a bit more efficient than calling through the template parser.

    I put this in the beginning of /themes/forum_themes/scaffold/forum_global/html_header.html

    <?php 
    
    $this->EE =& get_instance();
    
    $group = $this->EE->session->userdata['group_id'];
    
    // list of group id numbers allowed in the forum below
    if (!in_array($group, array(1,5,6,7,8))){
        header("Location: /login"); // a login page
        exit();
    }
    
    ?>
  • #5 / Oct 06, 2010 3:37pm

    Ingmar

    29245 posts

    Very good, and thanks for sharing. Please post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases