Skip to content

Commit

Permalink
Plugin: Change "facilitator" to "presenter" in code and UI
Browse files Browse the repository at this point in the history
Refs #15
  • Loading branch information
coreymckrill authored Aug 11, 2020
2 parents ae8debc + 3481c9d commit 04abbd7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
26 changes: 13 additions & 13 deletions wp-content/plugins/wporg-learn/inc/post-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function register_workshop_meta() {

register_post_meta(
$post_type,
'facilitator_wporg_username',
'presenter_wporg_username',
array(
'description' => __( 'The WordPress.org user name of a facilitator for this workshop.', 'wporg_learn' ),
'description' => __( 'The WordPress.org user name of a presenter for this workshop.', 'wporg_learn' ),
'type' => 'string',
'single' => false,
'sanitize_callback' => 'sanitize_user',
Expand Down Expand Up @@ -114,9 +114,9 @@ function add_workshop_metaboxes() {
);

add_meta_box(
'workshop-facilitators',
__( 'Facilitators', 'wporg_learn' ),
__NAMESPACE__ . '\render_metabox_workshop_facilitators',
'workshop-presenters',
__( 'Presenters', 'wporg_learn' ),
__NAMESPACE__ . '\render_metabox_workshop_presenters',
'wporg_workshop',
'side'
);
Expand All @@ -135,14 +135,14 @@ function render_metabox_workshop_details( WP_Post $post ) {
}

/**
* Render the Facilitators meta box.
* Render the Presenters meta box.
*
* @param WP_Post $post
*/
function render_metabox_workshop_facilitators( WP_Post $post ) {
$facilitators = get_post_meta( $post->ID, 'facilitator_wporg_username' ) ?: array();
function render_metabox_workshop_presenters( WP_Post $post ) {
$presenters = get_post_meta( $post->ID, 'presenter_wporg_username' ) ?: array();

require dirname( dirname( __FILE__ ) ) . '/views/metabox-workshop-facilitators.php';
require dirname( dirname( __FILE__ ) ) . '/views/metabox-workshop-presenters.php';
}

/**
Expand All @@ -162,11 +162,11 @@ function save_workshop_metabox_fields( $post_id, WP_Post $post ) {
update_post_meta( $post_id, 'duration', $duration );
}

$facilitator_wporg_username = filter_input( INPUT_POST, 'facilitator-wporg-username' );
$usernames = array_map( 'trim', explode( ',', $facilitator_wporg_username ) );
delete_post_meta( $post_id, 'facilitator_wporg_username' );
$presenter_wporg_username = filter_input( INPUT_POST, 'presenter-wporg-username' );
$usernames = array_map( 'trim', explode( ',', $presenter_wporg_username ) );
delete_post_meta( $post_id, 'presenter_wporg_username' );
foreach( $usernames as $username ) {
add_post_meta( $post_id, 'facilitator_wporg_username', $username );
add_post_meta( $post_id, 'presenter_wporg_username', $username );
}

$video_language = filter_input( INPUT_POST, 'video-language' );
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/** @var WP_Post $post */
/** @var array $presenters */
?>

<?php // todo Change this to a multiselect dropdown that validates wporg usernames. ?>
<p>
<label for="workshop-presenter-wporg-username"><?php _e( 'WordPress.org User Names', 'wporg_learn' ); ?></label>
<textarea id="workshop-presenter-wporg-username" name="presenter-wporg-username"><?php
echo sanitize_textarea_field( implode( ', ', $presenters ) );
?></textarea>
<span class="help">
<?php _e( 'Separate multiple presenter user names with a comma.', 'wporg_learn' ); ?>
</span>
</p>

0 comments on commit 04abbd7

Please sign in to comment.