Plugin Directory

Changeset 3352306


Ignore:
Timestamp:
08/28/2025 09:37:52 PM (6 months ago)
Author:
laith3
Message:

Release 1.2.1: Free – admin success notice includes Edit/View links; importer returns post ID; version bump to 1.2.1.

Location:
tradejournal
Files:
5 edited
9 copied

Legend:

Unmodified
Added
Removed
  • tradejournal/tags/1.2.1/includes/admin.php

    r3185259 r3352306  
    6666                        $file_ext = pathinfo($csv_name, PATHINFO_EXTENSION);
    6767                        if ($file_ext === 'csv' && realpath($csv_tmp_name) && file_exists($csv_tmp_name)) {
    68                             // Proceed to import trades
    69                             tjwp_import_trades_from_csv($csv_tmp_name);
     68                            // Proceed to import trades and capture the created post ID
     69                            $post_id = tjwp_import_trades_from_csv($csv_tmp_name);
    7070
    71                             // Output success message
    72                             echo '<p class="success-message">Trades Imported Successfully!</p>';
     71                            // Output success notice with quick links if we have a post ID
     72                            if ($post_id) {
     73                                $edit_link = get_edit_post_link($post_id);
     74                                $view_link = get_permalink($post_id);
     75                                echo '<div class="notice notice-success is-dismissible"><p>'
     76                                    . esc_html__('Trades imported successfully!', 'tradejournal') . ' '
     77                                    . '<a href="' . esc_url($edit_link) . '">' . esc_html__('Edit post', 'tradejournal') . '</a>'
     78                                    . ' | '
     79                                    . '<a href="' . esc_url($view_link) . '" target="_blank" rel="noopener noreferrer">' . esc_html__('View post', 'tradejournal') . '</a>'
     80                                    . '</p></div>';
     81                            } else {
     82                                echo '<div class="notice notice-success is-dismissible"><p>'
     83                                    . esc_html__('Trades imported successfully!', 'tradejournal')
     84                                    . '</p></div>';
     85                            }
    7386                        } else {
    7487                            // Handle invalid file type or path
  • tradejournal/tags/1.2.1/includes/csv-import.php

    r3346660 r3352306  
    55function tjwp_import_trades_from_csv($csv_file)
    66{
     7    $post_id = 0; // default in case import fails
    78    $csv_data = array_map('str_getcsv', file($csv_file));
    89
     
    4950    );
    5051    $post_id = wp_insert_post($post_data);
     52    if (is_wp_error($post_id)) {
     53        $post_id = 0;
     54    }
    5155
    5256    if ($post_id) {
     
    385389        update_post_meta($post_id, 'trade_repeater', $trade_data);
    386390    }
     391    return $post_id;
    387392}
  • tradejournal/tags/1.2.1/readme.txt

    r3346660 r3352306  
    44Requires at least: 5.0
    55Tested up to: 6.8.2
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    8686
    8787== Changelog ==
     88
     89= 1.2.1 =
     90* Admin: After CSV import, show success notice with quick links to Edit post and View post.
     91* Importer: Return created post ID to support admin notice links.
    8892
    8993= 1.2.0 =
  • tradejournal/tags/1.2.1/tradejournal.php

    r3346660 r3352306  
    33Plugin Name: TradeJournal WP
    44Description: TradeJournal WP imports trades from NinjaTrader CSV files, creating detailed journal entries for each trading day. Includes trade management, P&L calculation, responsive tables, lightbox for screenshots, and compatibility with custom post types and block-based themes. Track performance, analyze setups, and organize screenshots easily within WordPress.
    5 Version: 1.2.0
     5Version: 1.2.1
    66Author: Laith Sinawi
    77Author URI: https://sinawiwebdesign.com
  • tradejournal/trunk/includes/admin.php

    r3185259 r3352306  
    6666                        $file_ext = pathinfo($csv_name, PATHINFO_EXTENSION);
    6767                        if ($file_ext === 'csv' && realpath($csv_tmp_name) && file_exists($csv_tmp_name)) {
    68                             // Proceed to import trades
    69                             tjwp_import_trades_from_csv($csv_tmp_name);
     68                            // Proceed to import trades and capture the created post ID
     69                            $post_id = tjwp_import_trades_from_csv($csv_tmp_name);
    7070
    71                             // Output success message
    72                             echo '<p class="success-message">Trades Imported Successfully!</p>';
     71                            // Output success notice with quick links if we have a post ID
     72                            if ($post_id) {
     73                                $edit_link = get_edit_post_link($post_id);
     74                                $view_link = get_permalink($post_id);
     75                                echo '<div class="notice notice-success is-dismissible"><p>'
     76                                    . esc_html__('Trades imported successfully!', 'tradejournal') . ' '
     77                                    . '<a href="' . esc_url($edit_link) . '">' . esc_html__('Edit post', 'tradejournal') . '</a>'
     78                                    . ' | '
     79                                    . '<a href="' . esc_url($view_link) . '" target="_blank" rel="noopener noreferrer">' . esc_html__('View post', 'tradejournal') . '</a>'
     80                                    . '</p></div>';
     81                            } else {
     82                                echo '<div class="notice notice-success is-dismissible"><p>'
     83                                    . esc_html__('Trades imported successfully!', 'tradejournal')
     84                                    . '</p></div>';
     85                            }
    7386                        } else {
    7487                            // Handle invalid file type or path
  • tradejournal/trunk/includes/csv-import.php

    r3346660 r3352306  
    55function tjwp_import_trades_from_csv($csv_file)
    66{
     7    $post_id = 0; // default in case import fails
    78    $csv_data = array_map('str_getcsv', file($csv_file));
    89
     
    4950    );
    5051    $post_id = wp_insert_post($post_data);
     52    if (is_wp_error($post_id)) {
     53        $post_id = 0;
     54    }
    5155
    5256    if ($post_id) {
     
    385389        update_post_meta($post_id, 'trade_repeater', $trade_data);
    386390    }
     391    return $post_id;
    387392}
  • tradejournal/trunk/readme.txt

    r3346660 r3352306  
    44Requires at least: 5.0
    55Tested up to: 6.8.2
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    8686
    8787== Changelog ==
     88
     89= 1.2.1 =
     90* Admin: After CSV import, show success notice with quick links to Edit post and View post.
     91* Importer: Return created post ID to support admin notice links.
    8892
    8993= 1.2.0 =
  • tradejournal/trunk/tradejournal.php

    r3346660 r3352306  
    33Plugin Name: TradeJournal WP
    44Description: TradeJournal WP imports trades from NinjaTrader CSV files, creating detailed journal entries for each trading day. Includes trade management, P&L calculation, responsive tables, lightbox for screenshots, and compatibility with custom post types and block-based themes. Track performance, analyze setups, and organize screenshots easily within WordPress.
    5 Version: 1.2.0
     5Version: 1.2.1
    66Author: Laith Sinawi
    77Author URI: https://sinawiwebdesign.com
Note: See TracChangeset for help on using the changeset viewer.