edd-software-licensing
not recording _edd_sl_renewal_sent_{$period}
correctly after sending License Renewal Notice
#9756
Labels
type-bug
workflow-needs-replication
workflow-pending-triage
Items that need to be triaged and reviewed before they are worked on.
Bug Report
Expected behavior
When emails are sent by
EDD_SL_Emails->send_renewal_reminder()
via theedd_daily_scheduled_events
hook that triggersedd_sl_scheduled_reminders
, a license meta with the key_edd_sl_renewal_sent_{$period}
should be recorded to prevent sending new emails to the same user regarding the same notification.Actual behavior
Multiple emails are being sent because
$period
is not correctly retrieved, so the meta is stored with the key_edd_sl_renewal_sent_
, which doesn't prevent any email to be sent.Steps to reproduce the behavior
/wp-admin/edit.php?post_type=download&page=edd-emails
.Add New Email
>Add License Renewal Notice
.Save
.email
URL query parameter. The value should have the following formatlicense_abc12
.function.php
. These help identify the issue.wp edd-ad-hoc email test edd_sl_scheduled_reminders
will give you some detail on the License Renewal Notices you have, including the notice ID we got from the URL. Something like the following:wp edd-ad-hoc email test send_renewal_reminder --notice-id=license_abc12 --license-id=1
. This will compare the current implementation, which fails to append the period to the license meta in thewp_edd_licensemeta
table. Something like the following:Information (if a specific version is affected):
PHP Version: 6.6.1
EDD Version (or branch): 3.3.3
EDD Software Licensing Version: 3.8.14
WordPress Version: 6.6.1
My suggested fix
As visible in the
edd_ad_hoc_email_test_send_renewal_reminder()
function above, I suggest replacing the following line fromEDD_SL_Emails->send_renewal_reminder()
on line 96:Either with:
Or with:
To understand why use
$email->email->id
, see the__construct()
method of EDD\SoftwareLicensing\Emails\Types\Notices, which is the class registered toEDD\Emails\Registry
viaEDD\SoftwareLicensing\Emails\register_email_types()
, via theedd_email_registered_types
hook.The text was updated successfully, but these errors were encountered: