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.

Top ↑

Parameters Parameters


(string) (Required) Date field to set.


(string) (Required) Date string or a unix time stamp.

Top ↑

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':

			// 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.
				$this->maybe_schedule_payment( false );



Top ↑

Changelog Changelog

Version Description
3.19.0 Unknown.
3.10.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.