Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Notification_Controller_Upcoming_Payment_Reminder::get_upcoming_payment_reminder_date( LLMS_Order $order, string $type, integer $payment_date )

Retrieve the date to remind user before actual payment


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

(integer) (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|integer) Returns a WP_Error if there's no payment scheduled, otherwise the reminder date in Unix format and UTC.


Top ↑

Source Source

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

	private function get_upcoming_payment_reminder_date( $order, $type, $payment_date = 0 ) {

		$next_payment_date = $payment_date ? $payment_date : $order->get_recurring_payment_due_date_for_scheduler();
		if ( is_wp_error( $next_payment_date ) ) {
			return $next_payment_date;
		}

		/**
		 * Filters the number of days before the upcoming payment due date when to notify the customer
		 *
		 * The dynamic portion of this filter, `$this->id`, refers to the notification trigger identifier.
		 *
		 * @since 5.2.0
		 *
		 * @param integer    $days  The number of days before the upcoming payment due date when to notify the customer.
		 * @param LLMS_Order $order Order object.
		 * @param string     $type  The notification type identifier.
		 */
		$days = apply_filters( "llms_notification_{$this->id}_reminder_days", $this->get_reminder_days( $type ), $order, $type );

		// Sanitize: makes sure it's always a negative number.
		$days = -1 * max( 1, absint( $days ) );

		/**
		 * Filters the next upcoming payment reminder date
		 *
		 * The dynamic portion of this filter, `$this->id`, refers to the notification trigger identifier.
		 *
		 * @since 5.2.0
		 *
		 * @param integer    $upcoming_payment_reminder_time Unix timestamp for the next payment due date.
		 * @param LLMS_Order $order                          Order object.
		 * @param string     $type                           The notification type identifier.
		 */
		$upcoming_payment_reminder_time = apply_filters( "llms_notification_{$this->id}_reminder_date", strtotime( "{$days} day", $next_payment_date ), $order, $type );

		return $upcoming_payment_reminder_time;

	}


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.