Making WordPress.org

Changeset 8375


Ignore:
Timestamp:
02/28/2019 08:22:40 PM (8 years ago)
Author:
iandunn
Message:

WordCamp Post Type: Migrate wpmu_new_blog to wp_initialize_site.

The old action is deprecated, per https://core.trac.wordpress.org/ticket/41333.

Location:
sites/trunk/wordcamp.org/public_html/wp-content
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/jetpack-tweaks/new-sites.php

    r7501 r8375  
    22
    33namespace WordCamp\Jetpack_Tweaks;
     4use WP_Site;
    45
    56defined( 'WPINC' ) or die();
     
    78add_filter( 'jetpack_get_default_modules',                     __NAMESPACE__ . '\default_jetpack_modules'       );
    89add_filter( 'pre_update_site_option_jetpack-network-settings', __NAMESPACE__ . '\auto_connect_new_sites', 10, 2 );
    9 add_action( 'wpmu_new_blog',                                   __NAMESPACE__ . '\schedule_connect_new_site'    );
     10add_action( 'wp_initialize_site',                              __NAMESPACE__ . '\schedule_connect_new_site', 11 );
    1011add_action( 'wcorg_connect_new_site',                          __NAMESPACE__ . '\wcorg_connect_new_site', 10, 2 );
    1112
     
    4041 * Schedule an email asking to connect Jetpack to WordPress.com
    4142 *
    42  * @param int $blog_id The blog id.
     43 * @param WP_Site $new_site
    4344 */
    44 function schedule_connect_new_site( $blog_id ) {
     45function schedule_connect_new_site( $new_site ) {
    4546        wp_schedule_single_event(
    4647                time() + 12 * HOUR_IN_SECONDS + 600, // After the the SSL certificate has been installed
    4748                'wcorg_connect_new_site_email',
    48                 array( $blog_id, get_current_user_id() )
     49                array( $new_site->blog_id, get_current_user_id() )
    4950        );
    5051}
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php

    r7888 r8375  
    163163                $wordcamp_meta     = get_post_custom( $wordcamp_id );
    164164                $lead_organizer    = $this->get_user_or_current_user( $wordcamp_meta['WordPress.org Username'][0] );
    165                 $site_meta         = array( 'public' => 1 );
    166                 $this->new_site_id = wpmu_create_blog( $url_components['host'], $path, 'WordCamp Event', $lead_organizer->ID, $site_meta );
    167                 // todo can probably just set the final name here, rather than a generic one here and the final one in set_default_options()
     165
     166                $blog_name = apply_filters( 'the_title', $wordcamp->post_title );
     167                if ( ! empty( $wordcamp->{'Start Date (YYYY-mm-dd)'} ) ) {
     168                        $blog_name .= date( ' Y', $wordcamp->{'Start Date (YYYY-mm-dd)'} );
     169                }
     170
     171                $this->new_site_id = wp_insert_site( array(
     172                        'domain'  => $url_components['host'],
     173                        'path'    => $path,
     174                        'title'   => $blog_name,
     175                        'user_id' => $lead_organizer->ID,
     176                ) );
    168177
    169178                if ( is_int( $this->new_site_id ) ) {
     
    392401                $coming_soon_settings['enabled'] = 'on';
    393402
    394                 $blog_name = apply_filters( 'the_title', $wordcamp->post_title );
    395                 if ( isset( $meta['Start Date (YYYY-mm-dd)'] ) && $meta['Start Date (YYYY-mm-dd)'][0] > 0 ) {
    396                         $blog_name .= date( ' Y', $meta['Start Date (YYYY-mm-dd)'][0] );
    397                 }
    398 
    399403                update_option( 'admin_email',                  $admin_email );
    400                 update_option( 'blogname',                     $blog_name );
    401404                update_option( 'blogdescription',              __( 'Just another WordCamp', 'wordcamporg' ) );
    402405                update_option( 'close_comments_for_old_posts', 1 );
Note: See TracChangeset for help on using the changeset viewer.