LLMS_Order::get_next_payment_due_date( string $format = 'Y-m-d H:i:s' )
Retrieve the due date of the next payment according to access plan terms
Parameters Parameters
- $format
-
(string) (Optional) Date return format. Default is 'Y-m-d H:i:s'.
Default value: 'Y-m-d H:i:s'
Return Return
(string)
Source Source
File: includes/models/model.llms.order.php
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | * @ return string */ public function get_next_payment_due_date( $format = 'Y-m-d H:i:s' ) { // Single payments will never have a next payment date. if ( ! $this ->is_recurring() ) { return new WP_Error( 'not-recurring' , __( 'Order is not recurring' , 'lifterlms' ) ); } elseif ( ! in_array( $this ->get( 'status' ), array ( 'llms-active' , 'llms-failed' , 'llms-on-hold' , 'llms-pending' , 'llms-pending-cancel' ), true ) ) { return new WP_Error( 'invalid-status' , __( 'Invalid order status' , 'lifterlms' ), $this ->get( 'status' ) ); } // Retrieve the saved due date. $next_payment_time = $this ->get_date( 'date_next_payment' , 'U' ); // Calculate it if not saved. if ( ! $next_payment_time ) { $next_payment_time = $this ->calculate_next_payment_date( 'U' ); if ( ! $next_payment_time ) { return new WP_Error( 'plan-ended' , __( 'No more payments due' , 'lifterlms' ) ); } } /** * Filter the next payment due date. * * A timestamp should always be returned as the conversion to the requested format * will be performed on the returned value. * * @since 3.0.0 * * @param int $next_payment_time Unix timestamp for the next payment due date. * @param LLMS_Order $order Order object. * @param string $format Requested date format. */ $next_payment_time = apply_filters( 'llms_order_get_next_payment_due_date' , $next_payment_time , $this , $format ); return date_i18n( $format , $next_payment_time ); |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.2.0 | Use stric type comparisons. |
3.19.0 | Unknown. |
3.0.0 | Introduced. |