Constants

BRIGHT_WOOCOMMERCE_MY_PURCHASED_COURSES_PAGE_ID

BRIGHT_WOOCOMMERCE_MY_PURCHASED_COURSES_PAGE_ID

BRIGHT_WOOCOMMERCE_LICENSE_KEY_REPORT_PAGE_ID

BRIGHT_WOOCOMMERCE_LICENSE_KEY_REPORT_PAGE_ID

BRIGHT_WOOCOMMERCE_REDEEM_LICENSE_KEY_PAGE_ID

BRIGHT_WOOCOMMERCE_REDEEM_LICENSE_KEY_PAGE_ID

Methods

getLicenseEmailText()

getLicenseEmailText() : Array

Default text for email and or message about how to access courseware on a simple/B2C order.

Returns

Array —

of page ids created [or existing]

doProfileChange()

doProfileChange(null  $null, integer  $object_id, string  $meta_key, mixed  $meta_value, mixed  $prev_value) : Boolean

This callback is attached to the WordPress update_user_metadata filter.

For more information see the wordpress documentation on the filter. [https://codex.wordpress.org/Plugin_API/Filter_Reference/update_(meta_type)_metadata]. Note this filter must return NULL for the save to happen correctly.

Parameters

null $null

Dummy value of no use.

integer $object_id

ID of the object metadata is for

string $meta_key

Metadata key

mixed $meta_value

Metadata value. Must be serializable if non-scalar.

mixed $prev_value

Optional. If specified, only update existing metadata entries with the specified value. Otherwise, update all entries.

Returns

Boolean

isBrightProduct()

isBrightProduct(\WC_Product  $product) : Boolean

Returns true if product has associated linked Bright product ids. It also checks for bright_metadata.

Parameters

\WC_Product $product

Returns

Boolean

doesCartIncludeBrightCourses()

doesCartIncludeBrightCourses() : Boolean

Returns true if cart includes Bright courses: 1. the item quantity is greater than 1.

  1. a bright course id is present

Returns

Boolean

addLicenseForUser()

addLicenseForUser(  $user_id,   $licenses = null) 

Parameters

$user_id
$licenses

getBrightLicenseId()

getBrightLicenseId(  $wc_order) 

Parameters

$wc_order

setBrightLicenseId()

setBrightLicenseId(  $wc_order,   $license_id) : boolean

Sets the 'bright_license_id' field for the order

Parameters

$wc_order
$license_id

Returns

boolean —

returns true if successful, null or false if not.

isLicenseOrder()

isLicenseOrder(  $wc_order) : boolean

Parameters

$wc_order

Returns

boolean —

True if isLicenseOrder

isSelfRedeemedOrder()

isSelfRedeemedOrder(  $wc_order) : boolean

Parameters

$wc_order

Returns

boolean —

True if the purchaser wants to be redeemed on the license order.

getProductVariationFromAttributes()

getProductVariationFromAttributes(  $product) 

Takes a Woocommerce product, and returns the field name of the variations field, if present.

Parameters

$product

getSelectedVariationForItem()

getSelectedVariationForItem(  $product,   $item) : String

If a variation is selected on the item, then return the value selected by the buyer for the variation.

Parameters

$product
$item

Returns

String —

the selected variation

getAutocompleteOrderDefault()

getAutocompleteOrderDefault() : boolean

Returns

boolean —

returns the default configuration, whether bright products should autocomplete the order.

getAutocompleteForOrderItem()

getAutocompleteForOrderItem(\WC_Product  $product) : boolean

Parameters

\WC_Product $product

Returns

boolean —

true if the product is eligible for autocomplete

getBrightProductMetadata()

getBrightProductMetadata(\WC_Product  $product,   $assoc = false) 

Parameters

\WC_Product $product
$assoc

getBrightCourseIds()

getBrightCourseIds(  $args) : Array

Based on the product setup, it can fetch the required bright course IDS for a product.

Parameters

$args

Returns

Array —

a list of the bright course ids associated with this product.

debug_order()

debug_order(  $wc_order) 

Parameters

$wc_order

determineQuantity()

determineQuantity(integer  $item_quantity, string  $bright_course_id, Array  $bright_metadata) : integer

Returns an integer representing the quantity of the bright course to be purchased.

This can be a function of the item quantity and/or bright metadata See also http://help.aura-software.com/defining-bright-metadata-for-a-product/

Parameters

integer $item_quantity
string $bright_course_id
Array $bright_metadata

Returns

integer

assignLicenseData()

assignLicenseData(  $licenseData,   $courseGuid,   $key,   $value) 

Parameters

$licenseData
$courseGuid
$key
$value

manageLicenseOrder()

manageLicenseOrder(\WC_Order  $wc_order) : void

When bright_license is set to 1 in the order metadata, instead of generating registrations, we generate a licens key.

Parameters

\WC_Order $wc_order

addOrderMetaBoxActions()

addOrderMetaBoxActions(  $actions) 

This callback is used to add a custom order action to the order status page.

Specifically we add a 'manage order via bright ' action.

Parameters

$actions

processAutoComplete()

processAutoComplete(  $order) 

Parameters

$order

manageOrder()

manageOrder(  $order_id,   $statusChangeCallback = true) 

Parameters

$order_id
$statusChangeCallback

addOrderNote()

addOrderNote(  $order,   $string) 

Adds an order note to the order.

Parameters

$order
$string

manageOrderCallback()

manageOrderCallback(  $order) 

Parameters

$order

set_coupons_used_in_usermeta_for_user()

set_coupons_used_in_usermeta_for_user(  $user) 

Parameters

$user

set_coupons_used_in_usermeta()

set_coupons_used_in_usermeta() 

set_coupons_used_for_allusers()

set_coupons_used_for_allusers() 

remove_all_fields_not_required_for_elearning()

remove_all_fields_not_required_for_elearning(  $fields) 

Parameters

$fields

addOrderDetails()

addOrderDetails(  $order) 

Parameters

$order