bbp_get_form_topic_status_dropdown( $args = '' )
Returns topic status downdown
Description
This dropdown is only intended to be seen by users with the ‘moderate’ capability. Because of this, no additional capablitiy checks are performed within this function to check available topic statuses.
Parameters
- $args
-
(Optional) This function supports these arguments: - select_id: Select id. Defaults to bbp_open_close_topic - tab: Tabindex - topic_id: Topic id - selected: Override the selected option
Default value: ''
Source
File: bp-forums/topics/template.php
3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 | function bbp_get_form_topic_status_dropdown( $args = '' ) { // Parse arguments against default values $r = bbp_parse_args( $args , array ( 'select_id' => 'bbp_topic_status' , 'tab' => bbp_get_tab_index(), 'topic_id' => 0, 'selected' => false ), 'topic_open_close_select' ); // No specific selected value passed if ( empty ( $r [ 'selected' ] ) ) { // Post value is passed if ( bbp_is_post_request() && isset( $_POST [ $r [ 'select_id' ] ] ) ) { $r [ 'selected' ] = $_POST [ $r [ 'select_id' ] ]; // No Post value was passed } else { // Edit topic if ( bbp_is_topic_edit() ) { $r [ 'topic_id' ] = bbp_get_topic_id( $r [ 'topic_id' ] ); $r [ 'selected' ] = bbp_get_topic_status( $r [ 'topic_id' ] ); // New topic } else { $r [ 'selected' ] = bbp_get_public_status_id(); } } } // Used variables $tab = ! empty ( $r [ 'tab' ] ) ? ' tabindex="' . (int) $r [ 'tab' ] . '"' : '' ; // Start an output buffer, we'll finish it after the select loop ob_start(); ?> <select name= "<?php echo esc_attr( $r['select_id'] ) ?>" id= "<?php echo esc_attr( $r['select_id'] ); ?>_select" <?php echo $tab ; ?>> <?php foreach ( bbp_get_topic_statuses( $r [ 'topic_id' ] ) as $key => $label ) : ?> <option value= "<?php echo esc_attr( $key ); ?>" <?php selected( $key , $r [ 'selected' ] ); ?>><?php echo esc_html( $label ); ?></option> <?php endforeach ; ?> </select> <?php // Return the results return apply_filters( 'bbp_get_form_topic_status_dropdown' , ob_get_clean(), $r ); } |
Changelog
Version | Description |
---|---|
bbPress (r5059) | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.