Skip to:
Content

bbPress.org


Ignore:
Timestamp:
10/30/2011 11:34:25 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Abstract Forum metabox dropdown builders into template tags to be used in front-end editor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin/bbp-metaboxes.php

    r3505 r3563  
    251251    /** Type ******************************************************************/
    252252
    253     $forum['type'] = array(
    254         'forum'    => __( 'Forum',    'bbpress' ),
    255         'category' => __( 'Category', 'bbpress' )
    256     );
    257     $type_output = '<select name="bbp_forum_type" id="bbp_forum_type_select">' . "\n";
    258 
    259     foreach( $forum['type'] as $value => $label )
    260         $type_output .= "\t" . '<option value="' . $value . '"' . selected( bbp_is_forum_category( $post->ID ) ? 'category' : 'forum', $value, false ) . '>' . esc_html( $label ) . '</option>' . "\n";
    261 
    262     $type_output .= '</select>';
    263 
    264     /** Status ****************************************************************/
    265 
    266     $forum['status']   = array(
    267         'open'   => __( 'Open',   'bbpress' ),
    268         'closed' => __( 'Closed', 'bbpress' )
    269     );
    270     $status_output = '<select name="bbp_forum_status" id="bbp_forum_status_select">' . "\n";
    271 
    272     foreach( $forum['status'] as $value => $label )
    273         $status_output .= "\t" . '<option value="' . $value . '"' . selected( bbp_is_forum_closed( $post->ID, false ) ? 'closed' : 'open', $value, false ) . '>' . esc_html( $label ) . '</option>' . "\n";
    274 
    275     $status_output .= '</select>';
    276 
    277     /** Visibility ************************************************************/
    278 
    279     $forum['visibility']  = array(
    280         bbp_get_public_status_id()  => __( 'Public',  'bbpress' ),
    281         bbp_get_private_status_id() => __( 'Private', 'bbpress' ),
    282         bbp_get_hidden_status_id()  => __( 'Hidden',  'bbpress' )
    283     );
    284     $visibility_output = '<select name="bbp_forum_visibility" id="bbp_forum_visibility_select">' . "\n";
    285 
    286     foreach( $forum['visibility'] as $value => $label )
    287         $visibility_output .= "\t" . '<option value="' . $value . '"' . selected( bbp_get_forum_visibility( $post->ID ), $value, false ) . '>' . esc_html( $label ) . '</option>' . "\n";
    288 
    289     $visibility_output .= '</select>';
    290 
    291     /** Output ****************************************************************/ ?>
     253    ?>
    292254
    293255    <p>
    294256        <strong class="label"><?php _e( 'Type:', 'bbpress' ); ?></strong>
    295257        <label class="screen-reader-text" for="bbp_forum_type_select"><?php _e( 'Type:', 'bbpress' ) ?></label>
    296         <?php echo $type_output; ?>
    297     </p>
     258        <?php bbp_form_forum_type_dropdown( $post->ID ); ?>
     259    </p>
     260
     261    <?php
     262
     263    /** Status ****************************************************************/
     264
     265    ?>
    298266
    299267    <p>
    300268        <strong class="label"><?php _e( 'Status:', 'bbpress' ); ?></strong>
    301269        <label class="screen-reader-text" for="bbp_forum_status_select"><?php _e( 'Status:', 'bbpress' ) ?></label>
    302         <?php echo $status_output; ?>
    303     </p>
     270        <?php bbp_form_forum_status_dropdown( $post->ID ); ?>
     271    </p>
     272
     273    <?php
     274
     275    /** Visibility ************************************************************/
     276
     277    ?>
    304278
    305279    <p>
    306280        <strong class="label"><?php _e( 'Visibility:', 'bbpress' ); ?></strong>
    307281        <label class="screen-reader-text" for="bbp_forum_visibility_select"><?php _e( 'Visibility:', 'bbpress' ) ?></label>
    308         <?php echo $visibility_output; ?>
     282        <?php bbp_form_forum_visibility_dropdown( $post->ID ); ?>
    309283    </p>
    310284
    311285    <hr />
     286
     287    <?php
     288
     289    /** Parent ****************************************************************/
     290
     291    ?>
    312292
    313293    <p>
Note: See TracChangeset for help on using the changeset viewer.