From 4ce08c3f8713c4bb799cccd4aab27a95b977a1fc Mon Sep 17 00:00:00 2001 From: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Date: Mon, 21 Oct 2019 15:31:06 -0700 Subject: [PATCH] Remove unnecessary meta config and prefixes The meta config introduced in 2927532 are unnecessary because the contributors associated with a pledge are not stored as post meta data, but rather as posts of a separate post type. The added `org-` prefixes are also unnecessary because there is already a `5ftf` prefix for all the fields. The `org-` is used for some fields where the data is a property of the organization making the pledge (org-name, org-email). Contributors are not really a property of the organization. --- plugins/wporg-5ftf/includes/pledge-form.php | 4 ++-- plugins/wporg-5ftf/includes/pledge-meta.php | 6 ------ plugins/wporg-5ftf/views/inputs-pledge-contributors.php | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/plugins/wporg-5ftf/includes/pledge-form.php b/plugins/wporg-5ftf/includes/pledge-form.php index a36840f..76275d3 100755 --- a/plugins/wporg-5ftf/includes/pledge-form.php +++ b/plugins/wporg-5ftf/includes/pledge-form.php @@ -82,7 +82,7 @@ function process_form_new() { ); } - $contributors = parse_contributors( $submission['org-pledge-contributors'] ); + $contributors = parse_contributors( $submission['pledge-contributors'] ); if ( is_wp_error( $contributors ) ) { return $contributors; @@ -189,7 +189,7 @@ function get_form_submission() { wp_list_pluck( PledgeMeta\get_pledge_meta_config( 'user_input' ), 'php_filter' ), // Inputs with no corresponding meta value. array( - 'org-pledge-contributors' => FILTER_SANITIZE_STRING, + 'pledge-contributors' => FILTER_SANITIZE_STRING, 'pledge-agreement' => FILTER_VALIDATE_BOOLEAN, ) ); diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php index 9cf24ef..3f4f371 100755 --- a/plugins/wporg-5ftf/includes/pledge-meta.php +++ b/plugins/wporg-5ftf/includes/pledge-meta.php @@ -61,12 +61,6 @@ function get_pledge_meta_config( $context = '' ) { 'show_in_rest' => false, 'php_filter' => FILTER_VALIDATE_INT, ), - 'org-pledge-contributors' => array( - 'single' => true, - 'sanitize_callback' => 'sanitize_text_field', - 'show_in_rest' => false, - 'php_filter' => FILTER_SANITIZE_STRING, - ), ); $generated = array( diff --git a/plugins/wporg-5ftf/views/inputs-pledge-contributors.php b/plugins/wporg-5ftf/views/inputs-pledge-contributors.php index c98d34a..dfc2f6f 100644 --- a/plugins/wporg-5ftf/views/inputs-pledge-contributors.php +++ b/plugins/wporg-5ftf/views/inputs-pledge-contributors.php @@ -15,8 +15,8 @@ namespace WordPressDotOrg\FiveForTheFuture\View;