LLMS_Notification_Controller_Upcoming_Payment_Reminder::schedule_upcoming_payment_reminder( LLMS_Order $order, string $type, int $payment_date )

Schedule upcoming payment reminder notification


Parameters Parameters

$order

(LLMS_Order) (Required) Instance of the LLMS_Order which we'll schedule the payment reminder for.

$type

(string) (Required) The notification type identifier.

$payment_date

(int) (Optional) The upcoming payment due date in Unix time format and UTC. Default is 0. When not provided it'll be calculated from the order.


Top ↑

Return Return

(WP_Error|int) WP_Error either if there's no reminder date or if it's passed. Otherwise returns the return value of as_schedule_single_action: the action's ID.


Top ↑

Source Source

File: includes/notifications/controllers/class.llms.notification.controller.upcoming.payment.reminder.php

	public function schedule_upcoming_payment_reminder( $order, $type, $payment_date = 0 ) {

		$action_args = $this->get_recurring_payment_reminder_action_args( $order, $type );

		// Unschedule upcoming payment reminder (does nothing if no action scheduled).
		$this->unschedule_upcoming_payment_reminder( $order, $type );

		// Convert our reminder date to Unix Time and UTC before passing to the scheduler.
		$reminder_date = $this->get_upcoming_payment_reminder_date( $order, $type, $payment_date );

		// If no reminder date.
		if ( is_wp_error( $reminder_date ) ) {
			return $reminder_date;
		}

		// Or reminder date set in the past.
		if ( $reminder_date < llms_current_time( 'U', true ) ) {
			return new WP_Error( 'upcoming-payment-reminder-passed', __( 'Upcoming payment reminder passed', 'lifterlms' ) );
		}

		// Schedule upcoming payment reminder.
		return as_schedule_single_action(
			$reminder_date,
			'llms_send_upcoming_payment_reminder_notification',
			$action_args
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.