bp_forums_new_forum

Create a forum.

Description

(int) bp_forums_new_forum( (string) $args = '' ); 

Wrapper for .

Returns (int)

ID of the newly created forum.

Parameters (1)

0. $args — Optional. (string) => ''
Forum setup arguments.

Options

  • forum_name (string) => ''

    Name of the forum.

  • forum_desc (string) => ''

    Description of the forum.

array(

    /**
     * Name of the forum.
     *
     * @type string
     * @default ''
     */
    'forum_name' => '',

    /**
     * Description of the forum.
     *
     * @type string
     * @default ''
     */
    'forum_desc' => ''
);        


Usage

  1. if ( !function_exists( 'bp_forums_new_forum' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-functions.php'; 
  3.  
  4. // Forum setup arguments. 
  5. $args = array( 
  6. 'forum_name' => '', 
  7. 'forum_desc' => '' 
  8. ); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_forums_new_forum($args); 
  12.  

Defined (1)

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

/bp-forums/bp-forums-functions.php  
  1. function bp_forums_new_forum( $args = '' ) { 
  2.  
  3. /** This action is documented in bp-forums/bp-forums-screens.php */ 
  4.  
  5. $r = wp_parse_args( $args, array( 
  6. 'forum_name' => '',  
  7. 'forum_desc' => '',  
  8. 'forum_parent_id' => bp_forums_parent_forum_id(),  
  9. 'forum_order' => false,  
  10. 'forum_is_category' => 0 
  11. ) ); 
  12. extract( $r, EXTR_SKIP ); 
  13.  
  14. return bb_new_forum( array( 'forum_name' => stripslashes( $forum_name ), 'forum_desc' => stripslashes( $forum_desc ), 'forum_parent' => $forum_parent_id, 'forum_order' => $forum_order, 'forum_is_category' => $forum_is_category ) );