KorvinM (@korvinm)

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • In reply to: problem

    KorvinM
    Participant

    @korvinm


    KorvinM
    Participant

    @korvinm

    I’m having the same problem as kiagua and Andy Smith
    WordPress 3.6
    bbPress 2.3.2

    exactly the same error message, referencing line 1199. Interestingly the warning shows up twice.

    Anyway, here’s the whole function which contains that line:`/**
    * Adds ability to include or exclude specific post_parent ID’s
    *
    * @since bbPress (r2996)
    *
    * @global DB $wpdb
    * @global WP $wp
    * @param string $where
    * @param WP_Query $object
    * @return string
    */
    function bbp_query_post_parent__in( $where, $object = ” ) {
    global $wpdb, $wp;

    // Noop if WP core supports this already
    if ( in_array( ‘post_parent__in’, $wp->private_query_vars ) )
    return $where;

    // Bail if no object passed
    if ( empty( $object ) )
    return $where;

    // Only 1 post_parent so return $where
    if ( is_numeric( $object->query_vars[‘post_parent’] ) )
    return $where;

    // Including specific post_parent’s
    if ( ! empty( $object->query_vars[‘post_parent__in’] ) ) {
    $ids = implode( ‘,’, array_map( ‘absint’, $object->query_vars[‘post_parent__in’] ) );
    $where .= ” AND $wpdb->posts.post_parent IN ($ids)”;

    // Excluding specific post_parent’s
    } elseif ( ! empty( $object->query_vars[‘post_parent__not_in’] ) ) {
    $ids = implode( ‘,’, array_map( ‘absint’, $object->query_vars[‘post_parent__not_in’] ) );
    $where .= ” AND $wpdb->posts.post_parent NOT IN ($ids)”;
    }

    // Return possibly modified $where
    return $where;
    }`

    line 1199:`
    if ( in_array( ‘post_parent__in’, $wp->private_query_vars ) )
    return $where;`

    This might sound like a wild hack in the dark but I thought I’d have a go at simply making the second parameter an array, like so:

    // Noop if WP core supports this already
    	if ( in_array( 'post_parent__in', array($wp->private_query_vars) ) )
    		return $where;

    and much to my surprise this seems to have solved the problem in as much as the error warning is gone and as far as I can tell so far, the two (private) fora I have set up seem to be running as normal.

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