Integrating to WP has broken the static front page
-
I just finished a test integration of bbpress into word-press and all is working very well with one exception. The static front page for word press has stopped functioning when I add the following to the end of the wp-config.php file:
if ( !defined(‘BBDB_NAME’) )
{
require_once(ABSPATH.’forum/bb-load.php’);
}
If I remove this and the couple of bbpress calls that I’m using which require this, the static front page works again. I think I’m just too tired to find the answer in the source.
Has anyone solved this? BTW — this is WP version 2.5.1 and bbpress 0.9.
Thanks in advance for any help.
-
Ok, so I know where the failure is coming from, but I’ve not yet identified the underlying cause.
When I load the bb-load.php in my wp-config.php as above, the wp function is_page fails to report back when an object is a page vs. a post.
I will keep digging, but if anyone has seen/solved this, please let me know.
I was wrong in my previous post. The is_page function is failing in this case, because the post-$ID is different when I include the bb-load.php.
When I have this in my wp-config.php, the system is attempting to load post id 4 which is a posts page. However, when I take this out, it is correctly loading the static page I’ve defined in the Reading Options, which is post ID 2.
Can someone point me to the PHP source in WP where the post ID of the front page is set? I just can’t seem to find it.
So I have confirmed that this happens even if I set both bbpress and wordpress to the default themes, so it is definitely not something in the themes I’ve customized.
I really wish I could find the code where wp is determining the post ID of the home/front page as I suspect that is the best place to start trying to tackle this.
More details for those who are interested (still no resolution):
With the bb-load.php removed from wp-config.php, I get the following do_action calls up to the point where I can see that the page ID of the front page has been correctly loaded.
plugins_loaded
sanitize_comment_cookies
set_current_user
init
widgets_init
posts_selection (at this point the page ID is set correctly).
When I put the bb-load.php back into the wp-config, I get the following:
plugins_loaded
sanitize_comment_cookies
set_current_user
init
widgets_init
bb_options_loaded
bb_underscore_plugins_loaded
bb_plugins_loaded
bb_get_roles
bb_get_current_user
bb_init
bb_send_headers
posts_selection (and at this point the page ID is wrong)
If any one has any insight as why including the bb-load.php would cause word press to load page id zero as the front page instead of the one you have configured in the static page setting, please let me know.
I’m digging through the calls in the WP initialization, and frankly, I’m just not spotting the problem.
Thanks
To me this sounds like you are way off on the wrong track. I’ve never heard of anything like this before. I use a static front page for WordPress and have never had this problem.
Did you install bbpress and wordpress into separate folders? Is bbPress in a subfolder of WordPress?
Did you create an .htaccess for bbPress and are you using permalinks?
Is this relevant at all?
Not trying to distract you from the work you’re doing, but I’ve never heard of anyone going off in that direction before for a problem like this.
Also, why are you loading bb-load.php into WordPress? Do you need to use bbPress functions inside WordPress?
Thanks for the input. I’m pretty sure I’m off in the wrong direction, I’m just trying to dig through what the WP and BB code are doing under the covers so that I have a better understanding of where this problem is coming from. It’s simply the analytical part of me wanting to understand the whole system.
As for why, I am currently calling a few bbpress functions from my wp pages.
I’m actually reviewing what I’m using now to see if I can just eliminate the use of the bbpress functions on the WP pages. I think I can probably just eliminate the need (at least for now).
That said, I still want to dig in and get to the bottom of this. It seems like there should be a really easy answer for this (btw — I don’t think it’s the 404 problem from the other thread you linked).
Thanks again for the feedback. Given I’m doing this on my own time, I may not get back to it for a while (I have funded development to finish for work). I’ll post back when I have a chance to re-review this.
Ressurecting the dead.
I want to call the BB login_form function into WP (to use that as my login, register, etc link). But. I also use a static homepage and I get this problem too.
bbPress is in /forums
WordPress is in /blog (with the ‘give WordPress it’s own directory’ tweak so it pretends to be in root)
I am using PermaLinks and have .htaccess
I would try building your own html login form on which ever WP theme file you’d like it on, and then just pass the variables to your bbpress/login.php file.
*snicker* That was so much easier. Sometimes I get stupider the more I try to code!
<li style="list-style:none">
<h2>Meta</h2>
<?php global $user_ID, $user_identity, $user_level ?>
<?php if ( $user_ID ) : ?>
<p><?php if ( $avatar = get_avatar( $user_ID, $size = '50' ) ) : ?>
<div style="float:right;"><?php echo $avatar; ?></div>
<?php unset($avatar); endif; ?>
<?php printf(__('<strong>Welcome, %1$s!</strong>'), $user_identity );?>
<br /><?php global $current_user; ?> <a href="http://domain.net/forums/profile.php?id=<?php echo $user_ID; ?> ">Profile</a> | <a href="<?php echo wp_logout_url(); ?>">Logout</a>
</p>
<div style="clear:right"></div>
<?php elseif ( get_option('users_can_register') ) : ?>
<form action="http://domain.net/blog/wp-login.php" method="post">
<p>
<label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /> User</label><br />
<label for="pwd"><input type="password" name="pwd" id="pwd" size="22" /> Password</label><br />
<input type="submit" name="submit" value="Send" class="button" />
<label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label><br />
</p>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
</form>
<p><a href="http://domain.net/forums/register.php">Register</a> | <a href="http://domain.net/forums/bb-login.php">Recover password</a></p>
<?php endif; ?>
</li>
- You must be logged in to reply to this topic.