From 49fd08e8bdde5d04ba00cbbc7cf08127d689985a Mon Sep 17 00:00:00 2001 From: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Date: Fri, 25 Oct 2019 12:25:12 -0700 Subject: [PATCH] Contributor: Add function for removing a contributor from a pledge --- plugins/wporg-5ftf/includes/contributor.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/wporg-5ftf/includes/contributor.php b/plugins/wporg-5ftf/includes/contributor.php index 2bb5099..0d387ac 100644 --- a/plugins/wporg-5ftf/includes/contributor.php +++ b/plugins/wporg-5ftf/includes/contributor.php @@ -134,6 +134,20 @@ function create_new_contributor( $wporg_username, $pledge_id ) { return wp_insert_post( $args, true ); } +/** + * Remove a contributor post from a pledge. + * + * This wrapper function ensures we have a standardized way of removing a contributor that will still + * transition a post status (see PledgeMeta\update_confirmed_contributor_count). + * + * @param int $contributor_post_id + * + * @return false|WP_Post|null + */ +function remove_contributor( $contributor_post_id ) { + return wp_trash_post( $contributor_post_id ); +} + /** * Get the contributor posts associated with a particular pledge post. *