Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/27/2012 02:38:36 AM (15 years ago)
Author:
johnjamesjacoby
Message:

First pass at creating forum content on first installation.

  • Move bbp_activation and bbp_deactivation action hooks into admin actions so they are not run by site visitors
  • Introduce bbp_create_initial_content() function to handle insertion of initial forum, topic, and reply
  • Fixes #1701
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-core-update.php

    r3765 r3768  
    152152}
    153153
     154/**
     155 * Create a default forum, topic, and reply
     156 *
     157 * @since bbPress (r3767)
     158 */
     159function bbp_create_initial_content() {
     160
     161        // Create the initial forum
     162        $forum_id = bbp_insert_forum( array(
     163                'post_title'     => __( 'General', 'bbpress' ),
     164                'post_content'   => __( 'General chit-chat', 'bbpress' )
     165        ) );
     166
     167        // Create the initial topic
     168        $topic_id = bbp_insert_topic(
     169                array(
     170                        'post_parent'    => $forum_id,
     171                        'post_title'     => __( 'Hello World!', 'bbpress' ),
     172                        'post_content'   => __( 'I am the first topic in your new forums. You can keep me, edit me, trash me, or delete me.', 'bbpress' )
     173                ),
     174                array( 'forum_id'    => $forum_id )
     175        );
     176
     177        // Create the initial topic
     178        bbp_insert_reply(
     179                array(
     180                        'post_parent'    => $topic_id,
     181                        'post_title'     => __( 'Re: Hello World!', 'bbpress' ),
     182                        'post_content'   => __( 'Oh, and this is what a reply looks like.', 'bbpress' )
     183                ),
     184                array(
     185                        'forum_id'           => $forum_id,
     186                        'topic_id'           => $topic_id
     187                )
     188        );
     189}
     190
    154191?>
Note: See TracChangeset for help on using the changeset viewer.