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.
Parameters Parameters
- $order_id
-
(int) (Required) WP_Post ID of the LLMS Order.
Return Return
(void)
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
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.19.0 | Unknown. |
| 3.0.0 | Introduced. |