Plugin Directory

Changeset 3255135


Ignore:
Timestamp:
03/13/2025 05:31:32 AM (13 months ago)
Author:
writetextai
Message:

updating visibility of accept terms

Location:
writetext-ai
Files:
227 added
10 edited

Legend:

Unmodified
Added
Removed
  • writetext-ai/trunk/CHANGELOG.md

    r3250758 r3255135  
    99The format is based on [Keep a Changelog](http://keepachangelog.com/)
    1010and this project adheres to [Semantic Versioning](http://semver.org/).
     11
     12## [2.0.2] - 2025-03-13
     13
     14### Fixed
     15
     16- Resolved issue with All In One SEO not displaying the generated meta title, description, and OG description on the WC product edit page.
     17- Fix issue with wtai_bulk_product_ids param from failed bulk email notification.
     18
     19### Changed
     20
     21- Displayed the terms and conditions notice on the initial page load in case it hasn't been accepted by the user yet, so they can see it right away before using WriteText.ai.
    1122
    1223## [2.0.1] - 2025-03-05
     
    2132- Introduced a quick feedback button to allow users to easily provide input on generated content.
    2233- Improved pagination to simplify navigation and management of extensive product inventories.
     34- Highlight keywords for alt text image
    2335
    2436### Changed
  • writetext-ai/trunk/assets/js/admin-common.js

    r3250758 r3255135  
    22/* jshint -W117 */
    33
    4 console.log('WriteText.ai - Version: [2.0.1] - 2025-03-05 - 1');
     4console.log('WriteText.ai - Version: [2.0.2] - 2025-03-13 - 1');
    55
    66jQuery( document ).ready( function( $ ){
  • writetext-ai/trunk/assets/js/admin-installed.js

    r3250758 r3255135  
    1006910069            data: data,
    1007010070            success: function (data) {
     10071                if( data.credit_error != '' ){
     10072                    setTimeout(() => {
     10073                        if ($('.wtai-table-list-wrapper').find('.wtai-terms-notice-message-notice').length > 0) {
     10074                            $('.wtai-table-list-wrapper').find('.wtai-terms-notice-message-notice').remove();
     10075                        }
     10076                        $('<div class="wtai-terms-notice-message-notice error notice is-dismissible"><p>' + data.credit_error + ' </p></div>').insertAfter($('.wtai-table-list-wrapper').find('.wtai-title-header'));
     10077       
     10078                        $(window).trigger('resize');
     10079                    }, 1000);
     10080                }
     10081
    1007110082                if (data.html != '') {
    1007210083                    displayLoaderNotif(data.html, data.jobs_user_ids, data.job_loader_data, data.has_error);
  • writetext-ai/trunk/includes/class-wtai-global-settings.php

    r3250758 r3255135  
    7676                return;
    7777            }
     78        }
     79
     80        if ( defined( 'WTAI_CREDIT_ACCOUNT_DETAILS' ) && WTAI_CREDIT_ACCOUNT_DETAILS['not_accepted_terms'] ) {
     81            ?>
     82            <div class="wtai-terms-notice-message-notice notice notice-error" >
     83                <p><?php echo wp_kses( WTAI_CREDIT_ACCOUNT_DETAILS['accepted_terms_notice'], wtai_kses_allowed_html() ); ?></p>
     84            </div>
     85            <?php
     86
     87            return;
    7888        }
    7989
  • writetext-ai/trunk/includes/class-wtai-product-category.php

    r3250758 r3255135  
    468468            $latest_version_message = get_option( 'wtai_latest_version_message' );
    469469            ?>
    470             <div class="wtai-update-notice notice notice-error is-dismissible" >
     470            <style type="text/css">
     471                #screen-meta-links{
     472                    display: none!important;
     473                }
     474            </style>
     475            <div class="wtai-update-notice notice notice-error" >
    471476                <p><?php echo wp_kses( $latest_version_message, wtai_kses_allowed_html() ); ?></p>
     477            </div>
     478            <?php
     479
     480            return;
     481        }
     482
     483        if ( defined( 'WTAI_CREDIT_ACCOUNT_DETAILS' ) && WTAI_CREDIT_ACCOUNT_DETAILS['not_accepted_terms'] ) {
     484            ?>
     485            <style type="text/css">
     486                #screen-meta-links{
     487                    display: none!important;
     488                }
     489            </style>
     490            <div class="wtai-terms-notice-message-notice notice notice-error" >
     491                <p><?php echo wp_kses( WTAI_CREDIT_ACCOUNT_DETAILS['accepted_terms_notice'], wtai_kses_allowed_html() ); ?></p>
    472492            </div>
    473493            <?php
     
    15741594                $account_credit_details = wtai_get_account_credit_details( true );
    15751595                $is_premium             = $account_credit_details['is_premium'];
    1576                 $available_credit_count = $credit_account_details['available_credits'];
     1596                $available_credit_count = $account_credit_details['available_credits'];
     1597                $credit_error           = $account_credit_details['error'];
    15771598
    15781599                $is_premium             = $is_premium ? '1' : '0';
     
    15891610
    15901611                        $doing_bulk_generation = isset( $_POST['doingBulkGeneration'] ) ? sanitize_text_field( wp_unslash( $_POST['doingBulkGeneration'] ) ) : '0'; // phpcs:ignore WordPress.Security.NonceVerification
     1612
     1613                        if ( '' !== $credit_error ) { // phpcs:ignore WordPress.Security.NonceVerification
     1614                            echo wp_json_encode(
     1615                                array(
     1616                                    'results'     => null,
     1617                                    'access'      => $access,
     1618                                    /* translators: %s: Premium url */
     1619                                    'message'     => $credit_error,
     1620                                    'is_premium'  => $is_premium,
     1621                                    'api_results' => array(),
     1622                                )
     1623                            );
     1624                            exit;
     1625                        }
    15911626
    15921627                        if ( 0 === intval( $is_premium ) &&
  • writetext-ai/trunk/includes/class-wtai-product-dashboard.php

    r3250758 r3255135  
    167167        // Attach bulk generate in heartbeat for performance.
    168168        add_filter( 'heartbeat_send', array( $this, 'bulk_handle_heartbeat_send' ), 10, 2 );
     169
     170        // Attach bulk generate in heartbeat for performance.
     171        add_filter( 'aioseo_get_post', array( $this, 'handling_for_aioseo_get_post' ), 10, 1 );
    169172    }
    170173
     
    704707            $latest_version_message = get_option( 'wtai_latest_version_message' );
    705708            ?>
    706             <div class="wtai-update-notice notice notice-error is-dismissible" >
     709            <style type="text/css">
     710                #screen-meta-links{
     711                    display: none!important;
     712                }
     713            </style>
     714            <div class="wtai-update-notice notice notice-error" >
    707715                <p><?php echo wp_kses( $latest_version_message, wtai_kses_allowed_html() ); ?></p>
     716            </div>
     717            <?php
     718
     719            return;
     720        }
     721
     722        if ( defined( 'WTAI_CREDIT_ACCOUNT_DETAILS' ) && WTAI_CREDIT_ACCOUNT_DETAILS['not_accepted_terms'] ) {
     723            ?>
     724            <style type="text/css">
     725                #screen-meta-links{
     726                    display: none!important;
     727                }
     728            </style>
     729            <div class="wtai-terms-notice-message-notice notice notice-error" >
     730                <p><?php echo wp_kses( WTAI_CREDIT_ACCOUNT_DETAILS['accepted_terms_notice'], wtai_kses_allowed_html() ); ?></p>
    708731            </div>
    709732            <?php
     
    48554878                $account_credit_details = wtai_get_account_credit_details( true );
    48564879                $is_premium             = $account_credit_details['is_premium'];
    4857                 $available_credit_count = $credit_account_details['available_credits'];
     4880                $available_credit_count = $account_credit_details['available_credits'];
     4881                $credit_error           = $account_credit_details['error'];
    48584882
    48594883                $is_premium             = $is_premium ? '1' : '0';
     
    48724896
    48734897                        $doing_bulk_generation = isset( $_POST['doingBulkGeneration'] ) ? sanitize_text_field( wp_unslash( $_POST['doingBulkGeneration'] ) ) : '0'; // phpcs:ignore WordPress.Security.NonceVerification
     4898
     4899                        if ( '' !== $credit_error ) { // phpcs:ignore WordPress.Security.NonceVerification
     4900                            echo wp_json_encode(
     4901                                array(
     4902                                    'results'     => null,
     4903                                    'access'      => $access,
     4904                                    /* translators: %s: Premium url */
     4905                                    'message'     => $credit_error,
     4906                                    'is_premium'  => $is_premium,
     4907                                    'api_results' => array(),
     4908                                )
     4909                            );
     4910                            exit;
     4911                        }
    48744912
    48754913                        if ( 0 === intval( $is_premium ) &&
     
    58175855                            $last_activity = ( 'bulk_transfer' === $submittype ) ? 'transfer' : 'edit';
    58185856                            wtai_record_product_last_activity( $product_id, $last_activity );
     5857
     5858                            // Sync to all in one seo pack meta fields if it exists.
     5859                            $source = get_option( 'wtai_installation_source', '' );
     5860                            if ( 'all-in-one-seo-pack' === $source || 'all-in-one-seo-pack-pro' === $source ) {
     5861                                // Get all in one seo pack meta fields.
     5862                                wtai_sync_meta_to_all_in_one_seo_pack( $product_id );
     5863                            }
    58195864                        } elseif ( ! $api_results ) {
    58205865                            $publish_type_message = __( 'No record found yet for the text fields. Please generate text first before saving.', 'writetext-ai' );
     
    62376282        $account_credit_details = wtai_get_account_credit_details( true );
    62386283        $is_premium             = $account_credit_details['is_premium'];
    6239         $available_credit_count = $credit_account_details['available_credits'];
     6284        $available_credit_count = $account_credit_details['available_credits'];
     6285        $credit_error           = $account_credit_details['error'];
    62406286        $available_credit_label = wtai_get_available_credit_label( $available_credit_count );
    62416287
     
    62616307                'transfer_pending_ids'     => $transfer_pending_ids,
    62626308                'transfer_data'            => $transfer_data,
     6309                'credit_error'             => $credit_error,
    62636310            )
    62646311        );
     
    69456992        return $response;
    69466993    }
     6994
     6995    /**
     6996     * Handling for aioseo_get_post.
     6997     *
     6998     * @param object $post Post object.
     6999     * @return object Post object.
     7000     */
     7001    public function handling_for_aioseo_get_post( $post ) {
     7002        $post_id = $post->post_id;
     7003
     7004        // Check if the post is a product.
     7005        $post_type = get_post_type( $post_id );
     7006        if ( 'product' !== $post_type ) {
     7007            return $post;
     7008        } else {
     7009            $key_title       = wtai_get_meta_key_source( 'title' );
     7010            $key_description = wtai_get_meta_key_source( 'desc' );
     7011            $key_open_graph  = wtai_get_meta_key_source( 'opengraph' );
     7012
     7013            $page_title       = get_post_meta( $post_id, $key_title, true );
     7014            $page_description = get_post_meta( $post_id, $key_description, true );
     7015            $open_graph       = get_post_meta( $post_id, $key_open_graph, true );
     7016
     7017            if ( $page_title ) {
     7018                $post->title         = $page_title;
     7019                $post->og_title      = $page_title;
     7020                $post->twitter_title = $page_title;
     7021            }
     7022
     7023            if ( $page_description ) {
     7024                $post->description         = $page_description;
     7025                $post->og_description      = $page_description;
     7026                $post->twitter_description = $page_description;
     7027            }
     7028
     7029            if ( $open_graph ) {
     7030                $post->og_description      = $open_graph;
     7031                $post->twitter_description = $open_graph;
     7032            }
     7033        }
     7034
     7035        return $post;
     7036    }
    69477037}
    69487038global $wtai_product_dashboard;
  • writetext-ai/trunk/includes/class-wtai-product-list-table.php

    r3250758 r3255135  
    671671
    672672            // Check if 'post__in' is already set in $args.
    673             if ( $bulk_product_ids ) {
     673            if ( $bulk_product_ids && is_array( $args['post__in'] ) ) {
    674674                $args['post__in'] = array_intersect( $args['post__in'], $bulk_product_ids );
    675675            } else {
     
    753753                        }
    754754                    }
    755                 }
    756 
    757                 // phpcs:ignore WordPress.Security.NonceVerification
    758                 if ( isset( $_GET['wtai_grid_filter_debug'] ) ) {
    759                     print_r( $api_results ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions
    760                     print '</pre>';
    761755                }
    762756            }
  • writetext-ai/trunk/includes/functions.php

    r3250758 r3255135  
    51635163            'free_premium_credits'         => false,
    51645164            'free_credits_already_premium' => false,
     5165            'not_accepted_terms'           => false,
     5166            'accepted_terms_notice'        => '',
     5167            'error'                        => '',
    51655168        );
    51665169        if ( 200 === intval( $content['http_header'] ) ) {
     
    51825185                $result['free_credits_already_premium'] = true;
    51835186            }
     5187        } elseif ( 400 === intval( $content['http_header'] ) ) {
     5188            $content = json_decode( $content['result'], true );
     5189
     5190            if ( intval( $content['code'] ) === 21 ) {
     5191                $result['not_accepted_terms']    = true;
     5192                $result['accepted_terms_notice'] = $content['error'];
     5193            }
     5194
     5195            $result['error'] = $content['error'];
    51845196        }
    51855197
     
    81098121    return $meta_key;
    81108122}
     8123
     8124/**
     8125 * Sync meta to All in One SEO Pack.
     8126 *
     8127 * @param int $product_id Product ID.
     8128 */
     8129function wtai_sync_meta_to_all_in_one_seo_pack( $product_id = 0 ) {
     8130    if ( ! $product_id ) {
     8131        return;
     8132    }
     8133
     8134    if ( ! function_exists( 'aioseo' ) ) {
     8135        return;
     8136    }
     8137
     8138    $product_post = AIOSEO\Plugin\Common\Models\Post::getPost( $product_id );
     8139
     8140    if ( ! $product_post ) {
     8141        return;
     8142    }
     8143
     8144    $fields      = array( 'page_title', 'page_description', 'open_graph' );
     8145    $meta_values = wtai_get_meta_values( $product_id, $fields );
     8146
     8147    foreach ( $meta_values as $field_name => $field_value ) {
     8148        if ( 'page_title' === $field_name ) {
     8149            $product_post->title         = $field_value;
     8150            $product_post->og_title      = $field_value;
     8151            $product_post->twitter_title = $field_value;
     8152        }
     8153
     8154        if ( 'page_description' === $field_name ) {
     8155            $product_post->description = $field_value;
     8156        }
     8157
     8158        if ( 'open_graph' === $field_name ) {
     8159            $product_post->og_description      = $field_value;
     8160            $product_post->twitter_description = $field_value;
     8161        }
     8162    }
     8163
     8164    $product_post = apply_filters( 'aioseo_save_post', $product_post );
     8165
     8166    $product_post->save();
     8167    $product_post->reset();
     8168}
  • writetext-ai/trunk/readme.txt

    r3250758 r3255135  
    55Requires at least: 6.0
    66Tested up to: 6.7
    7 Stable tag: 2.0.1
     7Stable tag: 2.0.2
    88Requires PHP: 7.4
    99License: GPLv3 or later
     
    166166== Changelog ==
    167167
     168= 2.0.2 2025-03-13 =
     169
     170* Fix - Resolved issue with All In One SEO not displaying the generated meta title, description, and OG description on the WC product edit page.
     171* Fix - Fix issue with wtai_bulk_product_ids param from failed bulk email notification.
     172* Update - Displayed the terms and conditions notice on the initial page load in case it hasn't been accepted by the user yet, so they can see it right away before using WriteText.ai.
     173
    168174= 2.0.1 2025-03-05 =
    169175
     
    175181* Add - Introduced a quick feedback button to allow users to easily provide input on generated content.
    176182* Add - Improved pagination to simplify navigation and management of extensive product inventories.
     183* Add - Highlight keywords for alt text image
    177184* Update - Updated the bulk generate pop-up with a tabbed settings interface for better usability.
    178185* Update - Updated the conditions for using reference products, expanding selection options to include all products in the catalog.
     
    395402== Upgrade Notice ==
    396403
    397 = 2.0.1 =
     404= 2.0.2 =
    398405
    399406Please upgrade, to ensure all plugin features works as expected.
  • writetext-ai/trunk/writetext-ai.php

    r3250758 r3255135  
    44 * Plugin URI: https://writetext.ai/woocommerce
    55 * Description: Let AI automatically generate product descriptions and other content from your product data.
    6  * Version: 2.0.1
     6 * Version: 2.0.2
    77 * Author:  1902 Software
    88 * Author URI: https://writetext.ai/
     
    5656
    5757    if ( ! defined( 'WTAI_VERSION' ) ) {
    58         define( 'WTAI_VERSION', '2.0.1' );
     58        define( 'WTAI_VERSION', '2.0.2' );
    5959    }
    6060
Note: See TracChangeset for help on using the changeset viewer.