Skip to:
Content
Pages
Categories
Search
Top
Bottom

Private Forum script


  • papercuts3
    Member

    @papercuts3

    I needed desperately a script that would restrict all access to unregistered users so I wrote one. But I am an absolute beginner so don’t know no nothin’ about elegance or whatnot but I just tested it in my installation and it works.

    The thing is naturally bb_press has authentication scripts. but to make all you website protected you need to put this in your header.php. However bb-login.php, which your users need to login also use the header.php, so I had to make sure that this small script runs on all pages EXCEPT the login page.

    Here’s the script:

    <?php

    $login_page = $bb->path . ‘bb-login.php’;

    if ($_SERVER != $login_page) {

    if ( !bb_is_user_logged_in() ) {

    header(‘Location: ‘ . $bb->domain . $bb->path . ‘bb-login.php’);

    } else { }

    }

    else { }

    ?>

    How to Use it:

    1. Copy paste the above code to your my-templates/header.php AT THE VERY TOP of the file. Make sure you leave no empty space before the <?php line (use something like TextPad – it’s free). So you header should look like:

    <?php

    $login_page = $bb->path . ‘bb-login.php’;

    if ($_SERVER != $login_page) {

    if ( !bb_is_user_logged_in() ) {

    header(‘Location: ‘ . $bb->domain . $bb->path . ‘bb-login.php’);

    } else { }

    }

    else { }

    ?>

    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” ….

    That’s it. Since I use the values you provided in you BBPRESS setup all the paths should be correct.

    Like I said I am complete newbie, so use at your own risk. BACKUP your header.php, or if something goes wrong just delete the script you just added.

    Hope it works for you,

    Caner

Viewing 15 replies - 26 through 40 (of 40 total)
  • it does not work for me. when i want to access the private forum plugin in the admin panel i get this error:

    Fatal error: Call to undefined function get_option() in /srv/www/httpd/phost/c/com/pytalhost/cessi/web/bbpress/my-plugins/private-forums.php on line 22

    sorry.. the theme currently works only with the site_options plugin. i’ll fix the plugin to check for that

    thanks

    i installed the site_opitons plugin. but i get some kinds of errors.

    in the “private forum management” i get this errors:

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /srv/www/httpd/phost/c/com/pytalhost/cessi/web/bbpress/my-plugins/private-forums.php on line 29

    value="2" > News

    and if i want to change the message a user gets if he is not allowed to access a private forum:

    Fatal error: Call to undefined function is_serialized() in /srv/www/httpd/phost/c/com/pytalhost/cessi/web/bbpress/my-plugins/site-options.php on line 190

    thanks for your help!

    PS: in the SITE OPTIONS tab i get nothing but a submit button…

    i’ll fix this and get a new version out in the evening

    thanks

    thanks for your help. you really do a great work, so1o!


    nickbouton
    Member

    @nickbouton

    Interesting thread. I’m curious, has anyone made a mod that will support role-based permissions on forums? I mean, every private forums thread I’ve seen is just trying to require a login to post / view the forum, but has anyone made a plugin that requires different roles to see specific forums?

    I’d like to have a forum for moderators or admins only (or based on a custom user role), has anyone got anything like that going?

    See my other thread here, on the same subject..

    http://bbpress.org/forums/topic/376?replies=2

    Thanks-

    -nick

    nick..

    im on it.. will be out in a few days..


    richardjeanderson
    Member

    @richardjeanderson

    Can I make another feature request for any private forum plugin, please? I want to have a private forum but still have the RSS feeds accessible. At the moment, if I use the plugin, the feeds become inaccessible without being logged in – i.e. services such as bloglines can’t see the feeds. I know that making the rss feeds available, in effect, makes the forum “public again” . . . . I guess the ideal solution is another plugin to give the feeds a randomised code in their URL . . . . but even if this isn’t possible, not being able to find the feed address without being logged in provides an adequate level of deterrent for my purposes.

    Can anyone help?

    richard.. the plugin does not make the rss feeds private..

    ok. uploaded the new version of private forum. then there was this message that i have not installed the newest version of bbPress. i downlaoded the 3 new files and uploaded them. now i get this kind of error if i want to access the forum:

    Fatal error: Call to undefined function is_serialized() in /srv/www/httpd/phost/c/com/pytalhost/cessi/web/bbpress/bb-includes/functions.php on line 364

    greets topiQ

    PS: since this is as far i can guess not related to your plugin i posted it here and not on your site…

    EDiT: i solved the problem by installing the new version of the site options plugin. thanks a lot!

    but if i install the 3 new files in the bb-include i get this error:

    Fatal error: Call to undefined function option() in /srv/www/httpd/phost/c/com/pytalhost/cessi/web/bbpress/bb-templates/header.php on line 44


    richardjeanderson
    Member

    @richardjeanderson

    My mistake on the private rss feeds issue. The first plugin in this thread (not the Selectable Private Forums plugin) did seem to make the feeds private. I’ve installed SPF.

    All working well, now. Thanks.


    davidbessler
    Member

    @davidbessler

    Any news on the roles-based forum permissions. It is the only feature holding me back now … I have been exploring all sorts of options involving more advanced forums (smf, phpbb etc …) but those involve crappy bridges, none of which work well or look nice. I love bbpress’ simplicity … so, any way to restrict certain forums to certain users? I don’t even need it to be roles-based. I’m OK just selecting users individually to have access to a specific forum.

    there are is a ticket in trac for role based forum access.. but it is a major change and might not be in atleast till release 1.0..

    its on the plate..


    davidbessler
    Member

    @davidbessler

    How about a plugin allowing admin to select specific users who have access to a forum? … doesn’t even need a GUI, you could enter a list of names in the script.

Viewing 15 replies - 26 through 40 (of 40 total)

You must be logged in to reply to this topic.