Skip to:
Content

bbPress.org


Ignore:
Timestamp:
09/10/2011 10:27:19 PM (13 years ago)
Author:
johnjamesjacoby
Message:

API adjustments:

  • Refactor _status_ vars into callable functions.
  • Audit usage of $bbp global.
  • Perform get_class() checks on extensions to avoid errors if global $bbp is overloaded.
  • Bump DB version to 175.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-forum-template.php

    r3496 r3505  
    6262
    6363    // Setup possible post__not_in array
    64     $post_stati[] = 'publish';
     64    $post_stati[] = bbp_get_public_status_id();
    6565
    6666    // Super admin get whitelisted post statuses
    6767    if ( is_super_admin() ) {
    68         $post_stati = array( 'publish', 'private', 'hidden' );
     68        $post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() );
    6969
    7070    // Not a super admin, so check caps
     
    7373        // Check if user can read private forums
    7474        if ( current_user_can( 'read_private_forums' ) )
    75             $post_stati[] = 'private';
     75            $post_stati[] = bbp_get_private_status_id();
    7676
    7777        // Check if user can read hidden forums
    7878        if ( current_user_can( 'read_hidden_forums' ) )
    79             $post_stati[] = 'hidden';
     79            $post_stati[] = bbp_get_hidden_status_id();
    8080    }
    8181
     
    580580
    581581    // Setup possible post__not_in array
    582     $post_stati[] = 'publish';
     582    $post_stati[] = bbp_get_public_status_id();
    583583
    584584    // Super admin get whitelisted post statuses
    585585    if ( is_super_admin() ) {
    586         $post_stati = array( 'publish', 'private', 'hidden' );
     586        $post_stati = array( bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id() );
    587587
    588588    // Not a super admin, so check caps
     
    591591        // Check if user can read private forums
    592592        if ( current_user_can( 'read_private_forums' ) )
    593             $post_stati[] = 'private';
     593            $post_stati[] = bbp_get_private_status_id();
    594594
    595595        // Check if user can read hidden forums
    596596        if ( current_user_can( 'read_hidden_forums' ) )
    597             $post_stati[] = 'hidden';
     597            $post_stati[] = bbp_get_hidden_status_id();
    598598    }
    599599
     
    636636 */
    637637function bbp_list_forums( $args = '' ) {
    638     global $bbp;
    639638
    640639    // Define used variables
     
    10771076     */
    10781077    function bbp_get_forum_topics_link( $forum_id = 0 ) {
    1079         global $bbp;
    10801078
    10811079        $forum    = bbp_get_forum( bbp_get_forum_id( (int) $forum_id ) );
     
    13751373     */
    13761374    function bbp_is_forum_closed( $forum_id = 0, $check_ancestors = true ) {
    1377         global $bbp;
    1378 
    1379         $forum_id = bbp_get_forum_id( $forum_id );
    1380         $retval    = ( $bbp->closed_status_id == bbp_get_forum_status( $forum_id ) );
     1375
     1376        $forum_id = bbp_get_forum_id( $forum_id );
     1377        $retval    = ( bbp_get_closed_status_id() == bbp_get_forum_status( $forum_id ) );
    13811378
    13821379        if ( !empty( $check_ancestors ) ) {
     
    14081405 */
    14091406function bbp_is_forum_public( $forum_id = 0, $check_ancestors = true ) {
    1410     global $bbp;
    14111407
    14121408    $forum_id   = bbp_get_forum_id( $forum_id );
     
    14141410
    14151411    // If post status is public, return true
    1416     $retval = ( 'publish' == $visibility );
     1412    $retval = ( bbp_get_public_status_id() == $visibility );
    14171413
    14181414    // Check ancestors and inherit their privacy setting for display
     
    14451441 */
    14461442function bbp_is_forum_private( $forum_id = 0, $check_ancestors = true ) {
    1447     global $bbp;
    14481443
    14491444    $forum_id   = bbp_get_forum_id( $forum_id );
     
    14511446
    14521447    // If post status is private, return true
    1453     $retval = ( 'private' == $visibility );
     1448    $retval = ( bbp_get_private_status_id() == $visibility );
    14541449
    14551450    // Check ancestors and inherit their privacy setting for display
     
    14821477 */
    14831478function bbp_is_forum_hidden( $forum_id = 0, $check_ancestors = true ) {
    1484     global $bbp;
    14851479
    14861480    $forum_id   = bbp_get_forum_id( $forum_id );
     
    14881482
    14891483    // If post status is private, return true
    1490     $retval = ( 'hidden' == $visibility );
     1484    $retval = ( bbp_get_hidden_status_id() == $visibility );
    14911485
    14921486    // Check ancestors and inherit their privacy setting for display
Note: See TracChangeset for help on using the changeset viewer.