Skip to:
Content
Pages
Categories
Search
Top
Bottom

Bug: Scheduled topics appear when set to sticky, even if unpublished!


  • robertstaddon
    Participant

    @robertstaddon

    If a scheduled topic is set to be sticky (or super sticky), it will appear at the top of the forum’s topic list even though it hasn’t even been published yet! This appears to be a bug.

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

  • Robin W
    Moderator

    @robin-w

    agree, it seems to be a bug.

    I have lodged a trac ticket

    https://bbpress.trac.wordpress.org/ticket/3230

    I’ll see how easy it is to filter for a temporary fix


    Robin W
    Moderator

    @robin-w

    try this filter

    //make sure scheduled stickies don't show - pending fix by bbpress
    add_filter ('bbp_get_stickies', 'rew_get_stickies' , 10 , 2) ;
    function rew_get_stickies ($stickies, $forum_id ) {
    	$return = array () ;
    	//check if any are future
    	foreach ($stickies as $sticky) {
    		if (get_post_status( $sticky ) !='future') 
    		 array_push ($return, $sticky) ;
    	}
    return $return ;	
    }

    robertstaddon
    Participant

    @robertstaddon

    Thank you, @robin-w!

    So I found found the cause of the bug. There is a typo on line 303 of the “bbpress/includes/topics/template.php” file in the latest version of bbPress (2.5.14). It tries to set the “post_status” query value to “readable”. This is an invalid value for “post_status”. What the programmer intended was to set the “perm” query value to “readable”.


    robertstaddon
    Participant

    @robertstaddon

    Here is the incorrect piece of code that is currently there:

    	// Lean on the 'perm' query var value of 'readable' to provide statuses
    	} else {
    		$sticky_query['post_status'] = $r['perm'];
    	}

    And here is how the code should read:

    	// Lean on the 'perm' query var value of 'readable' to provide statuses
    	} else {
    		$sticky_query['perm'] = $r['perm'];
    	}

    Robin W
    Moderator

    @robin-w

    so 303 should read

    $sticky_query['perm'] = $r['perm'];

    yes ?


    robertstaddon
    Participant

    @robertstaddon

    Correct! Changing line 303 to what you put above does fix the issue.


    Robin W
    Moderator

    @robin-w

    looking at 2.6 rc5 I think this is fixed in this version which will hopefully be a live version soon.

    I doubt that 2.5.14 will get this fix.


    robertstaddon
    Participant

    @robertstaddon

    This typo still exists, which continues to publicly display Private or Scheduled sticky posts in the latest version of bbPress 2.6.4.

    It can be easily fixed by correcting line 404 of the “bbpress/includes/topics/template.php” file to set $sticky_query[‘perm’] instead of $sticky_query[‘post_status’].

    This is the correct code that works:

    
    // Allowed statuses, or lean on the 'perm' argument (probably 'readable')
    $sticky_query['perm'] = bbp_get_view_all( 'edit_others_topics' )			? 
      $r['post_status']
      : $r['perm'];
    
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar