OK, here’s the functions.php file that I created in my theme to reproduce the drop down menu I had on my WordPress side.
Please note that this code does not attempt to reproduce all of the functionality of the WordPress wp_list_pages() function. Rather, it just tries to create the HTML needed for the drop down menu code that came with my WordPress theme to work. If you need anything more than that, feel free to modify this or strike out on your own.
Overview
Before the code, just a quick overview of how it works.
The function bb_list_pages() is a recursive function that returns a string containing the HTML for all of the pages that descend from a particular ancestor. The process is started by calling it with a parent ID of 0. The way the wp_posts table in WP is designed, this returns the highest level.
The function calls a helper function called get_pages() to retrieve the list of child pages from the database. It then loops through all of the pages returned by get_pages() & constructs the list item & anchor tags. It then calls itself to build the HTML for any descendants of the current page.
Here’s the code:
<?php
/**
* This file contains useful functions that can be called in any of the template's files.
*
* Version 1.0
* Date: 23-July-2009
* Author: Tony Vitabile
*/
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "
/".$_SERVER["SERVER_NAME"];
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= ":".$_SERVER["SERVER_PORT"];
}
$pageURL .= $_SERVER["REQUEST_URI"];
return $pageURL;
}
/**
* Compute the name of the WordPress pages table & return it
*/
function pages_table() {
global $bb;
// Compute the name of the table we need to query
$table = $bb->wp_table_prefix;
if ($bb->wordpress_mu_primary_blog_id != "")
$table .= $bb->wordpress_mu_primary_blog_id."_";
$table .= "posts";
return $table;
}
/**
* Retrieve a list of pages from the WordPress posts table whose parent has the ID
* passed to this function.
*
* @param int $parent ID of the page that is the parent of the ones we're searching for
* @return array List of pages matching defaults or $args
*/
function get_pages($parent = 0) {
global $bbdb;
// Compute the name of the table we need to query
$table = pages_table();
// Build our query string
$parent = (int) $parent;
$query = "SELECT * FROM {$table} WHERE post_type = 'page' AND post_status = 'publish' AND post_parent = {$parent} ORDER BY menu_order";
// Get an array of rows back from the database
$pages = $bbdb->get_results($query);
// Return whatever we got back to the caller
return $pages;
}
/**
* Simple function to recursively scan the WordPress posts table looking for pages.
* It builds a string consisting of <ul><li></li>...</ul> items.
*
* @param int $parent ID of the parent page. 0 = no parent
* @param int $depth How far down in the heirarchy to go
* @param string $thisPage The name of the page that is currently being displayed
* @returns string A <ul><li></li>...</ul> list of page navigation information
*/
function bb_list_pages($parent = 0, $depth=0, $parent_uri='', $indent=' ') {
// Initialize the output of the function
$output = "";
// Is the depth = 0?
if ($depth == 0) {
// It is. Return the empty string now
return $output;
}
// Get the child rows of $parent
$pages = get_pages($parent);
// Did we get any pages back?
if ( empty($pages) ) {
// No, we didn't. Return the empty string now
return $output;
}
// Yes, we got pages back. Loop through all of the pages in our results
foreach ( $pages as $page ) {
// Compute this page's URI
$page_uri = $parent_uri;
if (substr($page_uri, -1) != '/')
$page_uri .= "/";
$page_uri .= $page->post_name . "/";
// Build the <li> tag
$output .= "{$indent}<li class="page_item page-item-{$page->ID}";
if ($page_uri == curPageURL() ) {
$output .= " current_page_item";
}
$output .= "">";
// Now build the rest of this item's information
$output .= "<a href="{$page_uri}">".$page->post_title."</a>n";
if ($page->ID > 0) {
// Get this page's children recursively
$kids = bb_list_pages($page->ID, $depth -1, $page_uri, '', $thisPage, $indent . " ");
// Does this page have any children?
if ($kids <> "") {
// It does. Add the information for the kids surrounded by <ul></ul> tages
$output .= "{$indent}<ul>n" . $kids . "{$indent}</ul>n";
}
}
// Output the closing </li>
$output .= "</li>";
}
// Return the string to the caller
return $output;
}
?>
Tony
Yup, I do… even though I thought that for WP 2.8.x this is no longer required. Anyway, it doesn’t make a difference whether it’s activated or not, I’ve tried both.
I found this site, very useful for anyone trying to install/configure php on windows server: http://www.iisadmin.co.uk/?p=4
Following the above article, and related mysql & wordpress articles, all now works.
Not sure I’m changing both the cookie keys, but I am making sure they match. BTW…I’m using WPMU. Latest versions of both products.
Here are some instructions on how to change your file permissions using an FTP client:
https://codex.wordpress.org/Changing_File_Permissions#Using_an_FTP_Client
this video helps greatly.
https://bbpress.org/forums/topic/basic-integration-screencast
(you can skip some of the beginning, it’s him installing wordpress.)
You need to ensure you’re changing the cookie keys located in the bb_config and wp_config files. Also make sure you’re using the appropriate wp/bbp integration plugin.
Both systems are using the same database, and they each recognize my User account information. However, when I log into one, it doesn’t log me into both.
A quick suggestion to make finding things easier on large forums (i.e. WordPress.org/support), could you add date-based filtering options (i.e. options to only show posts/topics from the last 24hrs, week, month, year) so you can narrow an issue that may be recent.
Thanks
Well, I’ve been able to get my theme to look & work the way I want it to. So all’s good.
I just have to figure out how to get my drop-down menus to work.
Thanks
Tony
Please be patient. Waiting about an hour between bumping is a little rude for a forum full of volunteers 
What are you using for the rest of your site? PHP pages, WordPress?
Though I am certain someone will clone it in short time like the did with wordpress.org
I’ll release anything interesting that comes out of the work, but so far it’s pretty standard stuff.
I tried moving the files to a new bbPress directory under the Forums directory and that returned a 404 error also. I also tried moving a plain html file into the forums directory and that was not found also. Also I am Hosted on Godaddy. Then I realized I needed a / at the end! Sorry I guess I should have known that.
But one question Do I use the same database as WordPress if I want to integrate?
I’ll have a fiddle with the documents and see if switching to Mac or Unix format helps. I just assumed i’d run with what i use on WordPress…
What concerns me is why these role lines seem to be required for template files to function correctly, and that in keeping them there invalidates the pages…
I suppose the question now is, does anyone else have the issues i mentioned when editting or creating bbPress themes? … If anyone is to report they do not, then i’m happy to accept that it’s likely my mistake and look back over what i’m doing, and where i’m going wrong…. but i’d like a little feedback beforehand….
Admittedly i’m using a custom theme that i converted from a WordPress theme, however i’m not incapable of managing code, so i’ll happily accept that i may have fudged something unintentionally if that’s really the case.
I’ll let you know if using Unix or Mac format makes a difference….
English is awkward, but please understand.
When the installation work well bbpress was alone.
But, After the work was not Integration with WordPress.
Has 2 kinds of problems.
1st, encoding error.
Eroding the value of WordPress DB is stored.But The value of BBpress DB is stored in presentation well.
Do you know how to solve the people?
2rd, Login error.
Add in bb-config.php that ‘require_once(‘../wp-blog-header.php’)’
but log in to check after WordPress Because BBpress was not. Was login before Integration with WordPress.
Only presentation ID value After Integration with WordPress, login was not.
plz…help me.
lstelie, it’s not a theme for release, it’s going to be for here on bbpress.org
Though I am certain someone will clone it in short time like the did with wordpress.org
I see. Well, alright, you mentioned that having bbpress nested underneath wordpress is a less common method of installation. How should I go about reinstalling it in the usual manner?
Have a look here on how to exclude a forum from the front page loop, whilst keeping the post limit intact.
limit forums included in latest discussions
Note the core hack required to keep the paging numbers correct.
Maybe you then need to write another small custom query to bring out just forum 17, as I’m not sure you if you can have two loops. (perhaps the WP multiple loop info would give some insight into this: https://codex.wordpress.org/The_Loop#Multiple_Loops)
Ahh gotcha about the RSS feed syndication.
Didn’t know you used FeedWordpress and then another bbPress plugin to sync between the two.
Definitely not the best way to go about things, but a nice workaround!
Would be nice if there was a separate RSS syndication plugin that was native to bbPress, but that’s just wishful thinking!
By the way, I replied to your problem on the thread you opened.
Not sure I provided the right answer… but hopefully someone else can look at your thread and give a response!
I am having a similar issue as others. I have uploaded a renamed bbPress directory that I renamed forums. It is sitting in the root along with wp-admin, etc. Inside that directory are all the files and directories for bbPress including bb-Admin, etc. But when I attempt to go to that directory I get a 404 error inside my WordPress mu, as if it is trying to load a blog. The error is where the blog would normally be. I do have a wildcard set for sub-domains and wondered what that might do. Do I have to take WordPress offline to do the install? It certainly seems that WordPress is trying to handle the request since if I specify ./forums/index.php the index.php disappears before the 404 error. btw I am on WordPress MU 2.8.2.
R-a-y: Thank you! The theme is a heavily modified version of Scoun.
Although I am soon to write a new template because of the css/html isnt that great on it. 
Just my way of learning the ropes.
About the RSS feeds: I use feedwordpress plugin to feed it into my wordpress. In wordpress then, I put in some arguments to filter out the RSS feed so it won’t show up there. Somehow it still shows up in my WordPress RSS so I need to find a way to filter it out from the RSS too.
The RSS syndication plugin can hold a number of RSS feeds with alot of options and automatically post articles.
Then I use BBpress WordPress Synchronization plugin and when bbpress finds a new post in WordPress it automatically syncs and creates a post in one of my bbpress subforums.
Somehow i dont want all my stuff to go into BbPress so when I write some new article in WordPress I can choose manually wether to sync this to BbPress or not.
One thing I have an issue with is the first page; I want to make an own “Latest Discussions” loop with all forums EXCEPT RSS. And then an own “latest discussions” With only RSS forum.
Problem is When i used this inside the loop
//Show latest discussions with all forums except id 17
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
<?php if( $topic->forum_id != 17 ) { ?>
codeblock
<?php } endif;?>
<?php endforeach; endif; // $topics ?>
//Show latest discussions but only forum 17
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
<?php if( $topic->forum_id == 17 ) { ?>
codeblock
<?php } endif;?>
<?php endforeach; endif; // $topics ?>
The pagination gets an error (Shows me fewer posts than the actual limit), and I cant use the same loop (With different conditions) twice.. Then I get a blank page. :S
So how should I do? Have any Idea? Im not so used to the bbpress loop yet..
AFAIK, there are just a couple reasons to want integration.
1. If you want users to be able to log in once, and comment in WordPress and participate in the forums, then integrated user data is useful.
2. Some people want to integrate their WordPress footer, sidebar and header, so access to WordPress functions get_sidebar(), get_header() and get_footer() are useful.
3. Sometimes people want to share data between the forum and the blog. Maybe a list of latest forum topics in the blog. Maybe they want a new topic created in the forum for every blog post. Integration is useful for that.
I don’t use integration, but I can understand why some people want it.
chris, i want to be able to insert a first post on certain threads, which i feel need it.
actually, i have a specific idea i want to accomplish, and there are two ways that i can think of implementing it – one that would utilize both wordpress/bbpress – the other would just use bbpress.
chris, could you, or anyone else with extensive wordpress/bbpress knowledge, email me at wldct6[at]yahoo[dot]com so i can describe exactly what i want to do, and help me figure out the best way to do it?
thanks.
OK I did a little spelunking, and a lot of what I need is actually already in my theme, just not appearing where I want it. I guess I need to move it into a <div></div> that appears after the thread info & is some how set to appear on the right of the page.
There are a few things that aren’t in the theme, though, like the RSS feed link. I think the favorites & thread tags form are there, though.
Time to go searching on google. Though if anyone has any pointers on setting this up so it’s at the top right of my page, under my navigation menu, I would appreciate it.
Tony