OK, this is fixed in trunk now. Just a stupid error on my part in a new function.
I’ll see if it’s possible to re-release the 1.0-alpha-3 or maybe just bump up to 1.0-alpha-4.
So, what did it happen? Is it the fix already included in the download right now? I’d like to give it a try
I modified your code to the following and it worked:
<li<?php if ($current_forum_id=get_forum_id()) {echo ” class=’on'”;} ?>>
Thanks a lot CK, much appreciated.
Thanks both of you for answering… This is just such a great forum
I will be around more again now
Been a busy year! Thanks for the cleanup code _ck_ and I will test it tomorrow. Hi back to everyone 
Trent
Untested code cleanup (just for fun – untested)
function force_login_init() {
if (!bb_is_user_logged_in() && !preg_match("/(bb-login|bb-reset-password|register|xmlrpc).php/s",$_SERVER['REQUEST_URI'])) {
nocache_headers();
header("HTTP/1.1 302 Moved Temporarily");
header("Status: 302 Moved Temporarily");
bb_safe_redirect( bb_get_uri( 'bb-login.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_USER_FORMS ) );
exit;
}
}
Good to see you Trent, don’t be a stranger!
Why not just do it all in the li:
<li<?php if ($current_forum_id==get_forum_id()) {echo " class='on'";} ?>>
Thanks for the response and it clarifies all of my questions.
Regarding nonces, the catch twenty-two with them would be if logging in and logging out of either/or BBP or WP don’t both affect both, or if adequate traps aren’t placed to disallow one or the other.
Example is visible at my live test site http://www.delsolownersclub.com. If you’d like to try this, register yourself and use the invite code “bbpress”. (Registering makes you a WP contributor, and I need to assign your membership role in the BBP admin manually as of right now.)
When you’re in the forums, the logout link won’t work, because the login through WP generates a nonce that BBP doesn’t know and can’t find. Because the nonces are by design different, if I login through WP and try to logout through BBP, WP will pitch a fit without the correct nonce. Make sense or am I off track here?
I first tried switching DESC to ASC, and it didn’t change the result, which was 1.
You mean on the regular topic page? Yeah it would just add one query.
On a low to medium activity site it should be okay.
I think there’s an index on topic_time so mysql shouldn’t have too much of a workout.
The >= switch aroo may be logic confusion on my part between whether to use DESC or ASC.
One makes the list start with the current topic time, the other way makes it end with the time.
In theory the count should be easier with <= and if you have to change DESC to ASC.
I had to change topic_time<='$topic->topic_time' to topic_time>='$topic->topic_time', but it works beautifully now.
I’m thinking about applying this mod to the regular topic view. You told me in a different thread that it should be fine if I’m only using this extra DB query in the Edit screen – do you think it would be unwise to use it in regular topic views?
Oh that’s a simple bug, I forgot the quotes around the time:
$query="SELECT count(topic_id) as position FROM $bbdb->topics WHERE forum_id=$forum_id and topic_time<='$topic->topic_time' ORDER BY topic_time DESC";
$position = $bbdb->get_var($query);
You’re exactly right!
I added my host (straight from wp-config.php) and it worked…BUT…it didn’t write bb-config.php on it’s own…it gave me some error messages, but it also provided the code for me to make the bb-config.php on my own…
I opened notepad, pasted the code, saved it as bb-config.php, and uploaded it to the bbPress directory. Seems to be working so far, but I’m not quite done with the install. I’ll let you know if it works out…
Thanks Chris!
I tried the shortcut method, it returned an error: `bbPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ’01:46:48 ORDER BY topic_time DESC’ at line 1]
SELECT count(topic_id) as position FROM tvcforum_topics WHERE forum_id=6 and topic_time<=2008-12-09 01:46:48 ORDER BY topic_time DESC`
Regarding the last bit of code you posted – there’s actually a function already present in one of the bb-includes files that does the same thing – get_page_number().
This:
<li><a href="http://forums.beardownarizona.com/" title="Visit the forums"></a></li>
The bloginfo just grabs the url of the site in case you ever move to another domain name.
Thanks!
Now what if I wanted to add the forums as a subdomain…like forums.example.com? How does that affect the code?
Would this work?
<li><a>http://forums.beardownarizona.com" title="Visit the forums"></a></li>
Thank you for your help!
In that Autumn Almanac theme, you can add a link in menu.php. It can easily be before or after the link to Home, of after all the pages that are listed (so, end of the line.) Just add this to menu.php right after <?php wp_list_pages('depth=1&title_li='); ?>:
<li><a href="<?php bloginfo('url'); ?>/forum/" title="Visit the forums"></a></li>
That will add an additional list item right after all the rest of the pages in your menu.
You could also do it by creating a page called Forum and then just redirect the content of that page to your forums. That way you could control the page order and have it appear in a place other than the beginning or end of the menu.
You didn’t mention what version of bbPress and WordPress you’re trying to integrate. It matters. Looks like you are using WordPress 2.6.3 – I don’t know how to properly integrate the logins with any version of bbPress. If you spend some time looking through these forums, you will see people who’ve had trouble with integration. Maybe someone else can help you with that.
Hello bbPress Community Members,
This is the Arabic translation for bbPress, I’ve done it 5 months ago with 0.9.0.2
I was a little bit lazy about posting it here, dunno why 
Till i checked out this post mintues ago , #thanks _ck_
http://bbpress.org/forums/topic/check-out-this-very-nice-r-t-l-arabic-bbpress
All that i do know that alot of people love it in Arabic and already using the Arabic version of bbPress.
Also, I’ve made a complete RTL version with heavy modifications on template files and a completely new Admin Page Design (CSS Edit).
This is the last version of Arabic Translation for 0.9.0.3 with slight modifications.
Hope that the moderator add this translation officially with other bbPress translations.
Arabic Support Forum: (part of my blog itkallem.com)
http://bbpress.itkallem.com/
Project @ Google Code:
http://code.google.com/p/bbpressar/
Arabic Language Files ar_AR:
http://bbpressar.googlecode.com/files/ar_AR-0.9.0.3.zip
bbPress 0.9.0.3 Arabic Pack only (language files + RTl modifications,..etc)
http://bbpressar.googlecode.com/files/bbpress-arabicpack-0.9.0.3.zip
bbPress 0.9.0.3 Arabic Version (ready to use complete bbPress in Arabic version)
http://bbpressar.googlecode.com/files/bbpress-0.9.0.3-ar.zip
[+] Annoying Problems:
– unicode support for usernames 
Thanks.
M.Abdel-Shakour.
Um, no you missed my point. I didn’t enter an htmlentity,
I simply entered the ampersand symbol. bbPress converts it to an htmlentity
and then your plugin converts it to a trac code.
only way now to get a real & is to enter & or put it in backticks &
& & & &# & & &38;
Heh, definately a border case!
I don’t know too many people who hand encode their own HTML entities in the normal flow of text.
Hi guys, i’m trying to get the above code to work without any success.
This is the code i’m using in my header files:
<?php
$current_forum_id = get_forum_id();
while ( bb_forum() ) {
$class = ”;
if ($current_forum_id == get_forum_id()) {
$class = ‘on’;
}
}
?>
…and this is the code i’m using in my front page and forum template (within the menu):
<li class="<?php echo $class; ?>">
Not sure where i’m going wrong, any help would be much appreciated.
Thanks
A first attempt at getting WordPress 2.7 and bbPress 1.0 to play nice again is now in trunk [1862].
I’m specifically talking about “deep” integration, i.e. when you include WordPress inside bbPress to gain access to WordPress’ functions.
This will need a lot of testing, so please post any issues you have on the relevant Trac ticket, #972 (which will stay open until some more testing has occurred).
I recommend using the following code at the top of your bbPress bb-config.php file to include WordPress inside bbPress:
if ( !defined( 'ABSPATH' ) ) {
include_once( '/Full/Path/To/wp-load.php' );
}
Note that this includes “wp-load.php” not “wp-config.php” or “wp-blog-header.php”. This avoids running WordPress’ template loader which presumably isn’t needed inside bbPress. Some implementations may want it though, so if you find you need it then give it a go and let us know how that goes.
Also note that all filters and actions set in WordPress whether default or added by plugins or themes are cleared out completely. That means that plugins and themes installed in WordPress cannot add filters or actions to bbPress at all. This may have some implications I’m not aware of yet.
Go nuts!
I wanted a little plugin to allow Force Login on bbPress forum when you have integration with buddypress. I altered mdawaffe’s plugin and thought I would share it with the community if you want privacy on forum and still work with buddypress.
<?php
/*
Plugin Name: Force Login
Description: No one can see your forums unless they are logged in.
Plugin URI: http://bbpress.org/forums/topic/117
Author: Michael D Adams *voodoo code from Trent Adams and Sam Bauers*
Author URI: http://blogwaffe.com/
Version: 0.8
*/
function force_login_init() {
if ( !bb_is_user_logged_in()
&& 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'bb-login.php')
&& 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'bb-reset-password.php')
&& 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'register.php')
&& 0 !== strpos($_SERVER['REQUEST_URI'], bb_get_option( 'path' ) . 'xmlrpc.php')
) {
nocache_headers();
header("HTTP/1.1 302 Moved Temporarily");
bb_safe_redirect( bb_get_uri( 'bb-login.php', null, BB_URI_CONTEXT_HEADER + BB_URI_CONTEXT_BB_USER_FORMS ) );
header("Status: 302 Moved Temporarily");
exit();
}
}
add_action( 'bb_init', 'force_login_init' );
?>
Cheers,
Trent
That’s because get_var only gets one item – the first and only.
You want get_results which returns an array.
Actually, even better in this case would be get_col which should return a flat array.
Another trick to use on that query is possibly to include the topic_time as the end in the WHERE clause so that it doesn’t bother to pull up 10,000 topic id’s if the topic you are looking for is in the first 100
global $topic;
$query="SELECT topic_id FROM $bbdb->topics WHERE forum_id=$forum_id and topic_time<=$topic->topic_time ORDER BY topic_time DESC";
$topic_array = $bbdb->get_col($query);
We could take a huge shortcut and a bit of a gamble that no other topic has the same exact topic_time as this one and simply get the position via count, assuming it’s the very last one. Occasionally you might be a page short, or a page too many.
global $topic;
$query="SELECT count(topic_id) as position FROM $bbdb->topics WHERE forum_id=$forum_id and topic_time<=$topic->topic_time ORDER BY topic_time DESC";
$position = $bbdb->get_var($query);
Then you divide position by topics per page and you have the page it’s on.
$page=ceil($position/bb_get_option('page_topics'));
$link=get_topic_link(0,$page);
@_ck_ – The reason is, I have some breadcrumb links in the header of my edit_post.php file. It displays something like this:
The Volturi’s Castle Forum » Forum Games » Count to 10,000 » Edit Post
I have the topic link pointing to the exact position of the post being edited, and I want the forum link to point to the exact page of the topic as well. The code I have is this:
<?php
$forum_id = $bbdb->get_var("SELECT forum_id FROM $bbdb->posts WHERE post_id=" . get_post_id() . " LIMIT 1");
$forum_name = get_forum_name($forum_id);
/*$topic_array = $bbdb->get_var("SELECT topic_id FROM $bbdb->topics WHERE forum_id=" . $forum_id . " ORDER BY topic_time ASC");
while ($topic_id = current($topic_array))
if ($topic_id == get_topic_id())
$topic_index = key($topic_array);
$forum_page = get_page_number($topic_index);*/
$forum_link = '<a href="' . get_forum_link($forum_id, $forum_page) . '">' . $forum_name . '</a>';
?>
<a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> » <?php echo $forum_link; ?> » <a href="<?php post_link(); ?>"><?php topic_title(); ?></a> » <?php _e('Edit Post','rag'); ?>
The commented stuff is what’s giving me trouble. When executed, it issues an error saying that $topic_array isn’t an object or array. I inserted an echo $topic_array;, and it spit out 3. The topic_id is 13, the forum_id is 6, and no matter what post I edit, the same number is echoed, so I have no idea where it’s getting 3.