STATUS_PENDING
STATUS_PENDING
Membership Relationship Status constants.
Pending is the first status that means the member did not confirm his intention to complete his payment/registration.
NO ACCESS.
Subscription model (former "Membership Relationship").
The Subscription defines which user has access to which membership and for how long. Do not confuse this with an invoice - a single subscription can have multiple invoices!
Note that all properties are declared protected but they can be access
directly (e.g. $membership->type
to get the type value).
There are magic methods __get() and __set() that do some validation before
accessing the properties.
$payments : array
The number of successful payments that were made for this subscription.
We use this value to determine the end of a recurring payment plan. Also this information is displayed in the member-info popup (only for admins; see MS_View_Member_Dialog)
$payment_type : string
The payment type that this subscription was created with.
Since the user can change the payment_type of the membership any time we might end up with a subscription with an invalid expire date.
This flag allows us to detect changes in the parent membership payment options so we can update this membership accordingly.
$membership : \MS_Model_Membership
The related membership model object.
sort_by_priority(\MS_Model_Relationship $a, \MS_Model_Relationship $b) : integer
Sort function used as second param by `uasort()` to sort a subscription list by membership priority.
Memberships with equal priority are sorted alphabeically.
\MS_Model_Relationship | $a | |
\MS_Model_Relationship | $b |
-1: a < b | 0: a = b | +1: a > b
is_trial_eligible() : boolean
Verify if the member can use the trial period.
It returns FALSE if .. Trial Add-on is disabled .. The membership does not allow a trial period .. The current user already consumed trial period or is in trial period
True if trial eligible.
get_member() : \MS_Model_Member
Get Member model of the subscription owner.
The member object.
get_membership() : \MS_Model_Membership
Get related Membership model.
The membership model.
set_custom_data(string $key, mixed $value)
Either creates or updates the value of a custom data field.
Note: Remember to prefix the $key with a unique string to prevent conflicts with other plugins that also use this function.
string | $key | The field-key. |
mixed | $value | The new value to assign to the field. |
get_payment_description(\MS_Model_Invoice $invoice = null, boolean $short = false) : string
Get textual payment information description.
\MS_Model_Invoice | $invoice | Optional. Specific invoice that defines the price. Default is the price defined in the membership. |
boolean | $short | Optional. Default is false. If set to true then a hort sumary is returned |
The description.
add_payment(float $amount, string $gateway, string $external_id = '') : boolean
Saves information on a payment that was made.
This function also extends the expire_date for one period if the membership payment-type is recurring or limited
float | $amount | The payment amount. Set to 0 for free subscriptions. |
string | $gateway | The payment gateway-ID. |
string | $external_id | A string that can identify the payment. |
True if the subscription has ACTIVE status after payment. If the amount was 0 and membership uses a trial period the status could also be TRIAL, in which case the returnv alue is false.