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 This is mainly used to allow updating dates which are editable from the admin panel which should trigger additional actions when updated
Description Description
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.10.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: