Making WordPress.org


Ignore:
Timestamp:
03/01/2019 07:26:16 PM (6 years ago)
Author:
coreymckrill
Message:

WordCamp: Updates to generated content for compatibility with block editor

  • Update the post and page stubs that are added when a new WordCamp site is created
  • Update the Forms-to-Drafts plugin so speaker and session posts created from the Call For Speakers form use blocks
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-forms-to-drafts/wordcamp-forms-to-drafts.php

    r6765 r8384  
    270270     *   insert custom fields programmatically.
    271271     * - Sideload the logo from submitted URL and set it as the featured image.
     272     * - Add a Company Description field to the Call For Sponsors form stub, or populate content from something else?
     273     * - Also ensure content is formatted for the block editor.
    272274     *
    273275     * @param int   $submission_id
     
    379381     */
    380382    protected function create_draft_speaker( $speaker ) {
     383        $content = $speaker['Your Bio'] ?? '';
     384
     385        if ( $content ) {
     386            $content = wpautop( $content );
     387            $content = str_replace( '<p>', "<!-- wp:paragraph -->\n<p>", $content );
     388            $content = str_replace( '</p>', "</p>\n<!-- /wp:paragraph -->", $content );
     389        }
     390
    381391        $speaker_id = wp_insert_post(
    382392            array(
    383393                'post_type'    => 'wcb_speaker',
    384394                'post_title'   => $speaker['Name'],
    385                 'post_content' => $speaker['Your Bio'],
     395                'post_content' => $content,
    386396                'post_status'  => 'draft',
    387397                'post_author'  => $this->get_user_id_from_username( 'wordcamp' ),
     
    407417     */
    408418    protected function create_draft_session( $session, $speaker ) {
     419        $content = $session['Topic Description'] ?? '';
     420
     421        if ( $content ) {
     422            $content = wpautop( $content );
     423            $content = str_replace( '<p>', "<!-- wp:paragraph -->\n<p>", $content );
     424            $content = str_replace( '</p>', "</p>\n<!-- /wp:paragraph -->", $content );
     425        }
     426
    409427        $session_id = wp_insert_post(
    410428            array(
    411429                'post_type'    => 'wcb_session',
    412430                'post_title'   => $session['Topic Title'],
    413                 'post_content' => $session['Topic Description'],
     431                'post_content' => $content,
    414432                'post_status'  => 'draft',
    415433                'post_author'  => $this->get_user_id_from_username( $session['WordPress.org Username'] ),
Note: See TracChangeset for help on using the changeset viewer.