Skip to:
Content
Pages
Categories
Search
Top
Bottom

Some users can't see first post


  • mralexweber
    Participant

    @mralexweber

    This is a similar issue to another post: http://bbpress.org/forums/topic/first-post-not-showing/

    However, that other topic doesn’t seem to be getting feedback from knowledgeable developers, and I’ve done a bit of additional troubleshooting.

    Basically, some users on our site can *never* see the first post on any bbPress topics.

    I’ve tried disabling all types of caching (we’re using W3 Total Cache) and that had no effect. Also, we’re using WishList Member (closed-source membership plugin) and of course, other plugins.

    Inspecting the $bbpress variable while logged in as an admin and an affected user (in a different browser), I was able to find the following inconsistency in $bbpress->reply_query->request:
    admin’s:
    `SELECT SQL_CALC_FOUND_ROWS wp_1_posts.* FROM wp_1_posts FORCE INDEX (PRIMARY, post_parent) WHERE 1=1 AND (wp_1_posts.ID = 2904 OR wp_1_posts.post_parent = 2904) AND wp_1_posts.post_type IN (‘topic’, ‘reply’) AND (wp_1_posts.post_status = ‘publish’ OR wp_1_posts.post_status = ‘closed’) ORDER BY wp_1_posts.post_date ASC LIMIT 0, 15`

    affected user’s:
    `SELECT SQL_CALC_FOUND_ROWS wp_1_posts.ID FROM wp_1_posts WHERE 1=1 AND wp_1_posts.ID NOT IN (648,649,650,1067,1075,1085,1091,1102) AND wp_1_posts.post_parent = 2904 AND wp_1_posts.post_type IN (‘topic’, ‘reply’) AND (wp_1_posts.post_status = ‘publish’ OR wp_1_posts.post_status = ‘closed’) ORDER BY wp_1_posts.post_date ASC LIMIT 0, 15`

    I noticed there’s a section for wp_1_posts.ID NOT IN(…) which isn’t present for admin. Anyone know where this comes from?

    So, here’s the question: why can’t this user see all replies in every topic? Is there something I’m overlooking?

    Finally, if someone is willing to fix this issue for us for a reasonable fee, please email me directly at alex [at] theartofcharm [dotcom]

    Here’s the full $bbpress var dump (from admin user): http://pastebay.com/1189524
    and here’s one from an affected user: http://pastebay.com/1189525

    Thanks in advance!

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

  • Boone Gorges
    Participant

    @boonebgorges

    It sounds like something is modifying the SQL query before bbPress has a chance filter ‘posts_requests’ via _bbp_has_replies_where(), so that the search term in that function is no longer found in the query string.

    I recommend disabling plugins until you find the culprit.


    john13
    Participant

    @john13

    I’m also using WishList Member. Like I mentionned in the other topic, I have another site with the same plugins where it works just fine.

     


    mralexweber
    Participant

    @mralexweber

    Thanks for the insight, Boone! I’ll try that and report back.


    mralexweber
    Participant

    @mralexweber

    Looks like WishList Member is the culprit.

    Disabled, reloaded the page, it showed all replies. In order to fix the issue, I’ve set the affected users to a membership role with access to all posts/pages.

    I’ve contacted WishList via twitter asking to file a bug report. If you’re experiencing the same issue, and can confirm that it’s WishList Member-related, please contact WishList as well and ask them to fix the issue (@wishlistproduct on twitter).


    mralexweber
    Participant

    @mralexweber

    Okay, contacted WishList, and confirmed (again) that WLM is the culprit. WishList’s position is that they don’t support bbPress, but they’re helping me troubleshoot a bit.

    I’ve got a dev site with the unencrypted plugin for testing/debugging, but I’m not really sure where to start… I welcome your suggestions here or on twitter @alexweberis.

    How would you suggest I troubleshoot this issue further? Ideally, I’d like to be smart about it, rather than trying to go through the WishList Member plugin “from the top”.

    Thanks in advance for your suggestions.


    Boone Gorges
    Participant

    @boonebgorges

    I guess you might want to look for places where the plugin is hooked to one of the following:

    – `posts_request`

    – `parse_request`

    – `pre_get_posts`

    These are places where plugins can directly modify the way that the WP_Query SQL is built. It’s possible that WLM is interfering at one of these points – at least it’s someplace to start.


    Michael Macliver
    Participant

    @michael-macliver

    Hello mralexweber, did you manage to get Wishlist and bbPress working?


    mralexweber
    Participant

    @mralexweber

    Michael,

    Unfortunately, I haven’t been able to make any progress on this since I last posted. The best temporary solution I can recommend is to set any affected users with ability to “view all pages/posts”. I know, not a great solution.

    I encourage you to contact WishList about this issue and suggest that they fix it!

    Best,
    Alex


    jwondrusch
    Participant

    @jwondrusch

    After much trial and error, I’ve come to a solution that retains permission control and shows the first post when using Wishlist Member with bbPress:

    
    // Create a new filtering function that will add our where clause to the query
    add_filter( 'posts_where', 'your_filter_where', 99 );
    function your_filter_where( $where ) {
    
    	global $post;
            
            // Limit to posts so it's not ruining permission queries all around the site.  You could also check user level if you need further specificity.
    	if( get_post_type( $post->ID ) == 'topic' ) {
    
                    // The Solution: Match based on post id AND parent id.  The admin query did this, the user query did not, so we do a simple search and replace to make it happen.
    		$search = $wpdb->prefix . 'posts.post_parent = ' . $post->ID;
    		$replace = '( ' . $wpdb->prefix . 'posts.post_parent = ' . $post->ID . ' OR ' . $wpdb->prefix.'posts.ID = ' . $post->ID . ' ) ';
    		
    		$where = str_replace( $search, $replace, $where);
    
    	}
    
    	return $where;
    }
    

    Due to the way that WLM obfuscates their code, it’s impossible to know exactly HOW they are re-constructing queries, but this is a quick starting point for anyone looking to solve the issue of WLM not showing bbPress’s first post in a topic to users.

    Hope it helps!

    Jonathan


    Troy Dean
    Participant

    @teerock

    Hey @jwondrusch

    This function actually removed all forum topics and replies for the front end view of my bbPress Wishlist site.

    Any ideas?


    angeliti
    Participant

    @angeliti

    I’m also hitting this same issue, but with OptimizeMember plugin from OptimizePress instead of WLM.

    Any updates??


    Robin W
    Moderator

    @robin-w

    @angeliti – suggest you contact the plugin site – they claim to be bbpress compatible.
    https://optimizepress.zendesk.com/hc/en-us

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