Skip to content

Commit c247333

Browse files
authored
Merge pull request #3059 from gocodebox/dev
Release 9.1.2
2 parents 4ddee28 + ae43eba commit c247333

File tree

13 files changed

+82
-50
lines changed

13 files changed

+82
-50
lines changed

.wordpress-org/readme/05-description.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ Increase your LMS website and it's training program's value with these add-ons:
236236
+ [LifterLMS Advanced Coupons](https://lifterlms.com/product/lifterlms-advanced-coupons/?utm_source=LifterLMS%20Plugin&utm_medium=README&utm_campaign=Readme%20to%20Sale)
237237
+ [LifterLMS Notes](https://lifterlms.com/product/lifterlms-notes/?utm_source=LifterLMS%20Plugin&utm_medium=README&utm_campaign=Readme%20to%20Sale)
238238
+ [LifterLMS Continuing Education](https://lifterlms.com/product/lifterlms-continuing-education/?utm_source=LifterLMS%20Plugin&utm_medium=README&utm_campaign=Readme%20to%20Sale)
239+
+ [LifterLMS Gifts](https://lifterlms.com/product/lifterlms-gifts/?utm_source=LifterLMS%20Plugin&utm_medium=README&utm_campaign=Readme%20to%20Sale)
239240

240241
**Integrations**
241242

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
LifterLMS Changelog
22
===================
33

4+
v9.1.2 - 2025-11-20
5+
-------------------
6+
7+
##### Updates and Enhancements
8+
9+
+ Changed options for a new Access Plan to include gifts, and removing the Free Trial option.
10+
11+
##### Bug Fixes
12+
13+
+ Avoid warning when creating the first access plan on a course/membership. [#3046](https://github.com/gocodebox/lifterlms/issues/3046)
14+
15+
##### Developer Notes
16+
17+
+ Filters for displaying already enrolled message during checkout.
18+
+ Filter to avoid sending a Purchase Receipt under certain conditions.
19+
+ Filter to prevent automatic enrollment in a product after purchase completed.
20+
21+
422
v9.1.1 - 2025-11-11
523
-------------------
624

class-lifterlms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class LifterLMS {
3434
*
3535
* @var string
3636
*/
37-
public $version = '9.1.1';
37+
public $version = '9.1.2';
3838

3939
/**
4040
* LLMS_Assets instance

includes/admin/views/access-plans/access-plan-dialog.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ class="llms-dialog-container"
3838
<strong><?php echo esc_html( __( 'Paid Trial', 'lifterlms' ) ); ?></strong>
3939
<span><?php echo esc_html( __( 'Charge a fee for trial access and capture recurring payment info with a future monthly subscription that will start in 1 week.', 'lifterlms' ) ); ?></span>
4040
</button>
41-
<button class="template" data-template="free-trial">
42-
<strong><?php echo esc_html( __( 'Free Trial', 'lifterlms' ) ); ?></strong>
43-
<span><?php echo esc_html( __( 'Grant free access for 1 week with a future monthly subscription that will start in 1 week.', 'lifterlms' ) ); ?></span>
44-
</button>
4541
<button class="template" data-template="hidden-access">
4642
<strong><?php echo esc_html( __( 'Hidden Access', 'lifterlms' ) ); ?></strong>
4743
<span><?php echo esc_html( __( 'Grant free access without making this plan publicly available.', 'lifterlms' ) ); ?></span>
@@ -62,6 +58,13 @@ class="llms-dialog-container"
6258
*/
6359
do_action( 'llms_access_plan_dialog_after_pre_sale' );
6460
?>
61+
<?php if ( apply_filters( 'llms_access_plan_dialog_show_gifts_addon_option', true ) ) : ?>
62+
<a target="_blank" href="https://lifterlms.com/product/lifterlms-gifts/?utm_source=LifterLMS%20Plugin&utm_medium=Access%20Plans&utm_campaign=Plugin%20to%20Sale">
63+
<span class="add-on"><?php echo esc_html( __( 'Add-on', 'lifterlms' ) ); ?></span>
64+
<strong><?php echo esc_html( __( 'Gift Purchases', 'lifterlms' ) ); ?></strong>
65+
<span><?php echo esc_html( __( 'Allow a buyer to purchase a voucher to gift access to someone else.', 'lifterlms' ) ); ?></span>
66+
</a>
67+
<?php endif; ?>
6568
<?php if ( apply_filters( 'llms_access_plan_dialog_show_group_addon_option', true ) ) : ?>
6669
<a target="_blank" href="https://lifterlms.com/product/groups/?utm_source=LifterLMS%20Plugin&utm_medium=Access%20Plans&utm_campaign=Plugin%20to%20Sale">
6770
<span class="add-on"><?php echo esc_html( __( 'Add-on', 'lifterlms' ) ); ?></span>

includes/admin/views/access-plans/access-plan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<h4><?php esc_html_e( 'General Plan Information', 'lifterlms' ); ?></h4>
9797

9898
<?php
99-
if ( ! $checkout_url ) :
99+
if ( $plan && ! $checkout_url ) :
100100
?>
101101

102102
<div>

includes/controllers/class.llms.controller.orders.php

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public function __construct() {
8282

8383
// Expire access plans.
8484
add_action( 'llms_access_plan_expiration', array( $this, 'expire_access' ), 10, 1 );
85-
8685
}
8786

8887
/**
@@ -122,8 +121,17 @@ public function complete_order( $order, $old_status ) {
122121
*/
123122
do_action( 'lifterlms_order_complete', $order_id ); // @todo used by AffiliateWP only, can remove after updating AffiliateWP.
124123

125-
// Enroll student.
126-
llms_enroll_student( $user_id, $product_id, 'order_' . $order_id );
124+
/**
125+
* Filter whether the user should be automatically enrolled when the order completes.
126+
*
127+
* @since 9.1.2
128+
*
129+
* @param bool Whether to enroll the student. Defaults to true.
130+
* @param LLMS_Order $order The order.
131+
*/
132+
if ( apply_filters( 'lifterlms_enroll_student_on_order_complete', true, $order ) ) {
133+
llms_enroll_student( $user_id, $product_id, 'order_' . $order_id );
134+
}
127135

128136
// Trigger purchase action, used by engagements.
129137

@@ -153,7 +161,6 @@ public function complete_order( $order, $old_status ) {
153161

154162
// Maybe schedule a payment.
155163
$order->maybe_schedule_payment();
156-
157164
}
158165

159166
/**
@@ -210,7 +217,6 @@ public function error_order( $order ) {
210217
}
211218

212219
llms_unenroll_student( $order->get( 'user_id' ), $order->get( 'product_id' ), $status, 'order_' . $order->get( 'id' ) );
213-
214220
}
215221

216222
/**
@@ -229,7 +235,6 @@ public function on_delete_order( $post_id ) {
229235
if ( $order && is_a( $order, 'LLMS_Order' ) ) {
230236
llms_delete_student_enrollment( $order->get( 'user_id' ), $order->get( 'product_id' ), 'order_' . $order->get( 'id' ) );
231237
}
232-
233238
}
234239

235240
/**
@@ -258,7 +263,6 @@ public function on_user_enrollment_deleted( $user_id, $product_id, $trigger ) {
258263
remove_filter( 'llms_unenroll_on_error_order', '__return_false', 100 );
259264

260265
}
261-
262266
}
263267

264268
/**
@@ -325,7 +329,6 @@ public function expire_access( $order_id ) {
325329
if ( $new_order_status ) {
326330
$order->set_status( $new_order_status );
327331
}
328-
329332
}
330333

331334
/**
@@ -343,7 +346,6 @@ public function pending_cancel_order( $order ) {
343346

344347
$order->unschedule_recurring_payment();
345348
$order->maybe_schedule_expiration();
346-
347349
}
348350

349351
/**
@@ -511,7 +513,6 @@ public function recurring_charge( $order_id ) {
511513
// Passed validation, hand off to the gateway.
512514
$gateway->handle_recurring_transaction( $order );
513515
return true;
514-
515516
}
516517

517518
/**
@@ -546,7 +547,6 @@ public function set_untrash_status( $new_status, $post_id, $previous_status ) {
546547
}
547548

548549
return $new_status;
549-
550550
}
551551

552552
/**
@@ -576,7 +576,6 @@ public function transaction_failed( $txn ) {
576576
$order->set( 'status', 'llms-failed' );
577577

578578
}
579-
580579
}
581580

582581
/**
@@ -596,7 +595,6 @@ public function transaction_refunded( $txn ) {
596595
return; }
597596

598597
$order->set( 'status', 'llms-refunded' );
599-
600598
}
601599

602600
/**
@@ -625,7 +623,6 @@ public function transaction_succeeded( $txn ) {
625623

626624
// Maybe schedule a payment.
627625
$order->maybe_schedule_payment();
628-
629626
}
630627

631628
/**
@@ -691,7 +688,6 @@ public function transition_status( $new_status, $old_status, $post ) {
691688
* @param string $new_status The new order or transaction status.
692689
*/
693690
do_action( "lifterlms_{$post_type}_status_{$new_status}", $obj, $old_status, $new_status );
694-
695691
}
696692

697693
/**
@@ -734,7 +730,6 @@ private function validate_selected_gateway( $gateway_id, $plan ) {
734730
}
735731

736732
return $gateway;
737-
738733
}
739734

740735
/**
@@ -804,7 +799,6 @@ public function switch_payment_source() {
804799
_deprecated_function( __METHOD__, '7.0.0', 'LLMS_Controller_Checkout::switch_payment_source' );
805800
LLMS_Controller_Checkout::instance()->switch_payment_source();
806801
}
807-
808802
}
809803

810804
return new LLMS_Controller_Orders();

includes/functions/llms.functions.order.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function llms_can_gateway_be_used_for_plan( $gateway_id, $plan ) {
3636
* @param LLMS_Access_plan $plan The access plan object.
3737
*/
3838
return apply_filters( 'llms_can_gateway_be_used_for_plan', $can_be_used, $gateway_id, $plan );
39-
4039
}
4140

4241
/**
@@ -100,7 +99,6 @@ function llms_can_gateway_be_used_for_plan_or_order( $gateway_id, $plan_or_order
10099
$can_use = apply_filters( 'llms_can_gateway_be_used_for_plan_or_order', $can_use, $gateway_id, $plan_or_order );
101100

102101
return is_wp_error( $can_use ) && ! $wp_err ? false : $can_use;
103-
104102
}
105103

106104
/**
@@ -126,7 +124,6 @@ function llms_get_order_by_key( $key, $return = 'order' ) {
126124

127125
// Return an int not a numeric string.
128126
return $id ? absint( $id ) : $id;
129-
130127
}
131128

132129
/**
@@ -182,7 +179,6 @@ function llms_get_order_statuses( $order_type = 'any' ) {
182179
* @param string $order_type The type of the order.
183180
*/
184181
return apply_filters( 'llms_get_order_statuses', $statuses, $order_type );
185-
186182
}
187183

188184
/**
@@ -207,7 +203,6 @@ function llms_get_possible_order_statuses( $order ) {
207203
}
208204

209205
return $statuses;
210-
211206
}
212207

213208
/**
@@ -247,7 +242,6 @@ function llms_locate_order_for_email_and_plan( $email, $plan_id ) {
247242
);
248243

249244
return $query->posts[0] ?? null;
250-
251245
}
252246

253247
/**
@@ -280,7 +274,6 @@ function llms_locate_order_for_user_and_plan( $user_id, $plan_id ) {
280274

281275
// Return an int not a numeric string.
282276
return $id ? absint( $id ) : $id;
283-
284277
}
285278

286279
/**
@@ -414,7 +407,15 @@ function llms_setup_pending_order( $data = array() ) {
414407
}
415408

416409
// Ensure the new user isn't enrolled in the product being purchased.
417-
if ( llms_is_user_enrolled( $person_id, $plan->get( 'product_id' ) ) ) {
410+
/**
411+
* Filter to allow checkout if already enrolled.
412+
*
413+
* @param bool $block_checkout Whether to block checkout if already enrolled.
414+
* @param LLMS_Access_Plan $plan The access plan.
415+
*
416+
* @since 9.1.2
417+
*/
418+
if ( llms_is_user_enrolled( $person_id, $plan->get( 'product_id' ) ) && apply_filters( 'llms_checkout_block_enrolled_checkout', true, $plan ) ) {
418419

419420
$product = $plan->get_product();
420421
$err->add(
@@ -451,5 +452,4 @@ function llms_setup_pending_order( $data = array() ) {
451452
* @param array $data Array of input data from a checkout form.
452453
*/
453454
return apply_filters( 'llms_after_setup_pending_order', compact( 'person', 'plan', 'gateway', 'coupon' ), $data );
454-
455455
}

includes/functions/llms.functions.templates.pricing.table.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ function llms_template_product_not_purchasable( $post_id = null ) {
186186
'product/not-purchasable.php',
187187
compact( 'product' )
188188
);
189-
190189
}
191190
}
192191

@@ -214,12 +213,15 @@ function lifterlms_template_pricing_table( $post_id = null ) {
214213
* It does not modify the user's enrollment status.
215214
*
216215
* @since Unknown
216+
* @since 9.1.2 Added product param.
217217
*
218218
* @param boolean $is_enrolled User's current enrollment status.
219+
* @param LLMS_Product $product Product for the pricing table.
219220
*/
220221
$is_enrolled = apply_filters(
221222
'llms_product_pricing_table_enrollment_status',
222-
llms_is_user_enrolled( get_current_user_id(), $product->get( 'id' ) )
223+
llms_is_user_enrolled( get_current_user_id(), $product->get( 'id' ) ),
224+
$product
223225
);
224226

225227
$purchasable = $product->is_purchasable();
@@ -230,6 +232,5 @@ function lifterlms_template_pricing_table( $post_id = null ) {
230232
'product/pricing-table.php',
231233
compact( 'product', 'is_enrolled', 'purchasable', 'has_free', 'has_restrictions' )
232234
);
233-
234235
}
235236
}

includes/notifications/controllers/class.llms.notification.controller.purchase.receipt.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,21 @@ class LLMS_Notification_Controller_Purchase_Receipt extends LLMS_Abstract_Notifi
6262
*/
6363
public function action_callback( $transaction = null ) {
6464

65-
$order = $transaction->get_order();
65+
$order = $transaction->get_order();
66+
67+
/**
68+
* Filter to avoid sending notification for purchase receipts.
69+
*
70+
* @since 9.1.2
71+
*/
72+
if ( ! apply_filters( 'llms_send_purchase_receipt_notification', true, $order, $transaction ) ) {
73+
return;
74+
}
75+
6676
$this->user_id = $order->get( 'user_id' );
6777
$this->post_id = $transaction->get( 'id' );
6878

6979
$this->send();
70-
7180
}
7281

7382
/**
@@ -106,7 +115,6 @@ protected function get_subscriber( $subscriber ) {
106115
}
107116

108117
return $uid;
109-
110118
}
111119

112120
/**
@@ -178,7 +186,6 @@ public function get_test_settings( $type ) {
178186
// 'selected' => false,
179187
),
180188
);
181-
182189
}
183190

184191
/**
@@ -217,7 +224,6 @@ public function send_test( $type, $data = array() ) {
217224
$this->post_id = $transaction->get( 'id' );
218225

219226
return parent::send_test( $type );
220-
221227
}
222228

223229
/**
@@ -243,9 +249,7 @@ protected function set_subscriber_options( $type ) {
243249
}
244250

245251
return $options;
246-
247252
}
248-
249253
}
250254

251255
return LLMS_Notification_Controller_Purchase_Receipt::instance();

0 commit comments

Comments
 (0)