LLMS_Order::get_recurring_payment_due_date_for_scheduler( string $next_payment_date = false, boolean $gmt = false )
Returns the recurring payment due date in a suitable format for the scheduler.
Parameters Parameters
- $next_payment_date
-
(string) (Optional) Next payment date. If not provided it'll be retrieved using
$this->get_next_payment_due_date().Default value: false
- $gmt
-
(boolean) (Optional) Whether the provided
$next_payment_datedate is gmt. Default isfalse.<br> Only applies when the$next_payment_dateis provided.Default value: false
Return Return
(WP_Error|integer)
Source Source
File: includes/models/model.llms.order.php
public function get_recurring_payment_due_date_for_scheduler( $next_payment_date = false, $gmt = false ) {
$date = false === $next_payment_date ? $this->get_next_payment_due_date() : $next_payment_date;
if ( ! $date ) {
return new WP_Error( 'invalid-recurring-payment-date', __( 'Next recurring payment due date is not valid', 'lifterlms' ) );
}
if ( is_wp_error( $date ) ) {
return $date;
}
// Convert our date to Unix time and UTC before passing to the scheduler.
// No date parameter passed, or passed date parameter was not in gmt.
if ( ! $next_payment_date || ( $next_payment_date && ! $gmt ) ) {
$date = get_gmt_from_date( $date, 'U' );
} else {
// Get timestamp.
$date = date_format( date_create( $date ), 'U' );
}
return (int) $date;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 5.2.0 | Introduced. |