LLMS_Order::get_access_status()
Get the current status of a student’s access based on the access plan data stored on the order at the time of purchase
Description Description
Return Return
(string) 'inactive' if the order is refunded, failed, pending, etc... 'expired' if access has expired according to $this->get_access_expiration_date() 'active' otherwise
Source Source
File: includes/models/model.llms.order.php
public function get_access_status() { $statuses = apply_filters( 'llms_order_allow_access_stasuses', array( 'llms-active', 'llms-completed', 'llms-pending-cancel', // recurring orders can expire but still grant access // eg: 3monthly payments grants 1 year of access // on the 4th month the order will be marked as expired // but the access has not yet expired based on the data below 'llms-expired', ) ); // if the order doesn't have one of the allowed statuses // return 'inactive' and don't bother checking expiration data if ( ! in_array( $this->get( 'status' ), $statuses ) ) { return 'inactive'; } // get the expiration date as a timestamp $expires = $this->get_access_expiration_date( 'U' ); // a translated non-numeric string will be returned for lifetime access // so if we have a timestamp we should compare it against the current time // to determine if access has expired if ( is_numeric( $expires ) ) { $now = llms_current_time( 'timestamp' ); // expiration date is in the past // eg: the access has already expired if ( $expires < $now ) { return 'expired'; } } // we're active return 'active'; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: