bbp_get_form_forum_status_dropdown( $args = '' )
Return the forum status dropdown
Description
Parameters
- $forum_id
-
(Required) The forum id to use
Return
(string) HTML select list for selecting forum status
Source
File: bp-forums/forums/template.php
2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 | function bbp_get_form_forum_status_dropdown( $args = '' ) { // Backpat for handling passing of a forum ID if ( is_int ( $args ) ) { $forum_id = (int) $args ; $args = array (); } else { $forum_id = 0; } // Parse arguments against default values $r = bbp_parse_args( $args , array ( 'select_id' => 'bbp_forum_status' , 'tab' => bbp_get_tab_index(), 'forum_id' => $forum_id , 'selected' => false ), 'forum_status_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_forum_edit() ) { $r [ 'forum_id' ] = bbp_get_forum_id( $r [ 'forum_id' ] ); $r [ 'selected' ] = bbp_get_forum_status( $r [ 'forum_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_forum_statuses() 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_forum_status_dropdown' , ob_get_clean(), $r ); } |
Changelog
Version | Description |
---|---|
bbPress (r3563) | 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.