Skip to:

from wordpress plugin, bb-load.php causes blank page

  • Howdy,

    WordPress 2.3.3

    bbPress latest from yesterday

    Wordpress Integration

    I’ve created a very simple wordpress plugin to attempt to allow wordpress posts and comments to also be put in a bbPress forum.

    When I make a post and my plugin attempts to:

    require_once(dirname(__FILE__) . '/../../bbpress/bb-load.php');

    I get a blank page, and the post/comment does not get sent to bbpress. I’ve have traced this to the point where bb-settings.php calls this line:

    require( BBPATH . BBINC . 'template-functions.php');

    but no matter what I put in template-functions.php (even writing to a file), I get the blank page.

    I’ve checked all my error logs, and there are no errors being logged, not even a 500 error. I’m at my wits end, and late on this project, please help.



Viewing 3 replies - 1 through 3 (of 3 total)
  • also, this same problem happens when I try to use the bbsync plugin.



    Without a link to your forum or an example of the plugin code, it’s going to be hard to help. The blank screen is almost certainly a 500 error, so it should be logged somewhere, depending on your server configuration.

    If you disable the plugin and everything works, you know the problem is with the plugin. So, you need to fix that. Without posting the plugin, it will be hard for anyone to help you fix it.

    Most of this code was taken directly from the bbsync plugin (I’ve attempted to remove need for configuration, and some of the bbsync functionality/flexibility).

    There are really truly NO errors logged anywhere for this.

    here is my plugin in it’s entirety:

    define('CRBBFORUMID', 1);

    function cr_post($post_id) {
    global $bbdb, $wpdb, $current_user;

    require (dirname(__FILE__) . '/../../bbpress/config.php');
    // get the post
    $post = wp_get_single_post( $post_id );

    if(!$current_user) {

    $post_title = $bbdb->escape($post->post_title);

    $bb_topic_arr = get_post_meta($post_id, 'bb_topic', $true);
    $bb_topic_id = $bb_topic_arr[0];

    // if bb has this post already, update the topic
    $topic_exists = false;
    if ($bb_topic_id) {
    if(bb_update_topic($post_title, $bb_topic_id)) {
    $topic_exists = true;
    $reply = bb_get_first_post($bb_topic_id);
    bb_update_post($post_text, $reply->post_id, $bb_topic_id);

    // if not, create a new topic
    if (!$topic_exists) {
    $topic_id = bb_new_topic($post_title, CRBBFORUMID, $tags);
    $reply_id = bb_new_post($bb_topic_id, $post_text);

    $r = false;
    if ($topic_id && $reply_id) {
    bb_update_topicmeta($bb_topic_id, 'wp_post', $post_id);
    if (!update_post_meta($post_id, 'bb_topic', $topic_id)) {
    add_post_meta($post_id, 'bb_topic', $topic_id, true);
    $r = true;
    $oldcoms = get_approved_comments($post_id);
    if($oldcoms) {
    foreach($oldcoms AS $oldcom) {
    if($user = bb_get_user($oldcom->comment_author)) {
    $time = strtotime($oldcom->comment_date);
    $text = '<em><strong>This comment was originally posted at ' . date('G:i', $time) . ' on ' . date('jS F Y', $time) . ".</strong></em>nn" . $oldcom->comment_content;
    bb_new_post($topic_id, mysql_real_escape_string($text));
    return $r;

    function cr_comment($comment_id, $approval_status) {
    global $bbdb, $wpdb;
    require_once(dirname(__FILE__) . '/../../bbpress/bb-load.php');

    $comment = get_comment($comment_id);

    $topic_id = get_post_meta($comment->comment_post_ID, 'bb_topic', $true);
    if(($topic_id) && ($approval_status == 1) && ($comment->user_id) && bb_set_current_user($comment->user_id)) {
    //topic linked, genuine comment, actual user, bb likes user
    bb_new_post($topic_id, $comment->comment_content);
    return true;
    } else {
    return false;

    add_action('publish_post', 'cr_post');
    add_action('comment_post', 'cr_comment');

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar