mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-05 02:15:45 +03:00
Pledge: Count number of confirmed contributors instead of using arbitrary number input (#52)
This will be more accurate and avoid confusion that could arise if the self-reported "Number of Employees Being Sponsored" didn't match the number of confirmed contributors listed on the pledge. Having that counted number stored in post meta is still useful, though, so this also adds/updates that number for a pledge whenever a Contributor post changes its status. Fixes #48
This commit is contained in:
parent
553247cbf7
commit
838a490776
3 changed files with 60 additions and 30 deletions
|
@ -139,6 +139,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.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue