Skip to:
Content

bbPress.org

Changeset 5010


Ignore:
Timestamp:
07/10/2013 04:29:09 AM (11 years ago)
Author:
johnjamesjacoby
Message:

In bbp_get_dropdown(), remove the hard-coded post_status checker, and trust bbp_pre_get_posts_normalize_forum_visibility() to do its job. We still pass 'post_status' as null, so that get_posts() gets passed the results of bbp_parse_args(). Also, remove 'sort_column' array key from when this used get_pages(), and rely on 'orderby' for get_posts() instead.

In bbp_pre_get_posts_normalize_forum_visibility(), remove empties and duplicates from the $post_stati array.

Fixes #2354.

Location:
trunk/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/template-tags.php

    r5005 r5010  
    13181318     *               box, the first value would of course be selected -
    13191319     *               though you can have that as none (pass 'show_none' arg))
    1320      *  - sort_column: Sort by? Defaults to 'menu_order, post_title'
     1320     *  - orderby: Defaults to 'menu_order title'
    13211321     *  - post_parent: Post parent. Defaults to 0
    13221322     *  - post_status: Which all post_statuses to find in? Can be an array
     
    13571357        $r = bbp_parse_args( $args, array(
    13581358            'post_type'          => bbp_get_forum_post_type(),
     1359            'post_parent'        => null,
     1360            'post_status'        => null,
    13591361            'selected'           => 0,
    1360             'sort_column'        => 'menu_order',
    13611362            'exclude'            => array(),
    1362             'post_parent'        => null,
    13631363            'numberposts'        => -1,
    1364             'orderby'            => 'menu_order',
     1364            'orderby'            => 'menu_order title',
    13651365            'order'              => 'ASC',
    13661366            'walker'             => '',
     
    13911391        }
    13921392
    1393         /** Post Status *******************************************************/
    1394 
    1395         // Define local variable(s)
    1396         $post_stati = array();
    1397 
    1398         // Public
    1399         $post_stati[] = bbp_get_public_status_id();
    1400 
    1401         // Forums
    1402         if ( bbp_get_forum_post_type() === $r['post_type'] ) {
    1403 
    1404             // Private forums
    1405             if ( current_user_can( 'read_private_forums' ) ) {
    1406                 $post_stati[] = bbp_get_private_status_id();
    1407             }
    1408 
    1409             // Hidden forums
    1410             if ( current_user_can( 'read_hidden_forums' ) ) {
    1411                 $post_stati[] = bbp_get_hidden_status_id();
    1412             }
    1413         }
    1414 
    1415         // Setup the post statuses
    1416         $r['post_status'] = implode( ',', $post_stati );
    1417 
    14181393        /** Setup variables ***************************************************/
    14191394
     
    14221397            'post_type'          => $r['post_type'],
    14231398            'post_status'        => $r['post_status'],
    1424             'sort_column'        => $r['sort_column'],
    14251399            'exclude'            => $r['exclude'],
    14261400            'post_parent'        => $r['post_parent'],
  • trunk/includes/forums/functions.php

    r5006 r5010  
    16951695
    16961696        // Add the statuses
    1697         $posts_query->set( 'post_status', $post_stati );
     1697        $posts_query->set( 'post_status', array_unique( array_filter( $post_stati ) ) );
    16981698    }
    16991699
Note: See TracChangeset for help on using the changeset viewer.