LLMS_Order::set_date( string $date_key, string $date_val )
Date field setter for date fields that require things to be updated when their value changes
Description Description
This is mainly used to allow updating dates which are editable from the admin panel which should trigger additional actions when updated.
Settable dates: date_next_payment, date_trial_end, date_access_expires.
Parameters Parameters
- $date_key
-
(string) (Required) Date field to set.
- $date_val
-
(string) (Required) Date string or a unix time stamp.
Source Source
File: includes/models/model.llms.order.php
public function set_date( $date_key, $date_val ) { // Convert to timestamp if not already a timestamp. if ( ! is_numeric( $date_val ) ) { $date_val = strtotime( $date_val ); } $this->set( 'date_' . $date_key, date( 'Y-m-d H:i:s', $date_val ) ); switch ( $date_key ) { // Reschedule access expiration. case 'access_expires': $this->maybe_schedule_expiration(); break; // Additionally update the next payment date & don't break because we want to reschedule payments too. case 'trial_end': $this->set_date( 'next_payment', $this->calculate_next_payment_date( 'U' ) ); // Everything else reschedule's payments. default: $this->maybe_schedule_payment( false ); } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.19.0 | Unknown. |
3.10.0 | Introduced. |