Skip to content

Improved actions and filters for the EDD\Emails\Base class and the abstract Edd\Emails\Types\Email class #9780

@tobeyadr

Description

@tobeyadr

Enhancement Request

Explain your enhancement (please be detailed)

Expose $to, $subject, and $message before the email template for EDD notifications is "built." I think the ideal place to do this would be in the EDD\Emails\Base class within do_action( 'edd_email_send_before', $this ) possible by changing it to something like the following.

do_action_ref_array( 'edd_email_send_before', [ $this, &$to, &$subject, &$message, &$attachments ] );

This allows for modification, and potential enhancement of the email body or template.

Justification or use case

Each of the various implementations of the Edd\Emails\Types\Email class has a different way of specifying the recipient, and no filters or actions to modify or otherwise access the recipients before the email is sent, except through the standard wp_mail filters. Therefore it's impossible to determine the recipient of an EDD notification until after the email body has been generated.

For my specific use case, I wish to generate an email template with Groundhogg (my plugin) and use conditional logic to improve the experience of my EDD notifications. For example, adding a section of the message to thank long-term customers.

However, I cannot know the recipient of the email before generating the template as it is not exposed anywhere before the email body is generated. Thus, I can't generate a personalized template for the notification.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions