Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Emails for recurring donations] Custom the default messages #6074

Open
Genevieve-K opened this issue Nov 3, 2021 · 0 comments
Open

[Emails for recurring donations] Custom the default messages #6074

Genevieve-K opened this issue Nov 3, 2021 · 0 comments
Assignees
Labels
keep-fresh "Keep Fresh" issues should not be marked as stale. type: enhancement An improvement to existing user-facing functionality

Comments

@Genevieve-K
Copy link
Contributor

Genevieve-K commented Nov 3, 2021

User Story

As a developper, I want to customize the default emails for a recurring donation, especially when a subscription is cancelled.

Details

In give-recurring/includes/admin/emails, files class-subscription-cancelled-email.php , class-subscription-cancelled-admin-email.php and class-subscription-completed-email.php.

In the Give_Subscription_Cancelled_Email, Give_Subscription_Completed_Email, Give_Subscription_Cancelled_Admin_Email classes, the default email message does not have a hook.
There is a hook to display the message:
return apply_filters( "give_{$this->config['id']}_get_email_message", $message, $this );
But this hook has no impact on the email displayed in the settings. It has an impact on the preview email which will therefore be different and the sent email. If this email is configured in the settings, it will be overwritten by this hook.

Suggested solution

Do the same as in GiveWP : add a get_default_message() function with a hook, and maybe remove that existing hook.

I solved the problem with two hooks:

function give_cart_email_subscription_cancelled( $message ) {

	$options = give_get_settings();
	if ( ! isset( $options[ 'subscription_cancelled_message' ] ) ) {

		return give_cart_default_subscription_cancelled( $message );
	}
	return $message;
}
add_filter( 'give_subscription-cancelled_get_default_email_message', 'give_cart_email_subscription_cancelled');
add_filter( 'give_subscription-cancelled_get_email_message', 'give_cart_email_subscription_cancelled');
@Genevieve-K Genevieve-K added the type: enhancement An improvement to existing user-facing functionality label Nov 3, 2021
@kjohnson kjohnson added the keep-fresh "Keep Fresh" issues should not be marked as stale. label Oct 17, 2022
@kjohnson kjohnson self-assigned this May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep-fresh "Keep Fresh" issues should not be marked as stale. type: enhancement An improvement to existing user-facing functionality
Projects
None yet
Development

No branches or pull requests

2 participants