Plugin Directory

Changeset 3424866


Ignore:
Timestamp:
12/21/2025 05:59:49 PM (4 months ago)
Author:
restrictmate
Message:

release 1.1.14

Location:
restrictmate
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • restrictmate/tags/1.1.14/includes/Activation.php

    r3401347 r3424866  
    2424        $this->create_schedule_for_default_actions();
    2525        self::activation_redirect();
     26        self::set_default_options();
    2627
    2728        // Since 1.1.11 Upgrader tasks
     
    257258        }
    258259    }
     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    }
    259286}
  • restrictmate/tags/1.1.14/includes/Admin/DispatchActions.php

    r3401347 r3424866  
    264264        $status         = isset( $_POST['status'] ) ? sanitize_text_field( wp_unslash( $_POST['status'] ) ) : '';
    265265        $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'] ) ) : '';
    266267
    267268        $args = [
     
    289290
    290291        $inserted = restrictmate_insert_transaction( $args, $_POST );
     292        restrictmate_update_note( $inserted, 'transaction', $trx_note );
    291293
    292294        if ( is_wp_error( $inserted ) ) {
     
    307309                wp_die( esc_html( $subs_updated->get_error_message() ) );
    308310            }
     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}" );
    309335        }
    310336
    311337        if ( ! $id ) { // If it's a new transaction create a subscription.
    312             $trx_id         = $inserted['id'];
     338            $trx_id         = $inserted;
    313339            $transaction    = restrictmate_get_transaction_by_id( $trx_id );
    314340            $transaction_id = $transaction->transaction_id;
     
    339365            }
    340366
    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            }
    364392        }
    365393
  • restrictmate/tags/1.1.14/includes/Admin/views/transactions/create.php

    r3405860 r3424866  
    115115                ],
    116116                [
     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                [
    117128                    'type' => 'sectionend',
    118129                    'id'   => 'restrictmate_create_transaction',
  • restrictmate/tags/1.1.14/includes/Admin/views/transactions/edit.php

    r3405860 r3424866  
    2323    // Use correct action URL to avoid empty pages.
    2424    $action_url = esc_url( admin_url( 'admin.php' ) . '?page=restrictmate-transactions' );
     25    $note = restrictmate_get_notes([ 'object_id' => $transaction->id , 'object_type' => 'transaction']);
    2526    ?>
    2627
     
    119120                ],
    120121                [
     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                [
    121133                    'type' => 'sectionend',
    122134                    'id'   => 'restrictmate_edit_transaction',
  • restrictmate/tags/1.1.14/includes/Ajax.php

    r3394404 r3424866  
    9595        }
    9696
    97         $trx_id         = $inserted['id'];
     97        $trx_id         = $inserted;
    9898        $transaction    = restrictmate_get_transaction_by_id( $trx_id );
    9999        $transaction_id = $transaction->transaction_id;
  • restrictmate/tags/1.1.14/includes/helpers.php

    r3401347 r3424866  
    13511351        $updated = apply_filters( 'restrictmate_transaction_updated_after', $data['transaction_id'], $data, $posted_data );
    13521352
    1353         return $updated;
     1353        return $id;
    13541354    } else {
    13551355
     
    13701370        $inserted = apply_filters( 'restrictmate_transaction_created_after', $data['transaction_id'], $data, $posted_data );
    13711371
    1372         return [
    1373             'id'         => $transac_id,
    1374             'created_at' => $data['created_at'],
    1375         ];
     1372        return $transac_id;
    13761373    }
    13771374}
  • restrictmate/tags/1.1.14/readme.txt

    r3418461 r3424866  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.1.13
     8Stable tag: 1.1.14
    99License: GPL-2.0+
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    201201
    202202== 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
    203208
    204209= 1.1.13 =
  • restrictmate/tags/1.1.14/restrictmate.php

    r3418461 r3424866  
    66 * Author: RestrictMate
    77 * Author URI: https://restrictmate.com
    8  * Version: 1.1.13
     8 * Version: 1.1.14
    99 * License: GPL-2.0+
    1010 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
  • restrictmate/tags/1.1.14/vendor/composer/InstalledVersions.php

    r3418461 r3424866  
    323323
    324324        $installed = array();
    325         $copiedLocalDir = false;
    326325
    327326        if (self::$canGetVendors) {
     
    332331                    /** @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 */
    333332                    $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];
    339336                    }
    340337                }
     
    354351        }
    355352
    356         if (self::$installed !== array() && !$copiedLocalDir) {
     353        if (self::$installed !== array()) {
    357354            $installed[] = self::$installed;
    358355        }
  • restrictmate/trunk/includes/Activation.php

    r3401347 r3424866  
    2424        $this->create_schedule_for_default_actions();
    2525        self::activation_redirect();
     26        self::set_default_options();
    2627
    2728        // Since 1.1.11 Upgrader tasks
     
    257258        }
    258259    }
     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    }
    259286}
  • restrictmate/trunk/includes/Admin/DispatchActions.php

    r3401347 r3424866  
    264264        $status         = isset( $_POST['status'] ) ? sanitize_text_field( wp_unslash( $_POST['status'] ) ) : '';
    265265        $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'] ) ) : '';
    266267
    267268        $args = [
     
    289290
    290291        $inserted = restrictmate_insert_transaction( $args, $_POST );
     292        restrictmate_update_note( $inserted, 'transaction', $trx_note );
    291293
    292294        if ( is_wp_error( $inserted ) ) {
     
    307309                wp_die( esc_html( $subs_updated->get_error_message() ) );
    308310            }
     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}" );
    309335        }
    310336
    311337        if ( ! $id ) { // If it's a new transaction create a subscription.
    312             $trx_id         = $inserted['id'];
     338            $trx_id         = $inserted;
    313339            $transaction    = restrictmate_get_transaction_by_id( $trx_id );
    314340            $transaction_id = $transaction->transaction_id;
     
    339365            }
    340366
    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            }
    364392        }
    365393
  • restrictmate/trunk/includes/Admin/views/transactions/create.php

    r3405860 r3424866  
    115115                ],
    116116                [
     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                [
    117128                    'type' => 'sectionend',
    118129                    'id'   => 'restrictmate_create_transaction',
  • restrictmate/trunk/includes/Admin/views/transactions/edit.php

    r3405860 r3424866  
    2323    // Use correct action URL to avoid empty pages.
    2424    $action_url = esc_url( admin_url( 'admin.php' ) . '?page=restrictmate-transactions' );
     25    $note = restrictmate_get_notes([ 'object_id' => $transaction->id , 'object_type' => 'transaction']);
    2526    ?>
    2627
     
    119120                ],
    120121                [
     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                [
    121133                    'type' => 'sectionend',
    122134                    'id'   => 'restrictmate_edit_transaction',
  • restrictmate/trunk/includes/Ajax.php

    r3394404 r3424866  
    9595        }
    9696
    97         $trx_id         = $inserted['id'];
     97        $trx_id         = $inserted;
    9898        $transaction    = restrictmate_get_transaction_by_id( $trx_id );
    9999        $transaction_id = $transaction->transaction_id;
  • restrictmate/trunk/includes/helpers.php

    r3401347 r3424866  
    13511351        $updated = apply_filters( 'restrictmate_transaction_updated_after', $data['transaction_id'], $data, $posted_data );
    13521352
    1353         return $updated;
     1353        return $id;
    13541354    } else {
    13551355
     
    13701370        $inserted = apply_filters( 'restrictmate_transaction_created_after', $data['transaction_id'], $data, $posted_data );
    13711371
    1372         return [
    1373             'id'         => $transac_id,
    1374             'created_at' => $data['created_at'],
    1375         ];
     1372        return $transac_id;
    13761373    }
    13771374}
  • restrictmate/trunk/readme.txt

    r3418461 r3424866  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.1.13
     8Stable tag: 1.1.14
    99License: GPL-2.0+
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    201201
    202202== 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
    203208
    204209= 1.1.13 =
  • restrictmate/trunk/restrictmate.php

    r3418461 r3424866  
    66 * Author: RestrictMate
    77 * Author URI: https://restrictmate.com
    8  * Version: 1.1.13
     8 * Version: 1.1.14
    99 * License: GPL-2.0+
    1010 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
  • restrictmate/trunk/vendor/composer/InstalledVersions.php

    r3418461 r3424866  
    323323
    324324        $installed = array();
    325         $copiedLocalDir = false;
    326325
    327326        if (self::$canGetVendors) {
     
    332331                    /** @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 */
    333332                    $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];
    339336                    }
    340337                }
     
    354351        }
    355352
    356         if (self::$installed !== array() && !$copiedLocalDir) {
     353        if (self::$installed !== array()) {
    357354            $installed[] = self::$installed;
    358355        }
Note: See TracChangeset for help on using the changeset viewer.