PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
← All changes | includes/ajax-functions.php +21 -58 4.16.04.16.9 View file →
@@ -671,8 +671,9 @@
671 671
672 672 /**
673 673 * Send Confirmation Email For Complete Donation History Access.
674 674 *
675 + * @since 4.16.1 Always return a uniform success response regardless of donor existence or throttle state.
675 676 * @since 1.8.17
676 677 *
677 678 * @return bool
678 679 */
@@ -688,69 +689,31 @@
688 689 return false;
689 690 }
690 691
691 692 $donor = Give()->donors->get_donor_by( 'email', give_clean( $_POST['email'] ) );
692 - if ( Give()->email_access->can_send_email( $donor->id ) ) {
693 - $return = [];
694 - $email_sent = Give()->email_access->send_email( $donor->id, $donor->email );
693 + if ( is_object( $donor ) && Give()->email_access->can_send_email( $donor->id ) ) {
694 + Give()->email_access->send_email( $donor->id, $donor->email );
695 + }
695 696
696 - $return['status'] = 'success';
697 + $return = [];
698 + $return['status'] = 'success';
697 699
698 - if ( ! $email_sent ) {
699 - $return['status'] = 'error';
700 - $return['message'] = Give_Notices::print_frontend_notice(
701 - __( 'Unable to send email. Please try again.', 'give' ),
702 - false,
703 - 'error'
704 - );
705 - }
700 + /**
701 + * Filter to modify access mail send notice
702 + *
703 + * @since 2.1.3
704 + *
705 + * @param string Send notice message for email access.
706 + *
707 + * @return string $message Send notice message for email access.
708 + */
709 + $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
706 710
707 - /**
708 - * Filter to modify access mail send notice
709 - *
710 - * @since 2.1.3
711 - *
712 - * @param string Send notice message for email access.
713 - *
714 - * @return string $message Send notice message for email access.
715 - */
716 - $message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
717 -
718 - $return['message'] = Give_Notices::print_frontend_notice(
719 - $message,
720 - false,
721 - 'success'
722 - );
723 -
724 - } else {
725 - $value = Give()->email_access->verify_throttle / 60;
726 - $return['status'] = 'error';
727 -
728 - /**
729 - * Filter to modify email access exceed notices message.
730 - *
731 - * @since 2.1.3
732 - *
733 - * @param string $message email access exceed notices message
734 - * @param int $value email access exceed times
735 - *
736 - * @return string $message email access exceed notices message
737 - */
738 - $message = (string) apply_filters(
739 - 'give_email_access_requests_exceed_notice',
740 - sprintf(
741 - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ),
742 - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value )
743 - ),
744 - $value
745 - );
746 -
747 - $return['message'] = Give_Notices::print_frontend_notice(
748 - $message,
749 - false,
750 - 'error'
751 - );
752 - }
711 + $return['message'] = Give_Notices::print_frontend_notice(
712 + $message,
713 + false,
714 + 'success'
715 + );
753 716
754 717 echo json_encode( $return );
755 718 give_die();
756 719 }