Skip to:
Content
Pages
Categories
Search
Top
Bottom

500 error: bbp_pre_get_posts_normalize_forum_visibility


  • tweichart
    Participant

    @tweichart

    Hey guys,

    just stumbled over a small 500 error in the functions file:

    
    AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /var/www/vhosts/mydomain/wp-content/plugins/bbpress/includes/forums/functions.php:1854
    Stack trace:
    #0 /var/www/vhosts/mydomain/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))
    #1 /var/www/vhosts/mydomain/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
    #2 /var/www/vhosts/mydomain/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
    #3 /var/www/vhosts/mydomain/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)
    #4 /var/www/vhosts/mydomain/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()
    #5 /var/www/vhosts/mydomain/wp-includes/class-wp-query.php(3347): WP_Query->query(Array)
    #6 /var/www/vhosts/mydomain/wp-conten...
    

    Should be fixeable, ln 1850-1854 is in the bbp_pre_get_posts_normalize_forum_visibility function and looks like this:

    
    // Get any existing meta queries
    $meta_query   = $posts_query->get( 'meta_query' );
    
    // Add our meta query to existing
    $meta_query[] = $forum_ids;
    

    adding an array check to ln 1850 should suffice (i do actually not know what one’s trying to achieve here, so this is just a quickfix):

    
    $meta_query   = is_array( $posts_query->get( 'meta_query' ) ) ? $posts_query->get( 'meta_query' ) : array( $posts_query->get( 'meta_query' ) );
    

    side-note: wp version 4.7.3, bbpress version 2.5.12, php version 7.1.3

    Cheers,
    Toby

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