Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/27/2012 02:38:36 AM (14 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-actions.php

    r3766 r3768  
    122122add_action( 'bbp_template_notices', 'bbp_template_notices' );
    123123
    124 // Caps & Roles
    125 add_action( 'bbp_activation',   'bbp_add_roles',    1 );
    126 add_action( 'bbp_activation',   'bbp_add_caps',     2 );
    127 add_action( 'bbp_deactivation', 'bbp_remove_caps',  1 );
    128 add_action( 'bbp_deactivation', 'bbp_remove_roles', 2 );
    129 
    130 // Options & Settings
    131 add_action( 'bbp_activation', 'bbp_add_options', 1 );
    132 
    133 // Multisite
    134 add_action( 'bbp_new_site', 'bbp_add_roles',   2 );
    135 add_action( 'bbp_new_site', 'bbp_add_caps',    4 );
    136 add_action( 'bbp_new_site', 'bbp_add_options', 6 );
    137 
    138124// Parse the main query
    139125add_action( 'parse_query', 'bbp_parse_query', 2 );
     
    239225add_action( 'bbp_new_topic', 'bbp_global_access_auto_role' );
    240226add_action( 'bbp_new_reply', 'bbp_global_access_auto_role' );
    241 
    242 // Flush rewrite rules
    243 add_action( 'bbp_activation',   'flush_rewrite_rules' );
    244 add_action( 'bbp_deactivation', 'flush_rewrite_rules' );
    245227
    246228/**
     
    298280
    299281/**
    300  * When a new site is created in a multisite installation, run the activation
    301  * routine on that site
    302  *
    303  * @since bbPress (r3283)
    304  *
    305  * @param int $blog_id
    306  * @param int $user_id
    307  * @param string $domain
    308  * @param string $path
    309  * @param int $site_id
    310  * @param array() $meta
    311  */
    312 function bbp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
    313 
    314         // Switch to the new blog
    315         switch_to_blog( $blog_id );
    316 
    317         // Do the bbPress activation routine
    318         do_action( 'bbp_new_site' );
    319 
    320         // restore original blog
    321         restore_current_blog();
    322 }
    323 add_action( 'wpmu_new_blog', 'bbp_new_site', 10, 6 );
    324 
    325 /**
    326282 * Plugin Dependency
    327283 *
Note: See TracChangeset for help on using the changeset viewer.