Plugin Directory

Changeset 3332159


Ignore:
Timestamp:
07/22/2025 10:36:27 AM (6 months ago)
Author:
shamsbd71
Message:

Release version 1.5.5

Location:
subscription
Files:
126 added
12 edited

Legend:

Unmodified
Added
Removed
  • subscription/trunk/assets/css/admin.css

    r3320126 r3332159  
    2828
    2929.subscrpt-order-label {
    30   background: #e1edf7;
    31   color: #2683aa;
     30  background: #dbeafe;
     31  color: #1e40af;
    3232  display: inline-block;
    3333  padding: 5px 10px;
     
    3737  clear: both;
    3838  margin-bottom: 5px;
     39  border-radius: 5px;
    3940}
    4041
     
    366367}
    367368
    368 /* Status Label Styles */
    369 .wp-subscription-list-table .subscrpt-active {
    370     background: #e6f4ea;
    371     color: #1a7f37;
    372     border-radius: 999px;
    373     padding: 4px 16px;
    374     font-weight: 600;
    375     font-size: 13px;
    376     display: inline-block;
    377 }
    378 .wp-subscription-list-table .subscrpt-cancelled {
    379     background: #fbeaea;
    380     color: #d93025;
    381     border-radius: 999px;
    382     padding: 4px 16px;
    383     font-weight: 600;
    384     font-size: 13px;
    385     display: inline-block;
    386 }
    387 .wp-subscription-list-table .subscrpt-draft {
    388     background: #f3f3f3;
    389     color: #888;
    390     border-radius: 999px;
    391     padding: 4px 16px;
    392     font-weight: 600;
    393     font-size: 13px;
    394     display: inline-block;
    395 }
    396 
    397369/* =====================
    398370   Subscriptions List Page
     
    467439    text-decoration: underline;
    468440}
    469 .subscrpt-status-badge {
    470     display: inline-block;
    471     min-width: 48px;
    472     padding: 2px 8px;
    473     border-radius: 4px;
    474     font-size: 12px;
    475     font-weight: 500;
    476     color: #222;
    477     text-align: center;
    478     letter-spacing: 0.01em;
    479     background: #e9ecef;
    480     box-shadow: none;
    481     text-transform: capitalize;
    482 }
    483 .subscrpt-status-active { background: #27c775 !important; color: #ffffff !important; }
    484 .subscrpt-status-cancelled { background: #fee2e2 !important; color: #b91c1c !important; }
    485 .subscrpt-status-draft { background: #e0e7ef !important; color: #374151 !important; }
    486 .subscrpt-status-pending { background: #fef9c3 !important; color: #b45309 !important; }
    487 .subscrpt-status-expired { background: #e5e7eb !important; color: #6b7280 !important; }
    488 .subscrpt-status-pe_cancelled { background: #ffedd5 !important; color: #b45309 !important; }
    489 .subscrpt-status-trash { background: #fef2f2 !important; color: #dc2626 !important; }
    490441.subscrpt-id-title {
    491442    font-size: 11px;
  • subscription/trunk/assets/css/status.css

    r3280758 r3332159  
     1.my_account_subscrpt .order-status {
     2    min-width: 100px;
     3}
     4
     5span[class*="subscrpt-"] {
     6  background: #bfdbfe;
     7  color: #1e40af;
     8  font-weight: 600;
     9  font-size: 12px;
     10  text-transform: capitalize;
     11  padding: 8px 10px;
     12  border-radius: 5px;
     13}
     14
    115span.subscrpt-pending {
    2   background: #535050;
    3   color: white;
    4   text-transform: capitalize;
    5   padding: 8px;
     16  background: #dbeafe;
     17  color: #1e40af;
    618}
    719
    820span.subscrpt-active {
    9   background: green;
    10   color: white;
    11   text-transform: capitalize;
    12   padding: 8px;
     21  background: #bbf7d0;
     22  color: #166534;
    1323}
    1424
    1525span.subscrpt-expired {
    16   background: red;
    17   color: white;
    18   text-transform: capitalize;
    19   padding: 8px;
     26  background: #fecaca;
     27  color: #991b1b;
    2028}
    2129
    2230span.subscrpt-cancelled {
    23   background: #cecece;
    24   color: white;
    25   text-transform: capitalize;
    26   padding: 8px;
     31  background: #e2e8f0;
     32  color: #475569;
    2733}
    2834
    2935span.subscrpt-pe_cancelled {
    30   background: #ecb03e;
    31   color: white;
    32   text-transform: capitalize;
    33   padding: 8px;
     36  background: #ffedd5;
     37  color: #b45309;
    3438}
     39
     40span.subscrpt-draft {
     41  background: #f3f3f3;
     42  color: #888;
     43}
  • subscription/trunk/includes/Admin/Subscriptions.php

    r3320126 r3332159  
    130130        // HPOS: Safe. Only retrieves WooCommerce order via CRUD, and subscription meta via post meta.
    131131        $order_id = get_post_meta( $post_id, '_subscrpt_order_id', true ); // HPOS: Only subscription meta, not order meta.
    132         $order = wc_get_order( $order_id ); // HPOS: Safe, uses WooCommerce CRUD.
     132        $order    = wc_get_order( $order_id ); // HPOS: Safe, uses WooCommerce CRUD.
    133133        if ( $order ) {
    134134            if ( 'subscrpt_start_date' === $column ) {
     
    223223        global $wpdb;
    224224        $table_name = $wpdb->prefix . 'subscrpt_order_relation';
    225         // @phpcs:ignore
    226         $order_histories = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %i WHERE subscription_id=%d', array(
    227             $table_name,
    228             $subscription_id,
    229             )
     225
     226        // @phpcs:ignore
     227        $order_histories = $wpdb->get_results(
     228            $wpdb->prepare(
     229                'SELECT * FROM %i WHERE subscription_id=%d ORDER BY id DESC',
     230                array(
     231                    $table_name,
     232                    $subscription_id,
     233                )
    230234            )
    231235        );
     
    498502    public function add_overview_submenu() {
    499503        // Remove and re-add submenu to ensure Overview is first
    500         remove_submenu_page('edit.php?post_type=subscrpt_order', 'edit.php?post_type=subscrpt_order');
     504        remove_submenu_page( 'edit.php?post_type=subscrpt_order', 'edit.php?post_type=subscrpt_order' );
    501505        add_submenu_page(
    502506            'edit.php?post_type=subscrpt_order',
     
    517521            1
    518522        );
    519         if ( ! class_exists('Sdevs_Wc_Subscription_Pro') ) {
     523        if ( ! class_exists( 'Sdevs_Wc_Subscription_Pro' ) ) {
    520524            add_submenu_page(
    521525                'edit.php?post_type=subscrpt_order',
     
    607611
    608612    public function render_go_pro_page() {
    609         if ( class_exists('Sdevs_Wc_Subscription_Pro') ) {
     613        if ( class_exists( 'Sdevs_Wc_Subscription_Pro' ) ) {
    610614            echo '<div class="notice notice-info" style="margin:40px auto;max-width:700px;text-align:center;font-size:1.2em;">Pro is already active.</div>';
    611615            return;
  • subscription/trunk/includes/Admin/views/order-history.php

    r3324782 r3332159  
    1717    <thead>
    1818        <tr>
    19             <th style="width: 100px;"><?php
    20             esc_html_e( 'ID', 'wp_subscription' ); ?></th>
    21             <th></th>
     19            <th style="width: 80px;"><?php esc_html_e( 'ID', 'wp_subscription' ); ?></th>
     20            <th><?php esc_html_e( 'Order Type', 'wp_subscription' ); ?></th>
    2221            <th><?php esc_html_e( 'Date', 'wp_subscription' ); ?></th>
    2322            <th><?php esc_html_e( 'Status', 'wp_subscription' ); ?></th>
     
    2928        <?php foreach ( $order_histories as $order_history ) : ?>
    3029            <?php
    31             $order      = wc_get_order( $order_history->order_id );
    32             $order_item = $order->get_item( $order_history->order_item_id );
     30                $order      = wc_get_order( $order_history->order_id );
     31                $order_item = $order->get_item( $order_history->order_item_id );
    3332            ?>
    3433            <tr>
    35                 <td><a href="<?php echo wp_kses_post( $order->get_edit_order_url() ); ?>" target="_blank"><?php echo wp_kses_post( $order_history->order_id ); ?></a></td>
    36                                     <td><?php echo wp_kses_post( wps_subscription_order_relation_type_cast( $order_history->type ) ); ?></td>
     34                <td>
     35                    <a href="<?php echo wp_kses_post( $order->get_edit_order_url() ); ?>" target="_blank">
     36                        <?php echo wp_kses_post( $order_history->order_id ); ?>
     37                    </a>
     38                </td>
     39                <td>
     40                    <?php echo wp_kses_post( wps_subscription_order_relation_type_cast( $order_history->type ) ); ?>
     41                </td>
    3742                <td>
    3843                    <?php
    3944                    if ( $order ) {
    40                         echo wp_kses_post( gmdate( 'F d, Y', strtotime( $order->get_date_created() ) ) );}
     45                        echo wp_kses_post( gmdate( 'F d, Y', strtotime( $order->get_date_created() ) ) );
     46                    }
    4147                    ?>
    4248                </td>
    4349                <td>
    44                 <?php
    45                 if ( $order ) {
    46                     echo esc_html( sdevs_order_status_label( $order->get_status() ) );
    47                 }
    48                 ?>
     50                    <?php
     51                    if ( $order ) {
     52                        echo esc_html( sdevs_order_status_label( $order->get_status() ) );
     53                    }
     54                    ?>
    4955                </td>
    5056                <td>
    51                 <?php
    52                 echo wc_price(
    53                     $order_item->get_total(),
    54                     array(
    55                         'currency' => $order->get_currency(),
    56                     )
    57                 );
    58                 ?>
    59             </td>
     57                    <?php
     58                    echo wc_price( $order_item->get_total(), array( 'currency' => $order->get_currency() ) );
     59                    ?>
     60                </td>
    6061            </tr>
    6162        <?php endforeach; ?>
  • subscription/trunk/includes/Admin/views/subscription-info.php

    r3292605 r3332159  
    6565                    <tr>
    6666                        <th style="padding:8px 10px;">Status</th>
    67                         <td style="padding:8px 10px;"><span class="subscrpt-status-badge subscrpt-status-<?php echo esc_attr($status_obj->name); ?>"><?php echo esc_html($status_obj->label); ?></span></td>
     67                        <td style="padding:8px 10px;"><span class="subscrpt-<?php echo esc_attr($status_obj->name); ?>"><?php echo esc_html($status_obj->label); ?></span></td>
    6868                    </tr>
    6969                    <tr>
     
    9292</div>
    9393<style>
    94 .subscrpt-status-badge {
    95     display: inline-block;
    96     min-width: 48px;
    97     padding: 2px 8px;
    98     border-radius: 4px;
    99     font-size: 12px;
    100     font-weight: 500;
    101     color: #222;
    102     text-align: center;
    103     letter-spacing: 0.01em;
    104     background: #e9ecef;
    105     box-shadow: none;
    106     text-transform: capitalize;
    107 }
    108 .subscrpt-status-active { background: #27c775 !important; color: #ffffff !important; }
    109 .subscrpt-status-cancelled { background: #fee2e2 !important; color: #b91c1c !important; }
    110 .subscrpt-status-draft { background: #e0e7ef !important; color: #374151 !important; }
    111 .subscrpt-status-pending { background: #fef9c3 !important; color: #b45309 !important; }
    112 .subscrpt-status-expired { background: #e5e7eb !important; color: #6b7280 !important; }
    113 .subscrpt-status-pe_cancelled { background: #ffedd5 !important; color: #b45309 !important; }
    11494@media (max-width: 900px) {
    11595  .wp-subscription-info-left, .wp-subscription-info-right {
  • subscription/trunk/includes/Admin/views/subscription-list.php

    r3320126 r3332159  
    7474            <thead>
    7575                <tr>
    76                     <th style="width:30px;"><input type="checkbox" id="cb-select-all-1"></th>
     76                    <th style="width:20px;"><input type="checkbox" id="cb-select-all-1"></th>
    7777                    <th style="width:180px;">ID</th>
    7878                    <th style="min-width:320px;">Title</th>
     
    8080                    <th style="width:100px;">Start Date</th>
    8181                    <th style="width:100px;">Renewal Date</th>
    82                     <th style="width:80px;">Status</th>
     82                    <th style="width:100px;">Status</th>
    8383                    <th style="width:80px;">Actions</th>
    8484                </tr>
     
    137137                    <td><?php echo $renewal_date ? esc_html( gmdate( 'F d, Y', $renewal_date ) ) : '-'; ?></td>
    138138                    <td>
    139                         <span class="subscrpt-status-badge subscrpt-status-<?php echo esc_attr( $status_obj->name ); ?>">
    140                             <?php echo esc_html( $status_obj->label ); ?>
     139                        <span class="subscrpt-<?php echo esc_attr( $status_obj->name ); ?>">
     140                            <?php echo esc_html( strlen( $status_obj->label ) > 9 ? substr( $status_obj->label, 0, 9 ) . '...' : $status_obj->label ); ?>
    141141                        </span>
    142142                    </td>
  • subscription/trunk/includes/Frontend/Checkout.php

    r3280758 r3332159  
    6060
    6161            if ( $product->is_type( 'simple' ) && ! subscrpt_pro_activated() ) {
    62 
    6362                if ( $product->is_enabled() ) {
    6463                    $is_renew = isset( $order_item['renew_subscrpt'] );
     
    152151            $item->update_meta_data( '_renew_subscrpt', $cart_item['renew_subscrpt'] );
    153152        }
     153
     154        if ( ! empty( $cart_item['wp_subs_switch'] ?? null ) && ! empty( $cart_item['switch_context'] ?? null ) ) {
     155            $switch_context = $cart_item['switch_context'];
     156
     157            // Add switch context data to order item meta.
     158            $item->update_meta_data( '_wp_subs_switch', true, true );
     159            $item->update_meta_data( '_wp_subs_switch_context', $switch_context, true );
     160        }
    154161    }
    155162}
  • subscription/trunk/includes/Frontend/MyAccount.php

    r3320126 r3332159  
    2121    public function __construct() {
    2222        add_action( 'init', array( $this, 'flush_rewrite_rules' ) );
     23       
     24        // Prevent duplicate menu creation
     25
    2326        add_filter( 'woocommerce_account_menu_items', array( $this, 'custom_my_account_menu_items' ) );
     27       
    2428        add_filter( 'woocommerce_endpoint_view-subscription_title', array( $this, 'change_single_title' ) );
    25         add_filter( 'the_title', array( $this, 'change_lists_title' ), 10 );
     29        add_filter( 'document_title_parts', array( $this, 'maybe_change_document_title' ), 20 );
    2630        add_filter( 'woocommerce_get_query_vars', array( $this, 'custom_query_vars' ) );
    2731        add_action( 'woocommerce_account_view-subscription_endpoint', array( $this, 'view_subscrpt_content' ) );
     
    157161
    158162    /**
    159      * Change Subscription Lists Title
    160      *
    161      * @param string $title Title.
    162      *
    163      * @return string
    164      */
    165     public function change_lists_title( string $title ): string {
    166         global $wp_query;
    167         $is_endpoint = isset( $wp_query->query_vars['subscriptions'] );
    168         if ( $is_endpoint && ! is_admin() && is_account_page() ) {
    169             $title = __( 'My Subscriptions', 'wp_subscription' );
    170         }
    171         return $title;
     163     * Change the browser/page title for the subscriptions endpoint only.
     164     */
     165    public function maybe_change_document_title( $title_parts ) {
     166        if ( function_exists( 'is_account_page' ) && is_account_page() ) {
     167            global $wp_query;
     168            if ( isset( $wp_query->query_vars['subscriptions'] ) ) {
     169                $title_parts['title'] = __( 'My Subscriptions', 'wp_subscription' );
     170            }
     171        }
     172        return $title_parts;
    172173    }
    173174
     
    179180     */
    180181    public function custom_my_account_menu_items( array $items ): array {
    181         $logout = $items['customer-logout'];
    182         unset( $items['customer-logout'] );
    183         $items['subscriptions']   = __( 'Subscriptions', 'wp_subscription' );
    184         $items['customer-logout'] = $logout;
     182        // Check if subscriptions menu item already exists to prevent duplicates
     183        if ( ! isset( $items['subscriptions'] ) ) {
     184            $logout = $items['customer-logout'];
     185            unset( $items['customer-logout'] );
     186            $items['subscriptions']   = __( 'Subscriptions', 'wp_subscription' );
     187            $items['customer-logout'] = $logout;
     188        }
    185189        return $items;
    186190    }
  • subscription/trunk/readme.txt

    r3329468 r3332159  
    44Requires at least: 6.0
    55Tested up to: 6.8
    6 Stable tag: 1.5.4
     6Stable tag: 1.5.5
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    229229== Changelog ==
    230230
     231= 1.5.5 - Jul 22, 2025 =
     232* fix: 🐛 Subscription history in descending order view.
     233* fix: 🐛 Changed view subs button to text
     234* feat: ✨ Add subscription switch info on order - Feature support core.
     235* fix: 🐛 Fixed Subscription menu duplication bug
     236
    231237= 1.5.4 - Jul 17, 2025 =
    232238- **Improved**: Enhanced settings page with better user interface and organization
  • subscription/trunk/subscription.php

    r3329468 r3332159  
    44 * Plugin URI: https://wpsubscription.co/
    55 * Description: WPSubscription allow WooCommerce to enables recurring payments, subscriptions, and auto-renewals for digital and physical products. Supports Stripe, PayPal, Paddle, and more.
    6  * Version: 1.5.4
     6 * Version: 1.5.5
    77 * Author: ConversWP
    88 * Author URI: https://wpsubscription.co/
     
    4141     * @var string
    4242     */
    43     const version = '1.5.4';
     43    const version = '1.5.5';
    4444
    4545    /**
  • subscription/trunk/templates/myaccount/subscriptions.php

    r3324782 r3332159  
    2222            <th scope="col" class="subscrpt-next-date"><?php esc_html_e( 'Next Payment', 'wp_subscription' ); ?></th>
    2323            <th scope="col" class="subscrpt-total"><?php esc_html_e( 'Total', 'wp_subscription' ); ?></th>
    24             <th scope="col" class="subscrpt-action"></th>
     24            <th scope="col" class="subscrpt-action">Actions</th>
    2525        </tr>
    2626    </thead>
     
    4646                $product_price_html = Helper::format_price_with_order_item( get_post_meta( get_the_ID(), '_subscrpt_price', true ), $order_item->get_id() );
    4747                ?>
     48
    4849                <tr>
    4950                    <td data-title="Subscription"><?php the_ID(); ?></td>
    50                     <td data-title="Status"><span class="subscrpt-<?php echo esc_attr( $post_status_object->name ); ?>"><?php echo esc_html( strlen( $post_status_object->label ) > 9 ? substr( $post_status_object->label, 0, 6 ) . '...' : $post_status_object->label ); ?></span></td>
    51                     <td data-title="Product"><a href="<?php echo esc_html( $product_link ); ?>" target="_blank"><?php echo esc_html( $product_name ); ?></a></td>
     51
     52                    <td data-title="Status">
     53                        <span class="subscrpt-<?php echo esc_attr( $post_status_object->name ); ?>">
     54                            <?php echo esc_html( strlen( $post_status_object->label ) > 9 ? substr( $post_status_object->label, 0, 9 ) . '...' : $post_status_object->label ); ?>
     55                        </span>
     56                    </td>
     57                   
     58                    <td data-title="Product"><?php echo esc_html( $product_name ); ?></td>
     59                   
    5260                    <?php if ( 'on' !== $trial_mode ) : ?>
    5361                        <td data-title="Next Payment"><?php echo esc_html( $next_date ? gmdate( 'F d, Y', $next_date ) : '-' ); ?></td>
     
    5563                        <td data-title="Next Payment"><small>First Billing : </small><?php echo esc_html( gmdate( 'F d, Y', $start_date ) ); ?></td>
    5664                    <?php endif; ?>
     65
    5766                    <td data-title="Total"><?php echo wp_kses_post( $product_price_html ); ?></td>
    58                     <td data-title="Actions">
    59                         <a href="<?php echo esc_html( wc_get_endpoint_url( 'view-subscription', get_the_ID(), wc_get_page_permalink( 'myaccount' ) ) ); ?>" class="woocommerce-button <?php echo esc_attr( $wp_button_class ); ?> button view"><span class="dashicons dashicons-visibility"></span></a>
     67
     68                    <td data-title="Actions">                       
     69                        <a href="<?php echo esc_html( wc_get_endpoint_url( 'view-subscription', get_the_ID(), wc_get_page_permalink( 'myaccount' ) ) ); ?>" class="woocommerce-button <?php echo esc_attr( $wp_button_class ); ?> button view">
     70                            <?php echo esc_html_e( 'View', 'wp_subscription' ); ?>
     71                        </a>
    6072                    </td>
    6173                </tr>
  • subscription/trunk/vendor/composer/installed.php

    r3329468 r3332159  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '85f6bec8a859328bc3c59082e62addd862c7946d',
     6        'reference' => 'bf883172af808bd7403c13c191db8cc08df68ddb',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => '85f6bec8a859328bc3c59082e62addd862c7946d',
     16            'reference' => 'bf883172af808bd7403c13c191db8cc08df68ddb',
    1717            'type' => 'wordpress-plugin',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.