Users with access to this forum: '.$forum_restriction_allowed_in_forum[$forum->forum_id].'
'; return $r; } else { return $r; } } } add_filter('forum_description', 'forum_restriction_alter_front_page_forum_description'); // FILTER TOPICS ON FRONT PAGE function break_up_forum_array( $forums ) { global $forums; forum_restriction_alter_front_page_forum_list( $forums ); foreach ( $forums as $forum ) { $forum_ids .= $forum->forum_id.'\',\''; } $forum_ids = rtrim($forum_ids, ',\'\' '); return $forum_ids; } function forum_restriction_get_topics_where_plugin( $where ) { if ( is_front() ) { $list_of_allowed_forums = break_up_forum_array( $forums ) ; $where .= " AND forum_id IN ('$list_of_allowed_forums') "; return $where; } else { return $where; } } add_filter ( 'get_latest_topics_where', 'forum_restriction_get_topics_where_plugin' ); // HIJACK PAGE IF USER TRIES TO GO DIRECTLY TO FORUM.PHP function forum_restriction_hijack_forum_page() { global $bb_current_user,$forum,$forum_restriction_allowed_in_forum; if (is_forum()){ if ($bb_current_user){ $pos = strpos($forum_restriction_allowed_in_forum[$forum->forum_id],get_user_name($bb_current_user->ID)); } else { $pos = FALSE; } if ($pos === FALSE && !empty($forum_restriction_allowed_in_forum[$forum->forum_id])) { $wheretogo = bb_nonce_url( bb_get_option('uri')); header( 'Location:'.$wheretogo ); } else { } } } add_action('bb_forum.php_pre_db', 'forum_restriction_hijack_forum_page'); // HIJACK PAGE IF USER TRIES TO GO DIRECTLY TO TOPIC.PHP function forum_restriction_hijack_topic_page() { global $bb_current_user,$topic,$forum_restriction_allowed_in_forum; if (is_topic()){ if ($bb_current_user){ $pos = strpos($forum_restriction_allowed_in_forum[$topic->forum_id],get_user_name($bb_current_user->ID)); } else { $pos = FALSE; } if ($pos === FALSE && !empty($forum_restriction_allowed_in_forum[$topic->forum_id])) { $wheretogo = bb_nonce_url( bb_get_option('uri')); header( 'Location:'.$wheretogo ); } else { } } } add_action('bb_topic.php_pre_db', 'forum_restriction_hijack_topic_page'); // EMAIL FORUM MEMBERS WHEN NEW TOPIC IS STARTED IN FORUM 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. The text is %4\$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'); /* */