Changeset 3424866
- Timestamp:
- 12/21/2025 05:59:49 PM (4 months ago)
- Location:
- restrictmate
- Files:
-
- 18 edited
- 1 copied
-
tags/1.1.14 (copied) (copied from restrictmate/trunk)
-
tags/1.1.14/includes/Activation.php (modified) (2 diffs)
-
tags/1.1.14/includes/Admin/DispatchActions.php (modified) (4 diffs)
-
tags/1.1.14/includes/Admin/views/transactions/create.php (modified) (1 diff)
-
tags/1.1.14/includes/Admin/views/transactions/edit.php (modified) (2 diffs)
-
tags/1.1.14/includes/Ajax.php (modified) (1 diff)
-
tags/1.1.14/includes/helpers.php (modified) (2 diffs)
-
tags/1.1.14/readme.txt (modified) (2 diffs)
-
tags/1.1.14/restrictmate.php (modified) (1 diff)
-
tags/1.1.14/vendor/composer/InstalledVersions.php (modified) (3 diffs)
-
trunk/includes/Activation.php (modified) (2 diffs)
-
trunk/includes/Admin/DispatchActions.php (modified) (4 diffs)
-
trunk/includes/Admin/views/transactions/create.php (modified) (1 diff)
-
trunk/includes/Admin/views/transactions/edit.php (modified) (2 diffs)
-
trunk/includes/Ajax.php (modified) (1 diff)
-
trunk/includes/helpers.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/restrictmate.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
restrictmate/tags/1.1.14/includes/Activation.php
r3401347 r3424866 24 24 $this->create_schedule_for_default_actions(); 25 25 self::activation_redirect(); 26 self::set_default_options(); 26 27 27 28 // Since 1.1.11 Upgrader tasks … … 257 258 } 258 259 } 260 261 /** 262 * Set default options 263 */ 264 public static function set_default_options() { 265 // general settings 266 update_option( 'restrictmate_restricted_content_message', 'This content is restricted to subscribers.' ); 267 update_option( 'restrictmate_content_excerpt', 'always' ); 268 update_option( 'restrictmate_currency', 'USD' ); 269 // payment gateway settings 270 update_option( 'restrictmate_gateway_manual_payment', 'yes' ); 271 update_option( 'restrictmate_gateway_manual_payment_title', 'Manual Payment' ); 272 update_option( 'restrictmate_gateway_manual_payment_description', 'Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order will not be shipped until the funds have cleared in our account.' ); 273 update_option( 'restrictmate_gateway_manual_payment_account_details', 'Bank Name: Your Bank Name Account Number: 12345678 Sort Code: 12-34-56' ); 274 // email settings 275 update_option( 'restrictmate_email_from_name', get_option( 'blogname' ) ); 276 update_option( 'restrictmate_email_from_email', get_option( 'admin_email' ) ); 277 update_option( 'restrictmate_email_format', 'text/html' ); 278 // invoice settings 279 update_option( 'restrictmate_invoice_heading', 'Membership Invoice' ); 280 update_option( 'restrictmate_invoice_company_name', 'Company Name' ); 281 update_option( 'restrictmate_invoice_address_line_1', '123 Main St' ); 282 update_option( 'restrictmate_invoice_address_line_2', 'Suite 100' ); 283 update_option( 'restrictmate_invoice_email', 'hello@company.com' ); 284 update_option( 'restrictmate_invoice_footer_text', 'Thank you for your membership!' ); 285 } 259 286 } -
restrictmate/tags/1.1.14/includes/Admin/DispatchActions.php
r3401347 r3424866 264 264 $status = isset( $_POST['status'] ) ? sanitize_text_field( wp_unslash( $_POST['status'] ) ) : ''; 265 265 $payment_at = isset( $_POST['payment_at'] ) ? sanitize_text_field( wp_unslash( $_POST['payment_at'] ) ) : ''; 266 $trx_note = isset( $_POST['trx_note'] ) ? sanitize_text_field( wp_unslash( $_POST['trx_note'] ) ) : ''; 266 267 267 268 $args = [ … … 289 290 290 291 $inserted = restrictmate_insert_transaction( $args, $_POST ); 292 restrictmate_update_note( $inserted, 'transaction', $trx_note ); 291 293 292 294 if ( is_wp_error( $inserted ) ) { … … 307 309 wp_die( esc_html( $subs_updated->get_error_message() ) ); 308 310 } 311 312 // Send payment confirmation email if the transaction is completed. 313 $tokens = [ 314 'user_id' => $user, 315 'membership_id' => $level_id, 316 'subscription_id' => $subscription->subscription_id, 317 ]; 318 $delay = 30; 319 320 $pay_action_id = as_schedule_single_action( 321 time() + $delay, 322 'restrictmate_payment_is_received', 323 $tokens, 324 'restrictmate_email_action_group' 325 ); 326 \ActionScheduler::logger()->log( $pay_action_id, "Scheduled email for subscription activation is set {$pay_action_id}" ); 327 328 $action_id = as_schedule_single_action( 329 time() + $delay, 330 'restrictmate_subscription_is_activated', 331 $tokens, 332 'restrictmate_email_action_group' 333 ); 334 \ActionScheduler::logger()->log( $action_id, "Scheduled email for subscription activation is set {$action_id}" ); 309 335 } 310 336 311 337 if ( ! $id ) { // If it's a new transaction create a subscription. 312 $trx_id = $inserted ['id'];338 $trx_id = $inserted; 313 339 $transaction = restrictmate_get_transaction_by_id( $trx_id ); 314 340 $transaction_id = $transaction->transaction_id; … … 339 365 } 340 366 341 // Send payment confirmation email if the transaction is completed. 342 $tokens = [ 343 'user_id' => $user, 344 'membership_id' => $level_id, 345 'subscription_id' => $subscription_id, 346 ]; 347 $delay = 30; 348 349 $pay_action_id = as_schedule_single_action( 350 time() + $delay, 351 'restrictmate_payment_is_received', 352 $tokens, 353 'restrictmate_email_action_group' 354 ); 355 \ActionScheduler::logger()->log( $pay_action_id, "Scheduled email for subscription activation is set {$pay_action_id}" ); 356 357 $action_id = as_schedule_single_action( 358 time() + $delay, 359 'restrictmate_subscription_is_activated', 360 $tokens, 361 'restrictmate_email_action_group' 362 ); 363 \ActionScheduler::logger()->log( $action_id, "Scheduled email for subscription activation is set {$action_id}" ); 367 if( 'completed' === $status ){ 368 // Send payment confirmation email if the transaction is completed. 369 $tokens = [ 370 'user_id' => $user, 371 'membership_id' => $level_id, 372 'subscription_id' => $subscription_id, 373 ]; 374 $delay = 30; 375 376 $pay_action_id = as_schedule_single_action( 377 time() + $delay, 378 'restrictmate_payment_is_received', 379 $tokens, 380 'restrictmate_email_action_group' 381 ); 382 \ActionScheduler::logger()->log( $pay_action_id, "Scheduled email for subscription activation is set {$pay_action_id}" ); 383 384 $action_id = as_schedule_single_action( 385 time() + $delay, 386 'restrictmate_subscription_is_activated', 387 $tokens, 388 'restrictmate_email_action_group' 389 ); 390 \ActionScheduler::logger()->log( $action_id, "Scheduled email for subscription activation is set {$action_id}" ); 391 } 364 392 } 365 393 -
restrictmate/tags/1.1.14/includes/Admin/views/transactions/create.php
r3405860 r3424866 115 115 ], 116 116 [ 117 'title' => esc_html__( 'Note', 'restrictmate' ), 118 'desc' => esc_html__( 'Add any notes or comments related to this transaction.', 'restrictmate' ), 119 'id' => 'trx_note', 120 'default' => '', 121 'value' => '', 122 'type' => 'textarea', 123 'class' => '', 124 'css' => 'min-width: 400px;', 125 'desc_tip' => false, 126 ], 127 [ 117 128 'type' => 'sectionend', 118 129 'id' => 'restrictmate_create_transaction', -
restrictmate/tags/1.1.14/includes/Admin/views/transactions/edit.php
r3405860 r3424866 23 23 // Use correct action URL to avoid empty pages. 24 24 $action_url = esc_url( admin_url( 'admin.php' ) . '?page=restrictmate-transactions' ); 25 $note = restrictmate_get_notes([ 'object_id' => $transaction->id , 'object_type' => 'transaction']); 25 26 ?> 26 27 … … 119 120 ], 120 121 [ 122 'title' => esc_html__( 'Note', 'restrictmate' ), 123 'desc' => esc_html__( 'Add any notes or comments related to this transaction.', 'restrictmate' ), 124 'id' => 'trx_note', 125 'default' => '', 126 'value' => ! empty( $note[0]->content ) ? $note[0]->content : '', 127 'type' => 'textarea', 128 'class' => '', 129 'css' => 'min-width: 400px;', 130 'desc_tip' => false, 131 ], 132 [ 121 133 'type' => 'sectionend', 122 134 'id' => 'restrictmate_edit_transaction', -
restrictmate/tags/1.1.14/includes/Ajax.php
r3394404 r3424866 95 95 } 96 96 97 $trx_id = $inserted ['id'];97 $trx_id = $inserted; 98 98 $transaction = restrictmate_get_transaction_by_id( $trx_id ); 99 99 $transaction_id = $transaction->transaction_id; -
restrictmate/tags/1.1.14/includes/helpers.php
r3401347 r3424866 1351 1351 $updated = apply_filters( 'restrictmate_transaction_updated_after', $data['transaction_id'], $data, $posted_data ); 1352 1352 1353 return $ updated;1353 return $id; 1354 1354 } else { 1355 1355 … … 1370 1370 $inserted = apply_filters( 'restrictmate_transaction_created_after', $data['transaction_id'], $data, $posted_data ); 1371 1371 1372 return [ 1373 'id' => $transac_id, 1374 'created_at' => $data['created_at'], 1375 ]; 1372 return $transac_id; 1376 1373 } 1377 1374 } -
restrictmate/tags/1.1.14/readme.txt
r3418461 r3424866 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.1.1 38 Stable tag: 1.1.14 9 9 License: GPL-2.0+ 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 201 201 202 202 == Changelog == 203 204 = 1.1.14 = 205 * New: Added notes options for transactions 206 * Fix: Resolved email notifications for payments and subscriptions created from backend by admin 207 * Fix: Resolved saving of default options during activation to prevent errors and missing data 203 208 204 209 = 1.1.13 = -
restrictmate/tags/1.1.14/restrictmate.php
r3418461 r3424866 6 6 * Author: RestrictMate 7 7 * Author URI: https://restrictmate.com 8 * Version: 1.1.1 38 * Version: 1.1.14 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt -
restrictmate/tags/1.1.14/vendor/composer/InstalledVersions.php
r3418461 r3424866 323 323 324 324 $installed = array(); 325 $copiedLocalDir = false;326 325 327 326 if (self::$canGetVendors) { … … 332 331 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 333 332 $required = require $vendorDir.'/composer/installed.php'; 334 self::$installedByVendor[$vendorDir] = $required; 335 $installed[] = $required; 336 if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 337 self::$installed = $required; 338 $copiedLocalDir = true; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 339 336 } 340 337 } … … 354 351 } 355 352 356 if (self::$installed !== array() && !$copiedLocalDir) {353 if (self::$installed !== array()) { 357 354 $installed[] = self::$installed; 358 355 } -
restrictmate/trunk/includes/Activation.php
r3401347 r3424866 24 24 $this->create_schedule_for_default_actions(); 25 25 self::activation_redirect(); 26 self::set_default_options(); 26 27 27 28 // Since 1.1.11 Upgrader tasks … … 257 258 } 258 259 } 260 261 /** 262 * Set default options 263 */ 264 public static function set_default_options() { 265 // general settings 266 update_option( 'restrictmate_restricted_content_message', 'This content is restricted to subscribers.' ); 267 update_option( 'restrictmate_content_excerpt', 'always' ); 268 update_option( 'restrictmate_currency', 'USD' ); 269 // payment gateway settings 270 update_option( 'restrictmate_gateway_manual_payment', 'yes' ); 271 update_option( 'restrictmate_gateway_manual_payment_title', 'Manual Payment' ); 272 update_option( 'restrictmate_gateway_manual_payment_description', 'Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order will not be shipped until the funds have cleared in our account.' ); 273 update_option( 'restrictmate_gateway_manual_payment_account_details', 'Bank Name: Your Bank Name Account Number: 12345678 Sort Code: 12-34-56' ); 274 // email settings 275 update_option( 'restrictmate_email_from_name', get_option( 'blogname' ) ); 276 update_option( 'restrictmate_email_from_email', get_option( 'admin_email' ) ); 277 update_option( 'restrictmate_email_format', 'text/html' ); 278 // invoice settings 279 update_option( 'restrictmate_invoice_heading', 'Membership Invoice' ); 280 update_option( 'restrictmate_invoice_company_name', 'Company Name' ); 281 update_option( 'restrictmate_invoice_address_line_1', '123 Main St' ); 282 update_option( 'restrictmate_invoice_address_line_2', 'Suite 100' ); 283 update_option( 'restrictmate_invoice_email', 'hello@company.com' ); 284 update_option( 'restrictmate_invoice_footer_text', 'Thank you for your membership!' ); 285 } 259 286 } -
restrictmate/trunk/includes/Admin/DispatchActions.php
r3401347 r3424866 264 264 $status = isset( $_POST['status'] ) ? sanitize_text_field( wp_unslash( $_POST['status'] ) ) : ''; 265 265 $payment_at = isset( $_POST['payment_at'] ) ? sanitize_text_field( wp_unslash( $_POST['payment_at'] ) ) : ''; 266 $trx_note = isset( $_POST['trx_note'] ) ? sanitize_text_field( wp_unslash( $_POST['trx_note'] ) ) : ''; 266 267 267 268 $args = [ … … 289 290 290 291 $inserted = restrictmate_insert_transaction( $args, $_POST ); 292 restrictmate_update_note( $inserted, 'transaction', $trx_note ); 291 293 292 294 if ( is_wp_error( $inserted ) ) { … … 307 309 wp_die( esc_html( $subs_updated->get_error_message() ) ); 308 310 } 311 312 // Send payment confirmation email if the transaction is completed. 313 $tokens = [ 314 'user_id' => $user, 315 'membership_id' => $level_id, 316 'subscription_id' => $subscription->subscription_id, 317 ]; 318 $delay = 30; 319 320 $pay_action_id = as_schedule_single_action( 321 time() + $delay, 322 'restrictmate_payment_is_received', 323 $tokens, 324 'restrictmate_email_action_group' 325 ); 326 \ActionScheduler::logger()->log( $pay_action_id, "Scheduled email for subscription activation is set {$pay_action_id}" ); 327 328 $action_id = as_schedule_single_action( 329 time() + $delay, 330 'restrictmate_subscription_is_activated', 331 $tokens, 332 'restrictmate_email_action_group' 333 ); 334 \ActionScheduler::logger()->log( $action_id, "Scheduled email for subscription activation is set {$action_id}" ); 309 335 } 310 336 311 337 if ( ! $id ) { // If it's a new transaction create a subscription. 312 $trx_id = $inserted ['id'];338 $trx_id = $inserted; 313 339 $transaction = restrictmate_get_transaction_by_id( $trx_id ); 314 340 $transaction_id = $transaction->transaction_id; … … 339 365 } 340 366 341 // Send payment confirmation email if the transaction is completed. 342 $tokens = [ 343 'user_id' => $user, 344 'membership_id' => $level_id, 345 'subscription_id' => $subscription_id, 346 ]; 347 $delay = 30; 348 349 $pay_action_id = as_schedule_single_action( 350 time() + $delay, 351 'restrictmate_payment_is_received', 352 $tokens, 353 'restrictmate_email_action_group' 354 ); 355 \ActionScheduler::logger()->log( $pay_action_id, "Scheduled email for subscription activation is set {$pay_action_id}" ); 356 357 $action_id = as_schedule_single_action( 358 time() + $delay, 359 'restrictmate_subscription_is_activated', 360 $tokens, 361 'restrictmate_email_action_group' 362 ); 363 \ActionScheduler::logger()->log( $action_id, "Scheduled email for subscription activation is set {$action_id}" ); 367 if( 'completed' === $status ){ 368 // Send payment confirmation email if the transaction is completed. 369 $tokens = [ 370 'user_id' => $user, 371 'membership_id' => $level_id, 372 'subscription_id' => $subscription_id, 373 ]; 374 $delay = 30; 375 376 $pay_action_id = as_schedule_single_action( 377 time() + $delay, 378 'restrictmate_payment_is_received', 379 $tokens, 380 'restrictmate_email_action_group' 381 ); 382 \ActionScheduler::logger()->log( $pay_action_id, "Scheduled email for subscription activation is set {$pay_action_id}" ); 383 384 $action_id = as_schedule_single_action( 385 time() + $delay, 386 'restrictmate_subscription_is_activated', 387 $tokens, 388 'restrictmate_email_action_group' 389 ); 390 \ActionScheduler::logger()->log( $action_id, "Scheduled email for subscription activation is set {$action_id}" ); 391 } 364 392 } 365 393 -
restrictmate/trunk/includes/Admin/views/transactions/create.php
r3405860 r3424866 115 115 ], 116 116 [ 117 'title' => esc_html__( 'Note', 'restrictmate' ), 118 'desc' => esc_html__( 'Add any notes or comments related to this transaction.', 'restrictmate' ), 119 'id' => 'trx_note', 120 'default' => '', 121 'value' => '', 122 'type' => 'textarea', 123 'class' => '', 124 'css' => 'min-width: 400px;', 125 'desc_tip' => false, 126 ], 127 [ 117 128 'type' => 'sectionend', 118 129 'id' => 'restrictmate_create_transaction', -
restrictmate/trunk/includes/Admin/views/transactions/edit.php
r3405860 r3424866 23 23 // Use correct action URL to avoid empty pages. 24 24 $action_url = esc_url( admin_url( 'admin.php' ) . '?page=restrictmate-transactions' ); 25 $note = restrictmate_get_notes([ 'object_id' => $transaction->id , 'object_type' => 'transaction']); 25 26 ?> 26 27 … … 119 120 ], 120 121 [ 122 'title' => esc_html__( 'Note', 'restrictmate' ), 123 'desc' => esc_html__( 'Add any notes or comments related to this transaction.', 'restrictmate' ), 124 'id' => 'trx_note', 125 'default' => '', 126 'value' => ! empty( $note[0]->content ) ? $note[0]->content : '', 127 'type' => 'textarea', 128 'class' => '', 129 'css' => 'min-width: 400px;', 130 'desc_tip' => false, 131 ], 132 [ 121 133 'type' => 'sectionend', 122 134 'id' => 'restrictmate_edit_transaction', -
restrictmate/trunk/includes/Ajax.php
r3394404 r3424866 95 95 } 96 96 97 $trx_id = $inserted ['id'];97 $trx_id = $inserted; 98 98 $transaction = restrictmate_get_transaction_by_id( $trx_id ); 99 99 $transaction_id = $transaction->transaction_id; -
restrictmate/trunk/includes/helpers.php
r3401347 r3424866 1351 1351 $updated = apply_filters( 'restrictmate_transaction_updated_after', $data['transaction_id'], $data, $posted_data ); 1352 1352 1353 return $ updated;1353 return $id; 1354 1354 } else { 1355 1355 … … 1370 1370 $inserted = apply_filters( 'restrictmate_transaction_created_after', $data['transaction_id'], $data, $posted_data ); 1371 1371 1372 return [ 1373 'id' => $transac_id, 1374 'created_at' => $data['created_at'], 1375 ]; 1372 return $transac_id; 1376 1373 } 1377 1374 } -
restrictmate/trunk/readme.txt
r3418461 r3424866 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1.1.1 38 Stable tag: 1.1.14 9 9 License: GPL-2.0+ 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 201 201 202 202 == Changelog == 203 204 = 1.1.14 = 205 * New: Added notes options for transactions 206 * Fix: Resolved email notifications for payments and subscriptions created from backend by admin 207 * Fix: Resolved saving of default options during activation to prevent errors and missing data 203 208 204 209 = 1.1.13 = -
restrictmate/trunk/restrictmate.php
r3418461 r3424866 6 6 * Author: RestrictMate 7 7 * Author URI: https://restrictmate.com 8 * Version: 1.1.1 38 * Version: 1.1.14 9 9 * License: GPL-2.0+ 10 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt -
restrictmate/trunk/vendor/composer/InstalledVersions.php
r3418461 r3424866 323 323 324 324 $installed = array(); 325 $copiedLocalDir = false;326 325 327 326 if (self::$canGetVendors) { … … 332 331 /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */ 333 332 $required = require $vendorDir.'/composer/installed.php'; 334 self::$installedByVendor[$vendorDir] = $required; 335 $installed[] = $required; 336 if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 337 self::$installed = $required; 338 $copiedLocalDir = true; 333 $installed[] = self::$installedByVendor[$vendorDir] = $required; 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 335 self::$installed = $installed[count($installed) - 1]; 339 336 } 340 337 } … … 354 351 } 355 352 356 if (self::$installed !== array() && !$copiedLocalDir) {353 if (self::$installed !== array()) { 357 354 $installed[] = self::$installed; 358 355 }
Note: See TracChangeset
for help on using the changeset viewer.