Skip to:

INSERT queries for new Topic and new Post

  • This was originally going to be an “It’s not working!” post, but I made some progress. Now it’s “Is what I did ok?” post.

    I kept getting a”This Topic is Closed” error every time I tried to create a new topic. Traced it back to the insert statement in ‘bb_insert_topic’ in functions.php. The database was responding with the error of “The value ‘ ‘ is not a valid integer for column ‘topic_id’. (I am paraphrasing, I don’t have the exact response in front of me)

    I suspected it had something to do with the fact that the topic_id value is being supplied to MySql, but it is set to be an auto-increment / not null field.

    So, I commented out in the $default array definition in ‘bb_insert_topic’:

    // 'topic_id' => false, // accepts ids or slugs

    and I changed this line:

    unset( $default, $defaults );

    to this:

    unset( $args, $defaults );

    Did the same thing under the ‘bb_insert_post’ function in the same file, but for the ‘post_id’ variables.

    Presto. Everything seems to work OK now.

    Could this issue be specific to my version of MySql? Although it is strange, because the original query works just fine using a third party tool (SQLyog).

    Has anyone encountered this issue before? Or – can anyone comment on the validity of my changes, and if they might cause issues going forward?

    Finally – should this be logged as a bug?


    WP 2.6, BB 1.0, IIS 6.

Viewing 9 replies - 1 through 9 (of 9 total)

  • chrishajer


    What is your MySQL version?

    Ver 14.12 Distrib 5.0.45, for Win32 (ia32)

    5.0.45-community-nt MySQL Community Edition (GPL)

    I too am facing the same problem.

    I am trying on a local server (apache) wp2.6.2+bbpress alpha releases and also the latest version from the trunk

    I have tried on ,

    mysql version 5.0.16-nt

    mysql version is 5.0.67-community nt

    I think it is a bug.



    Sounds like both of you are on IIS web servers?

    i am using apache 2.2.9. php 5.2.6



    So much for my IIS guess. I am not having this trouble on a Linux server, MySQL 4.0.28-log, Apache 1.3.x, PHP 5.2.6 with Alpha 2.

    Same problem here, with an Apache server on Windows. Latest versions of all applications. I will try your solutions and see what happens.

    Just a question:

    do you include your wp functions in bbpress? I see calls to wp functions in several bb functions (also in bb_insert_topic and bb_insert_post) and I can imagine that if you dont include wp functions in bbpress, that these statements fail.

    I cannot include wp functions with the

    $bb->WP_BB = true;
    if (file_exists('../wp-blog-header.php'))
    if (file_exists('../../wp-blog-header.php'))

    part because then my forums don’t work. I can’t access my bb-admin pages and bbpress doesn’t recognize my users.

    It also seems to be working if you initialize the value of ‘topic_id’ as 0 (zero) instead of false. I found no problems with it so far.

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