mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 02:01:18 +03:00
Pledge: Log the reason why a pledge was deactivated.
This commit is contained in:
parent
ac25f4c008
commit
d22f13f2c1
3 changed files with 24 additions and 4 deletions
|
@ -205,7 +205,7 @@ function handle_activation_action( $post_id ) {
|
|||
$sendback = remove_query_arg( array( 'deactivated', 'reactivated' ), $sendback );
|
||||
|
||||
if ( 'deactivate' === $action ) {
|
||||
deactivate( $post_id );
|
||||
deactivate( $post_id, false, 'Site admin deactivated via wp-admin list table.' );
|
||||
wp_redirect( add_query_arg( 'deactivated', 1, $sendback ) );
|
||||
exit();
|
||||
} else {
|
||||
|
@ -368,10 +368,11 @@ function create_new_pledge( $name ) {
|
|||
*
|
||||
* @param int $pledge_id The pledge to deactivate.
|
||||
* @param bool $notify Whether the pledge admin should be notified of the deactivation.
|
||||
* @param string $reason The reason why the pledge is being deactivated.
|
||||
*
|
||||
* @return int|WP_Error Post ID on success. Otherwise WP_Error.
|
||||
*/
|
||||
function deactivate( $pledge_id, $notify = false ) {
|
||||
function deactivate( $pledge_id, $notify = false, $reason = '' ) {
|
||||
$pledge = get_post( $pledge_id );
|
||||
$result = wp_update_post(
|
||||
array(
|
||||
|
@ -385,6 +386,8 @@ function deactivate( $pledge_id, $notify = false ) {
|
|||
Email\send_pledge_deactivation_email( $pledge );
|
||||
}
|
||||
|
||||
do_action( FiveForTheFuture\PREFIX . '_deactivated_pledge', $pledge_id, $notify, $reason, $result );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue