LLMS_Controller_Orders::__construct()
Constructor.
Contents
Return Return
(void)
Source Source
File: includes/controllers/class.llms.controller.orders.php
public function __construct() {
add_filter( 'wp_untrash_post_status', array( $this, 'set_untrash_status' ), 10, 3 );
// This action adds our lifterlms specific actions when order & transaction statuses change.
add_action( 'transition_post_status', array( $this, 'transition_status' ), 10, 3 );
// This action adds lifterlms specific action when an order is deleted, just before the WP post postmetas are removed.
add_action( 'before_delete_post', array( $this, 'on_delete_order' ) );
// This action is meant to do specific actions on orders when an enrollment, with an order as trigger, is deleted.
add_action( 'llms_user_enrollment_deleted', array( $this, 'on_user_enrollment_deleted' ), 10, 3 );
// Transaction status changes cascade up to the order to change the order status.
add_action( 'lifterlms_transaction_status_failed', array( $this, 'transaction_failed' ), 10, 1 );
add_action( 'lifterlms_transaction_status_refunded', array( $this, 'transaction_refunded' ), 10, 1 );
add_action( 'lifterlms_transaction_status_succeeded', array( $this, 'transaction_succeeded' ), 10, 1 );
// Status changes for orders to enroll students and trigger completion actions.
add_action( 'lifterlms_order_status_completed', array( $this, 'complete_order' ), 10, 2 );
add_action( 'lifterlms_order_status_active', array( $this, 'complete_order' ), 10, 2 );
// Status changes to pending cancel.
add_action( 'lifterlms_order_status_pending-cancel', array( $this, 'pending_cancel_order' ), 10, 1 );
// Status changes for orders to unenroll students upon purchase.
add_action( 'lifterlms_order_status_refunded', array( $this, 'error_order' ), 10, 1 );
add_action( 'lifterlms_order_status_cancelled', array( $this, 'error_order' ), 10, 1 );
add_action( 'lifterlms_order_status_expired', array( $this, 'error_order' ), 10, 1 );
add_action( 'lifterlms_order_status_failed', array( $this, 'error_order' ), 10, 1 );
add_action( 'lifterlms_order_status_on-hold', array( $this, 'error_order' ), 10, 1 );
add_action( 'lifterlms_order_status_trash', array( $this, 'error_order' ), 10, 1 );
// Detect a product deletion while processing a recurring charge.
add_action( 'llms_order_recurring_charge_aborted_product_deleted', array( $this, 'error_order' ), 10, 1 );
/**
* Scheduler Actions
*/
// Charge recurring payments.
add_action( 'llms_charge_recurring_payment', array( $this, 'recurring_charge' ), 10, 1 );
// Expire access plans.
add_action( 'llms_access_plan_expiration', array( $this, 'expire_access' ), 10, 1 );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.0.0 | Added callback for wp_untrash_post_status filter. Remove action callbacks for order confirm, create, and payment source switch in favor of hooks in LLMS_Controller_Checkout. |
| 5.4.0 | Perform error_order() when Detect a product deletion while processing a recurring charge. |
| 4.2.0 | Added llms_user_enrollment_deleted action to handle order status change on enrollment deletion. |
| 3.33.0 | Added before_delete_post action to handle order deletion. |
| 3.19.0 | Updated. |
| 3.0.0 | Introduced. |