Skip to:

Plugin: Forum Restriction

  • Restrict specific forums to specific individuals.

    I guess this is the way one starts making plugins. Just put it out there. Let it ALL hang out. My first plugin. Please don’t make fun. Instead, help me improve it.

    Download it here.

Viewing 25 replies - 1 through 25 (of 38 total)

  • bbolman


    Updated to version 1.1. Changes below. Download link is same as in first post. Here is a link to the OLDER version 1.0

    == Version History ==

    * 1.1

    – Added admin user interface

    – Using MYSQL database rather than flat file in plugin

    – Added comments so you people start helping make this thing work

    – Tested with “private-forums.php”

    == Known Issues and Wishlist ==

    1. PROBLEM: Does not hide names or listing of restricted forums from those not authorized to see them.

    instead, it adds an [x] before the forum name, and removes the link to the forum. Same goes for topic listings under “recent discussions.”

    SOLUTION: I need someone to explain to me how to hijack the entire row of the forum listing in front-page.php

    2. PROBLEM: In admin user interface, you have to press submit twice to get the input fields to reflect the actual changes you made.

    The database changes go through the first time, but the input fields don’t update.

    SOLUTION: Again, need someone to help me figure this out.

    3. PROBLEM: Would like a more efficient way to choose and enter allowed users.

    This is really a layout problem.

    I don’t think a dropdown list allowing multiple selects is the answer, because of the ease of which one can accidentally unselect one or all!! the chosen users.

    I’m not so keen on the idea of a huge page with all the users listed with checkboxes.

    SOLUTION: Either stick with the way I have it now, or rework the plugin so that the array works as follows:

    “username” => “CSV list of allowed forums”, and then have one huge member list where you can select forums in which they are allowed.

    I chose my way because the way I intend to use the plugin is to have a large number of forums with only a few members allowed in each.

    That is also why it is so important to me to HIDE the restricted forums on the front-page.

    Updated to version 1.2. Changes below. Download link is same as in first post. Here is a link to the OLDER version 1.1

    Wow! Things are moving right along. I figured out how to actually HIDE the non-accesible forums and their topics from those not authorized. Still needs lots of help.

    I had a similar problem as you (with having to submit twice) in my memberlist plugin when trying to delete users. It would update the database, but only after the page was loaded… so in order to get a page load to reflect the new changes, you’d have to hit the button again.

    Pissed me off for a long time. Figured out it’s all about when and how you call the db change. For me it was easy because I had made my own pages so could change whatever I wanted. I put the deletion script in the root file (the one called mlist.php) and had the submit button do nothing but reload the page. When the page was reloaded, it would have all the deletion info in the pages $POST data, so the deletion script just looks for that and acts accordingly.

    I don’t know if that helps you at all with your plugin since I haven’t used the site options plugin yet (is that what you’re using?) so don’t know how to add stuff to the admin pages.

    I use the new site option plugin (which is easy and great by the way). I stole the admin page setup from private forums by Aditya Naik. My bbress board is tiny (testing only) so I imagine all sorts of stuff will pop up as it’s used on bigger sites. Thanks for your help.

    I couldn’t make version 1.2 work. I write the names of the allowed users to a specific forum, press submit twice to see what I actually wrote, but if I exit admin menu and enter again, the names aren’t displayed, so I guess it doesn’t store them.

    Looking at the code I believe that the problem is that the table which should store the restrictions isn’t properly created. Which one should be the “forum_restriction_db” ?

    Also, I saw a branch of version 1.3, are you planning to release it soon?

    Releasing 1.3 tonight. There is no table called forum_restriction_db. I am storing the variable via the bb_update_option() function. Try v1.3 and let me know what happens.

    OK. Here it is. Version 1.3. Download it above … same link. As always, here’s a link to the previous outdated version.

    Ok I figured out the problem.

    I saw you explaining that the “submit” button must be pressed twice to visualize the autorized users on the restricted forum.

    The problem is that the second time you press submit, a blank text field is sent via bb_update_option, thus rendering the forum unrestricted.

    If you press submit just once everything runs smoothly.

    And BTW, thank you very much for this excellent plugin, I needed a staff only forum *badly*

    My pleasure. I still can’t figure out why it doesn’t register right away. But, it’s not at the top pf my list for problems to figure out. If you DO solve it, please let me know. Did you get version 1.3 working amenadiel?



    I have posted this in two topics, forum-restriction and private-forums.

    RSS will display the restricted information. The latest posts.

    Yikes! I’ll have to check into that. In the meantime, I’ve posted yet ANOTHER version. This one corrects that annoying reload problem amenadiel was talking about. It also adds an error message if you use a name that doesn’t exist. THIS VERSION REQUIRES THE Display-names.php plugin. Until I can find a workaround for the issue. I figured I’d err on the side of added functionality.

    Anyway, the new version can be downloaded above as usual. Here is a link to the outdated version 1.3

    Does the idea of RSS and private forums make sense? Is there a way to be “logged” in when getting RSS feeds? I don’t use RSS so I don’t know. I do know that none of my users use RSS because I use bbpress on an internal company site. So, I diables rss for the meantime by renaming my rss.php file.

    I would love for someone to shed some light on all this.



    To see this work go to

    Do not log in.

    Firefox or Safari have a rss button. An interal site sould get the same results.

    This will only work on page you can navigate to. It will not dig.



    I am using both plugins, forum-restriction and private-forums.

    The if you read this post is forum-restriction.

    private-forums has label, members only.

    I see the problem. I am trying to work on a solution. In the meantime, I completely disabled my rss by renaming rss.php. Let me know if you come up with a solution.

    Ok I’ve been looking at rss.php code but I’m unfamiliar with it, and while I was hoping to find a nice clean SQL Query line, there isn’t any and I don’t know where to look. But, in case someone know where to find it, it should be a line like this:

    sql0=”SELECT * FROM bb_topics ORDER BY topic_time DESC limit 0,35″;

    now let’s say our first forum is restricted and the fifth forum is private . The way to severe them from the feed would be to change the query to:

    sql0=”SELECT * FROM bb_topics where forum_id not in (5, 1) ORDER BY topic_time DESC limit 0,35″;

    of course, the nice, clean way to do this would be to use the bb_press API to store the restricted or private forums id and then restrict the query internally, but I don’t know how to do this. I’m new to WP and BB altogether.

    Can someone tell me how to include the text of the first post in the new topic in the notification email. Here is the code I am using:

    function forum_restriction_send_email ($topic_id){

    if (bb_get_option('forum_restriction_notify') == "on") {

    global $forum_restriction_allowed_in_forum, $bbdb, $bb_current_user;

    $topic = get_topic($topic_id);

    $forum = $topic->forum_id;

    $mailing_list = split(",",$forum_restriction_allowed_in_forum[$forum]);

    $message = __("There is a new topic called: %1$s. You can see it here %3$s. You got this email because Bessler decided to turn on the option to notify all members of restricted forums when there are new TOPICS started in each FORUM. However, don't forget to click on "Add this topic to your favorites" so that you get an email when someone adds a POST to this TOPIC. This will keep you involved in that particular discussion. Kapish?");

    foreach ($mailing_list as $member) {

    $userdata = $bbdb->get_var("SELECT ID FROM $bbdb->users WHERE display_name = '$member'");

    $email_address .= $bbdb->get_var("SELECT user_email FROM $bbdb->users WHERE ID='$userdata'").",";


    mail( $email_address, '['.bb_get_option('name') . '] ' . __('New Topic In Private Forum:').get_forum_name($forum),

    sprintf( $message, $topic->topic_title, get_user_name($bb_current_user->ID), get_topic_link($topic_id) ),

    'From: ' . bb_get_option('admin_email')




    add_action('bb_new_topic', 'forum_restriction_send_email');



    A friend who loves WordPress ( Gave me this to work with the plugin.

    It goes in the rss2 file.


    if ( strstr( get_topic_title(), ‘[Members Only]’) ) echo ‘[Text of this post available to logged-in members only.]’;

    else post_text();


    To see this work go to

    Do not log in.
Firefox or Safari sould get the same results.



    Sorry this work around is for Private Forums . This does not work for this plugin.



    I uploaded version 1.5 to my site where I store the file. I have not added it to the main repository yet because I am away and don’t have tortoise set up to subversion it. Try version 1.5 and let me know if it fixes your problem. You can download the soon-to-be-outdated 1.4 here. The new version 1.5 is as usual available from the link at the top of this topic.



    Forum-restriction version 1.5 does not hide latest topics when user is logged out.



    Oops. Don’t know why that was happening. I fixed it and uploaded the new version. Redownload it now. I also put up the official new version.



    Hey I need some help solving the RSS problem for my plugin. I don’t really know how most people use RSS so I can’t figure out what changes need to be made. For me, I have Private Forums and Forum Restriction BOTH enabled, and as far as I can see, RSS is unfettered unpassword-protected acess to the info on the board. I can’t really see how anyone would want that. Can someone explain what the permissions of RSS on bbPress might look like? I can’t fix the problem if I don’t use the feature.

    does this plugin allow restricting a forum so only an admin can post to a given topic?

Viewing 25 replies - 1 through 25 (of 38 total)
  • You must be logged in to reply to this topic.
Skip to toolbar