Ticket #44500: 44500.diff
File 44500.diff, 2.0 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/user.php
771 771 $request_ids = $requests_query->posts; 772 772 773 773 foreach ( $request_ids as $request_id ) { 774 wp_update_post( array( 775 'ID' => $request_id, 776 'post_status' => 'request-failed', 777 'post_password' => '', 778 ) ); 774 wp_mark_user_request_failed( $request_id ); 779 775 } 780 776 } 781 777 -
src/wp-includes/user.php
3477 3477 /** 3478 3478 * Validate a user request by comparing the key with the request's key. 3479 3479 * 3480 * If determined that the request is expired, it will be transitioned to the `request-failed` status. 3481 * 3480 3482 * @since 4.9.6 3481 3483 * 3482 3484 * @param string $request_id ID of the request being confirmed. … … 3532 3534 } 3533 3535 3534 3536 if ( ! $expiration_time || time() > $expiration_time ) { 3537 wp_mark_user_request_failed( $request_id ); 3535 3538 return new WP_Error( 'expired_key', __( 'The confirmation email has expired.' ) ); 3536 3539 } 3537 3540 … … 3558 3561 } 3559 3562 3560 3563 /** 3564 * Marks a user_request post as failed. 3565 * 3566 * @param int $request_id User request ID. 3567 * @return int|WP_Error Post ID when updated successfully, WP_Error on failure. 3568 */ 3569 function wp_mark_user_request_failed( $request_id ) { 3570 $post = get_post( $request_id ); 3571 3572 if ( ! $post ) { 3573 return new WP_Error( 'invalid_request_id', __( 'Invalid request ID.' ) ); 3574 } elseif ('user_request' !== $post->post_type ) { 3575 return new WP_Error( 'invalid_post_type', __( 'The specified post is not a user_request post.' ) ); 3576 } 3577 3578 return wp_update_post( 3579 array( 3580 'ID' => $request_id, 3581 'post_status' => 'request-failed', 3582 'post_password' => '', 3583 ), 3584 true 3585 ); 3586 } 3587 3588 /** 3561 3589 * WP_User_Request class. 3562 3590 * 3563 3591 * Represents user request data loaded from a WP_Post object.