Trent,
WOEEEZZZZZZZZZAAAAAAAAAAA…. sorry for the excitement… the code works!!!!!
Gurus… one request… how can I completely “Eliminate” anonymous user registration… the goal of my forum is for a private discussion of authors who write on the main blog to communicate with each other. Hence all users of the forum will be actually authors of the blog.
From Ardentfrost.
<?php
/*
Plugin Name: Force Login
Description: No one can see your forums unless they are logged in.
Plugin URI: https://bbpress.org/forums/topic/117
Author: Michael D Adams
Author URI: http://blogwaffe.com/
Version: 0.7
*/
function force_login_init() {
if ( !bb_is_user_logged_in() && false === strpos($_SERVER['REQUEST_URI'], 'bb-login.php') ) {
if ( file_exists( BBPATH . 'my-templates/login.php' ) ) {
require( BBPATH . 'my-templates/front-page.php' );
} else {
require( BBPATH . 'bb-templates/front-page.php' );
}
exit;
}
}
add_action( 'bb_init', 'force_login_init' );
?>
That will work.
Trent
Usually those “cannot modify header” errors are due to whitespace before the <?php or at the end after the ?>
Is that possible?
Trent, Thanks for the quick reply. There are no errors. The objective was to hide the forums from everyone who is not logged in. For this the mdawaffe’s plugin (code posted in his post above) was working on my initial install (0.74)… but I’ve installed the 0.75 yesterday and reinstalled the plugin, but upon logging out, I’m still able to browse the forums…
the url: passionforcinema.com/club
Awesome! Thanks Sam! I’ll jump on all of this real soon. Thanks again!
spencerp
Yep, and, even though Michael Adams made the newer version of the bbPress Integration plugin. Ryan Boren added two stubs in the 2.1 wp-includes/ folder, holding the same name as the original two.
So, these two calls:
require_once( ABSPATH . WPINC . ‘/registration-functions.php’ );
include_once (ABSPATH . WPINC . ‘/rss-functions.php’);
In any WordPress or bbPress plugins, you’ll still be safe! Inside those two stubs are:
registration-functions.php file:
<?php
// Deprecated. Use registration.php.
require_once(ABSPATH . WPINC . '/registration.php');
?>
rss-functions.php file:
<?php
// Deprecated. Use rss.php instead.
require_once (ABSPATH . WPINC . '/rss.php');
?>
Happy 2.1 Upgrading and bbPress Integrating peoples..
spencerp
Found the bug.
When loading the admin it also includes the new file: menuhead.php. In that file there is a line: <?php ajax_show_javascript(); ?> and that gives this error: <b>Fatal error</b>: Call to undefined function ajax_show_javascript() in <b>bb-admin/menuhead.php</b> on line <b>6</b>
Why is that? Well the new admin page DOES use this ajax_show_javascript but all others don’t. That also explains that only the menu admin page is working and all others aint.
But how the hell can I fix this? Will an if work? If page = admin-base.php?plugin=menu_admin_page include menuhead.php or something? Any other suggestions?
At the moment, menuhead.php is called using a include or is this fixed if I use the new admin_head hook in 0.8?
Quote:
...the new and improved 0.8 version that should be released pretty soon...
Stop teasing us!!!
The only thing I’m worried about now is, the fact that I’m running the Forum Category enhancement. I’ve currently modified the 0.8alpha files, however, I haven’t gotten the “latest” svn commits yet, including what you’ve mentioned above..
I *could* just manually keep editing my files, as they come through the email list, but IMHO, it’d be more of a pain in the arse that way sigh. I guess what I’m saying is, I’d love it if they’d implement that Forum Category option into 0.8, rather then 1.0.
It’s running just fine for me, except for customizing the look of it and such. The other thing is, it’s really a pain in the arse as it is now, because I’ve implemented my blog’s theme around the forums themselves.
So either way, I’m screwed with tons of file edits.
I don’t know though, I’m too tired at this point to even do any file editing/uploading.. Maybe when I get up later, I’ll handle some of this stuff..
As for the plugins, I’m hoping Josh takes care of his lol. His plugins are about the only plugins I have going, besides the normal original bbPress plugins lol. Anyway, enough of my rambling, I’m tired as heck, and everyone’s tired of it anyway… so.. later people..
spencerp
Got it fixed, this topic can be deleted
bb_update_option( 'forum_restriction_db', array( "1" => "David Bessler,testman", "3" => "David Bessler" ) );
$value = bb_get_option( 'forum_restriction_db' );
That’s how it should work.
Anonymous User 96400Inactive
yeah, i’m using polyglot for my wp blog. now, having something like this for bbpress would be just awesome. users being able to post in different languages. but maybe that’s wanting a bit too much right now.
i had a look at the code aready, but it’s just too complicated for me. all this php code…
I’m not absolutely sure about this, but it seems that SQL will want you to be more explicit. You need to break up the list (4 and 1) and add different strings to the where. So, for the first add WHERE forum_id = 4 then do OR forum_id = 1. Every subsequent forum id query should also start with an OR.
That’s what I think at least. It’s worth a shot
When I use the following code in a plugin:
function forum_restriction_get_topics_where_plugin( $where ) {
if ( is_front() ) {
$list_of_allowed_forums = "4,1";
$where = "WHERE forum_id IN ('$list_of_allowed_forums') ";
$where .= " AND topic_sticky <> 2 ";
return $where;
} else {
return $where;
}
}
add_filter ( 'get_latest_topics_where', 'forum_restriction_get_topics_where_plugin' );
I expect it to list the topics belonging to forums with ID 4 and ID 1. Instead, it is only listing topics with forum 4. When I change them to (1,4) it only lists 1. It seems it is only seeing the first value in the string. Any ideas why?
Still no luck 
I have this:
<?php
global $bbdb;
$r = mysql_query("SELECT * FROM $bbdb->menu WHERE set = 'active' ORDER BY order ASC");
while($rw = mysql_fetch_array($r))
{
$class="";
if ($rw['is']) { $class .=" current" }
echo '<li><a class="$current" href="'.$rw['page'].'">'.$rw['item'].'</a></li>';
}
?>
Which is the same code as yours, but I still get the error:
Parse error: parse error, unexpected '}' on header.php on line 84
And line 84 contains the if:
if ($rw['is']) { $class .=" current" }
I am totally lost here :S
I would try the cookie sharing stuff in both bbPress config.php:
$bb->cookiedomain = '.lumanation.com';
$bb->cookiepath = '/';
And then maybe the cookie stuff that you can put in WordPress wp-config.php (can’t remember the format) if the first stuff just doesn’t work out straight away.
If the users are there it is because the integration is working, just the cookies are not sharing. Try that out and let me know.
Trent
hey guys,
i have followed the instructions on the forums/extend for intgegrating bbpress and wordpress.
It all seems to work – bbpress knows about the wordpress users.
Only problem is that i have to login to both wordpress & bbpress seperately – I thought it was supposed to support 1 login for both – using the same cookie or something?
the test site is:
blog.lumanation.com
the forums link at the top takes you to the bbpress install
any help would be greatly appreciated! 
also – any ideas on how to embed the bbpress install into wordpress – is it just a matter of hacking up the bbpress templates or is there a more elegant way similar to the wordpress rs-discuss/xdforum plugins?
Cheers!
Adam
You’re welcome Startribe..

spencerp
<?php
global $bbdb;
$r = mysql_query("SELECT * FROM $bbdb->menu WHERE set = 'active' ORDER BY order ASC");
while($rw = mysql_fetch_array($r)) <strong>{</strong>
$class="";
if ($rw['is']) { $class .=" current" }
echo '<li><a class="$current" href="'.$rw['page'].'">'.$rw['item'].'</a></li>';
}
?>
Can you give me a code example, cause i keep getting the error
the while looks like it needs curly brackets adding to it or you’re just going to repeatedly set $class="" then remove the curly bracket above the echo.
Hmm got this now:
<?php
global $bbdb;
$r = mysql_query("SELECT * FROM $bbdb->menu WHERE set = 'active' ORDER BY order ASC");
while($rw = mysql_fetch_array($r))
$class="";
if ($rw['is']) { $class .=" current" }
{
echo '<li><a class="$current" href="'.$rw['page'].'">'.$rw['item'].'</a></li>';
}
?>
But this gives me an error:
Parse error: parse error, unexpected ‘}’ on line 71
Think I have misplaced something here?
Greetz
ps I didn’t include $uri=option("uri").$rw["page"]; at all cause I wanted to test this first. So I keep it out for now…
I left Ardentfrost/Josh know of this thread via GoogleTalk, but he hasn’t replied. He must be AFK at the moment. He’ll be in to see this though..

@Trent, can you fix my grammar error in the “Forum Catagories” thread. In the title change: Catagories to: Categories please? That grammar mistake is driving me nuts!
*EDITED: Thanks Trent for editing it!

spencerp
So I have stored an option called forum_restriction_db. It has the value of:
“1” => “David Bessler,testman”, “3” => “David Bessler”,
When I try to assign that array to a varaiable as follows:
$forum_restriction_allowed_in_forum = array(bb_get_option(‘forum_restriction_db’));
It tells me the value of $forum_restriction_allowed_in_forum is just array.
I tried setting the value of the option forum_restriction_db to array("1" => "David Bessler,testman", "3" => "David Bessler",)
but then it spits back the members of the array as a,r,r,a,y etc … so the allowed memebrs of the forum_id 3 is “r”.
How can I get this to work?