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

Add LIMIT to the Recurring Email Reminder functionality. #3155

Open
andrewlimaza opened this issue Oct 4, 2024 · 1 comment
Open

Add LIMIT to the Recurring Email Reminder functionality. #3155

andrewlimaza opened this issue Oct 4, 2024 · 1 comment

Comments

@andrewlimaza
Copy link
Contributor

We should add in a SQL LIMIT clause that is filterable for the recurring email reminder logic (Around here -

$sqlQuery = $wpdb->prepare(
"SELECT subscription.*
FROM {$wpdb->pmpro_subscriptions} subscription
LEFT JOIN {$wpdb->pmpro_subscriptionmeta} last_next_payment_date
ON subscription.id = last_next_payment_date.pmpro_subscription_id
AND last_next_payment_date.meta_key = 'pmprorm_last_next_payment_date'
LEFT JOIN {$wpdb->pmpro_subscriptionmeta} last_days
ON subscription.id = last_days.pmpro_subscription_id
AND last_days.meta_key = 'pmprorm_last_days'
WHERE subscription.status = 'active'
AND subscription.next_payment_date >= %s
AND subscription.next_payment_date < %s
AND ( last_next_payment_date.meta_value IS NULL
OR last_next_payment_date.meta_value != subscription.next_payment_date
OR last_days.meta_value > %d
)",
date_i18n( 'Y-m-d', strtotime( "+{$previous_days} days", current_time( 'timestamp' ) ) ),
date_i18n( 'Y-m-d', strtotime( "+{$days} days", current_time( 'timestamp' ) ) ),
$days
);
).

This will allow developers more control over the number of emails to process per cron job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@andrewlimaza and others