LLMS_Controller_Orders::expire_access( int $order_id )

Handle expiration & cancellation from a course / membership.


Description Description

Called via scheduled action set during order completion for plans with a limited access plan. Additionally called when an order is marked as "pending-cancel" to revoke access at the end of a pre-paid period.


Top ↑

Parameters Parameters

$order_id

(int) (Required) WP_Post ID of the LLMS Order.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/controllers/class.llms.controller.orders.php

	 */
	public function expire_access( $order_id ) {

		$order            = new LLMS_Order( $order_id );
		$new_order_status = false;

		// Pending cancel order moves to cancelled.
		if ( 'llms-pending-cancel' === $order->get( 'status' ) ) {

			$status           = 'cancelled'; // Enrollment status.
			$note             = __( 'Student unenrolled at the end of access period due to subscription cancellation.', 'lifterlms' );
			$new_order_status = 'cancelled';

			// All others move to expired.
		} else {

			$status = 'expired'; // Enrollment status.
			$note   = __( 'Student unenrolled due to automatic access plan expiration', 'lifterlms' );

		}

		/**
		 * Filters whether or not recurring payments should be stopped on access plan expiration.
		 *
		 * By default when an access plan expires, recurring payments are stopped.
		 *
		 * @since 7.5.0
		 *
		 * @param bool


Top ↑

Changelog Changelog

Changelog
Version Description
3.19.0 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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