Changeset 11275 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php
- Timestamp:
- 10/12/2021 10:22:24 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php
r11225 r11275 98 98 array( 99 99 'description' => __( 'The WordPress.org user name of a presenter for this workshop.', 'wporg_learn' ), 100 'type' => 'string', 101 'single' => false, 102 'sanitize_callback' => 'sanitize_user', 103 'show_in_rest' => true, 104 ) 105 ); 106 107 register_post_meta( 108 $post_type, 109 'other_contributor_wporg_username', 110 array( 111 'description' => __( 'The WordPress.org user name of "other contributor" for this workshop.', 'wporg_learn' ), 100 112 'type' => 'string', 101 113 'single' => false, … … 356 368 357 369 add_meta_box( 370 'workshop-other-contributors', 371 __( 'Other Contributors', 'wporg_learn' ), 372 __NAMESPACE__ . '\render_metabox_workshop_other_contributors', 373 'wporg_workshop', 374 'side' 375 ); 376 377 add_meta_box( 358 378 'workshop-application', 359 379 __( 'Original Application', 'wporg_learn' ), … … 396 416 397 417 /** 418 * Render the Other Contributors meta box. 419 * 420 * @param WP_Post $post 421 */ 422 function render_metabox_workshop_other_contributors( WP_Post $post ) { 423 $other_contributors = get_post_meta( $post->ID, 'other_contributor_wporg_username' ) ?: array(); 424 425 require get_views_path() . 'metabox-workshop-other-contributors.php'; 426 } 427 428 /** 398 429 * Render the Original Application meta box. 399 430 * … … 450 481 451 482 $presenter_wporg_username = filter_input( INPUT_POST, 'presenter-wporg-username' ); 452 $ usernames= array_map( 'trim', explode( ',', $presenter_wporg_username ) );483 $presenter_usernames = array_map( 'trim', explode( ',', $presenter_wporg_username ) ); 453 484 delete_post_meta( $post_id, 'presenter_wporg_username' ); 454 if ( is_array( $ usernames ) ) {455 foreach ( $ usernames as $username ) {485 if ( is_array( $presenter_usernames ) ) { 486 foreach ( $presenter_usernames as $username ) { 456 487 add_post_meta( $post_id, 'presenter_wporg_username', $username ); 488 } 489 } 490 491 $other_contributor_wporg_username = filter_input( INPUT_POST, 'other-contributor-wporg-username' ); 492 $other_contributor_usernames = array_map( 'trim', explode( ',', $other_contributor_wporg_username ) ); 493 delete_post_meta( $post_id, 'other_contributor_wporg_username' ); 494 if ( is_array( $other_contributor_usernames ) ) { 495 foreach ( $other_contributor_usernames as $username ) { 496 add_post_meta( $post_id, 'other_contributor_wporg_username', $username ); 457 497 } 458 498 }
Note: See TracChangeset
for help on using the changeset viewer.