stuartataltitude (@stuartataltitude)

Forum Replies Created

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

  • stuartataltitude
    Participant

    @stuartataltitude

    I tracked the problem down to the WP Members plugin function do_hide_posts. This calls
    $query->set( ‘post__not_in’, **array of hidden post ids** ). The intention (I think) is just to filter out hidden posts but for some reason this call (which only contains a list of hidden page Ids – not any bbpress topic or reply ids) causes all topic and reply ids to be stripped from the query’s Results.

    For the record (in case others have the same problem), I have now added the following to my functions.php in my child theme…

    add_action( ‘wpmem_after_init’ , ‘kmc_wpmem_after_init’);
    function kmc_wpmem_after_init() {
    global $
    remove_action( ‘pre_get_posts’, array( $wpmem, ‘do_hide_posts’ ) );
    add_action( ‘pre_get_posts’, ‘kmc_hide_posts’ );
    }
    function kmc_hide_posts( $query ) {
    global $wpmem;
    $index = 0;
    $hidden = array();
    $hidden_posts = $wpmem->get_hidden_posts();
    // Remove hidden pages from the list of posts to be ignored
    foreach($hidden_posts as $post_id){
    $post = get_post($post_id);
    $postType = get_post_type_object(get_post_type($post));
    if ($postType->labels->singular_name != “Page”) {
    $hidden[$index] = $post_id;
    $index++;
    }
    }
    if ( ! empty( $hidden ) ) {
    $query->set( ‘post__not_in’, $hidden );
    }
    return $query;
    }

    I still don’t understand why $query->set( ‘post__not_in’, **an array of 15 hidden page ids**) causes all topics and replies to be stripped from the output, but the above change solves my problem for now.


    stuartataltitude
    Participant

    @stuartataltitude

    I have tracked through to bbp_replies(). bbpress()->reply_query->have_posts() seems to give different results when logged in and logged out (iff WP-Members is active).
    When logged in, if a topic has 1 original post and 1 reply, this returns 1 first time, then 1 second time (for the reply) then “” (for no more). When logged out it only returns 1 (for the reply to the original post) then “”. So at first sight it seems to be something to do with querying the database (as opposed to posts being filtered out later for example).

    I know it is perhaps more something for the WP-Members plugin to look at (as they have broken your plugin and not vice versa) but if you have any ideas what might be going on – so I can point them in a direction for what to look for, that would be great. Must be lots of sites that are using both WP-Members and bbpress together – but maybe most don’t want visitors seeing forums and so haven’t hit this issue.


    stuartataltitude
    Participant

    @stuartataltitude

    ‘but the -‘ should have read ‘but the #8211’


    stuartataltitude
    Participant

    @stuartataltitude

    I have the same problem on my site. It is common for forum post titles to contain a hyphen but the – makes the notification email look very unprofessional. Would be great if this bug could be fixed.

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