bp_forums_openclose_topic

Set a topic's open/closed status.

Description

bp_forums_openclose_topic( (string) $args = '' ); 

Parameters (1)

0. $args — Optional. (string) => ''
The args.

Options

  • topic_id (int) => 0

    ID of the topic whose status is being changed.

array(

    /**
     * ID of the topic whose status is being changed.
     *
     * @type int
     */
    'topic_id' => 0
);        


Usage

  1. if ( !function_exists( 'bp_forums_openclose_topic' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-functions.php'; 
  3.  
  4. // The args. 
  5. $args = array( 
  6. 'topic_id' => 0 
  7. ); 
  8.  
  9. // NOTICE! Understand what this does before running. 
  10. $result = bp_forums_openclose_topic($args); 
  11.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bp-forums-functions.php  
  1. function bp_forums_openclose_topic( $args = '' ) { 
  2.  
  3. /** This action is documented in bp-forums/bp-forums-screens.php */ 
  4.  
  5. $r = wp_parse_args( $args, array( 
  6. 'topic_id' => false,  
  7. 'mode' => 'close' // Stick/unstick. 
  8. ) ); 
  9. extract( $r, EXTR_SKIP ); 
  10.  
  11. if ( 'close' == $mode ) 
  12. return bb_close_topic( $topic_id ); 
  13. else if ( 'open' == $mode ) 
  14. return bb_open_topic( $topic_id ); 
  15.  
  16. return false;