Deprecated old archive filters and add new ones

Using new filters is needed as the parameters passed to the filters
changed. If we continued using the same filters, users might run into
fatal errors.

[MAILPOET-3629]
This commit is contained in:
Rodrigo Primo
2021-09-15 10:50:25 -03:00
committed by Veljko V
parent 0c44e4dbd2
commit 2e354173db
2 changed files with 29 additions and 4 deletions

View File

@@ -67,12 +67,33 @@ class Shortcodes {
$this, 'getArchive',
]);
$this->wp->addFilter('mailpoet_archive_date', [
$this->wp->addFilter('mailpoet_archive_email_processed_date', [
$this, 'renderArchiveDate',
], 2);
$this->wp->addFilter('mailpoet_archive_subject', [
$this->wp->addFilter('mailpoet_archive_email_subject', [
$this, 'renderArchiveSubject',
], 2, 3);
// This deprecated notice can be removed after 2022-06-01
if ($this->wp->hasFilter('mailpoet_archive_date')) {
$this->wp->deprecatedHook(
'mailpoet_archive_date',
'3.69.2',
'mailpoet_archive_email_processed_date',
__('Please note that mailpoet_archive_date no longer runs and that the list of parameters of the new filter is different.', 'mailpoet')
);
}
// This deprecated notice can be removed after 2022-06-01
if ($this->wp->hasFilter('mailpoet_archive_subject')) {
$this->wp->deprecatedHook(
'mailpoet_archive_subject',
'3.69.2',
'mailpoet_archive_email_subject',
__('Please note that mailpoet_archive_subject no longer runs and that the list of parameters of the new filter is different.', 'mailpoet')
);
}
// initialize subscription pages data
$this->subscriptionPages->init();
// initialize subscription management shortcodes
@@ -145,10 +166,10 @@ class Shortcodes {
$html .= '<li>' .
'<span class="mailpoet_archive_date">' .
$this->wp->applyFilters('mailpoet_archive_date', $task) .
$this->wp->applyFilters('mailpoet_archive_email_processed_date', $task) .
'</span>
<span class="mailpoet_archive_subject">' .
$this->wp->applyFilters('mailpoet_archive_subject', $newsletter, $subscriber, $queue) .
$this->wp->applyFilters('mailpoet_archive_email_subject', $newsletter, $subscriber, $queue) .
'</span>
</li>';
}