Plugin Directory

Changeset 3468416


Ignore:
Timestamp:
02/24/2026 09:07:36 AM (5 weeks ago)
Author:
purposego
Message:

Release 2.0.21

Location:
clearpost-simple-ai-auto-post
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • clearpost-simple-ai-auto-post/tags/2.0.21/assets/js/dashboard.js

    r3467643 r3468416  
    194194    updateStatusStepsComplete();
    195195
    196     // Update scheduled count
    197     updateScheduledCount(items.length);
    198 
    199196    // Clear setup flag so page refresh shows correct state
    200197    clearSetupFlag();
     
    207204    currentMonth = new Date();
    208205    renderCalendar();
     206
     207    // Update scheduled count (after calendarData is set)
     208    updateScheduledCount();
    209209
    210210    // Track setup completion
     
    458458   * Update the "Posts Scheduled" metric count.
    459459   *
    460    * Note: This is intentionally a no-op. The PHP renders the correct total
    461    * using wp_count_posts('post')->future, which counts ALL scheduled WP posts.
    462    * Previously this overwrote it with calendarData.length (current view only).
    463    */
    464   function updateScheduledCount(count) {
    465     // No-op: PHP already renders the correct total count
     460   * Counts planned calendar items (not yet generated) and updates the metric display.
     461   * Called after calendar data is loaded to ensure the count reflects actual scheduled items.
     462   */
     463  function updateScheduledCount() {
     464    // Count planned items (items that are scheduled but not yet generated)
     465    var plannedCount = 0;
     466    if (calendarData && calendarData.length) {
     467      calendarData.forEach(function(item) {
     468        if (item.status === 'planned') {
     469          plannedCount++;
     470        }
     471      });
     472    }
     473
     474    // Update the "Posts Scheduled" metric card value
     475    var $metricCards = $('.saiap-metric-card');
     476    $metricCards.each(function() {
     477      var $card = $(this);
     478      var labelText = $card.find('.saiap-metric-card__label').text().toLowerCase();
     479      if (labelText.indexOf('scheduled') !== -1) {
     480        $card.find('.saiap-metric-card__value').text(plannedCount);
     481      }
     482    });
    466483  }
    467484
     
    615632          calendarData = response.data.items || [];
    616633          renderCalendar();
    617           updateScheduledCount(calendarData.length);
     634          updateScheduledCount();
    618635        } else {
    619636          // Handle error - might be trial expired or no access
    620637          calendarData = [];
    621638          renderCalendar();
    622           updateScheduledCount(0);
     639          updateScheduledCount();
    623640
    624641          if (response.data && response.data.error_code === 'trial_expired') {
     
    876893          currentMonth = new Date();
    877894          renderCalendar();
    878           updateScheduledCount(calendarData.length);
     895          updateScheduledCount();
    879896        } else {
    880897          hideRegeneratingBanner();
  • clearpost-simple-ai-auto-post/tags/2.0.21/includes/dashboard-widget.php

    r3455555 r3468416  
    111111function saiap_widget_active_trial() {
    112112    $total_generated = function_exists( 'saiap_get_generated_posts_count' ) ? saiap_get_generated_posts_count() : 0;
    113     $scheduled       = function_exists( 'saiap_get_calendar_items_count' ) ? saiap_get_calendar_items_count() : 0;
     113    $scheduled       = function_exists( 'saiap_get_planned_calendar_items_count' ) ? saiap_get_planned_calendar_items_count() : 0;
    114114    $dashboard_url   = admin_url( 'admin.php?page=saiap&tab=dashboard' );
    115115
     
    179179function saiap_widget_paid() {
    180180    $total_generated = function_exists( 'saiap_get_generated_posts_count' ) ? saiap_get_generated_posts_count() : 0;
    181     $scheduled       = function_exists( 'saiap_get_calendar_items_count' ) ? saiap_get_calendar_items_count() : 0;
     181    $scheduled       = function_exists( 'saiap_get_planned_calendar_items_count' ) ? saiap_get_planned_calendar_items_count() : 0;
    182182    $dashboard_url   = admin_url( 'admin.php?page=saiap&tab=dashboard' );
    183183
  • clearpost-simple-ai-auto-post/tags/2.0.21/includes/dashboard.php

    r3463429 r3468416  
    208208
    209209/**
     210 * Get the cached count of planned/scheduled calendar items.
     211 *
     212 * Returns the count of calendar items in 'planned' status (not yet generated).
     213 * The cache is populated when calendar items are fetched via AJAX.
     214 *
     215 * @return int The number of planned calendar items, or 0 if not cached.
     216 */
     217function saiap_get_planned_calendar_items_count() {
     218    $count = get_transient( 'saiap_planned_calendar_items_count' );
     219    return false !== $count ? (int) $count : 0;
     220}
     221
     222/**
    210223 * Render the dashboard status indicator.
    211224 *
     
    371384function saiap_render_dashboard_top_row( $variant ) {
    372385    $total_generated = saiap_get_generated_posts_count();
    373     $scheduled_count = wp_count_posts( 'post' )->future;
     386    $scheduled_count = saiap_get_planned_calendar_items_count();
    374387    $is_active       = in_array( $variant, array( 'trial_active', 'paid' ), true );
    375388
     
    11931206        set_transient( 'saiap_calendar_items_count', count( $body['items'] ), HOUR_IN_SECONDS );
    11941207
     1208        // Count planned items (scheduled but not yet generated).
     1209        $planned_count = 0;
     1210        foreach ( $body['items'] as $item ) {
     1211            if ( isset( $item['status'] ) && 'planned' === $item['status'] ) {
     1212                ++$planned_count;
     1213            }
     1214        }
     1215        set_transient( 'saiap_planned_calendar_items_count', $planned_count, HOUR_IN_SECONDS );
     1216
    11951217        // Enrich calendar items with local WP post IDs.
    11961218        // Look up WP posts that have matching _saiap_calendar_item_id meta.
  • clearpost-simple-ai-auto-post/tags/2.0.21/readme.txt

    r3467819 r3468416  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 2.0.20
     6Stable tag: 2.0.21
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    233233
    234234== Changelog ==
     235
     236= 2.0.21 =
     237* Fixed: Posts scheduled count.
    235238
    236239= 2.0.20 =
  • clearpost-simple-ai-auto-post/tags/2.0.21/simple-ai-auto-post.php

    r3467819 r3468416  
    44Description: Your AI Agent for SEO, in WordPress. An AI content marketer that knows your site, then schedules and generates posts every day.
    55Plugin URI: https://clearpostplugin.com/
    6 Version: 2.0.20
     6Version: 2.0.21
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1818
    1919// Define plugin version
    20 define( 'SAIAP_VERSION', '2.0.20' );
     20define( 'SAIAP_VERSION', '2.0.21' );
    2121
    2222// Define premium API URL
  • clearpost-simple-ai-auto-post/trunk/assets/js/dashboard.js

    r3467643 r3468416  
    194194    updateStatusStepsComplete();
    195195
    196     // Update scheduled count
    197     updateScheduledCount(items.length);
    198 
    199196    // Clear setup flag so page refresh shows correct state
    200197    clearSetupFlag();
     
    207204    currentMonth = new Date();
    208205    renderCalendar();
     206
     207    // Update scheduled count (after calendarData is set)
     208    updateScheduledCount();
    209209
    210210    // Track setup completion
     
    458458   * Update the "Posts Scheduled" metric count.
    459459   *
    460    * Note: This is intentionally a no-op. The PHP renders the correct total
    461    * using wp_count_posts('post')->future, which counts ALL scheduled WP posts.
    462    * Previously this overwrote it with calendarData.length (current view only).
    463    */
    464   function updateScheduledCount(count) {
    465     // No-op: PHP already renders the correct total count
     460   * Counts planned calendar items (not yet generated) and updates the metric display.
     461   * Called after calendar data is loaded to ensure the count reflects actual scheduled items.
     462   */
     463  function updateScheduledCount() {
     464    // Count planned items (items that are scheduled but not yet generated)
     465    var plannedCount = 0;
     466    if (calendarData && calendarData.length) {
     467      calendarData.forEach(function(item) {
     468        if (item.status === 'planned') {
     469          plannedCount++;
     470        }
     471      });
     472    }
     473
     474    // Update the "Posts Scheduled" metric card value
     475    var $metricCards = $('.saiap-metric-card');
     476    $metricCards.each(function() {
     477      var $card = $(this);
     478      var labelText = $card.find('.saiap-metric-card__label').text().toLowerCase();
     479      if (labelText.indexOf('scheduled') !== -1) {
     480        $card.find('.saiap-metric-card__value').text(plannedCount);
     481      }
     482    });
    466483  }
    467484
     
    615632          calendarData = response.data.items || [];
    616633          renderCalendar();
    617           updateScheduledCount(calendarData.length);
     634          updateScheduledCount();
    618635        } else {
    619636          // Handle error - might be trial expired or no access
    620637          calendarData = [];
    621638          renderCalendar();
    622           updateScheduledCount(0);
     639          updateScheduledCount();
    623640
    624641          if (response.data && response.data.error_code === 'trial_expired') {
     
    876893          currentMonth = new Date();
    877894          renderCalendar();
    878           updateScheduledCount(calendarData.length);
     895          updateScheduledCount();
    879896        } else {
    880897          hideRegeneratingBanner();
  • clearpost-simple-ai-auto-post/trunk/includes/dashboard-widget.php

    r3455555 r3468416  
    111111function saiap_widget_active_trial() {
    112112    $total_generated = function_exists( 'saiap_get_generated_posts_count' ) ? saiap_get_generated_posts_count() : 0;
    113     $scheduled       = function_exists( 'saiap_get_calendar_items_count' ) ? saiap_get_calendar_items_count() : 0;
     113    $scheduled       = function_exists( 'saiap_get_planned_calendar_items_count' ) ? saiap_get_planned_calendar_items_count() : 0;
    114114    $dashboard_url   = admin_url( 'admin.php?page=saiap&tab=dashboard' );
    115115
     
    179179function saiap_widget_paid() {
    180180    $total_generated = function_exists( 'saiap_get_generated_posts_count' ) ? saiap_get_generated_posts_count() : 0;
    181     $scheduled       = function_exists( 'saiap_get_calendar_items_count' ) ? saiap_get_calendar_items_count() : 0;
     181    $scheduled       = function_exists( 'saiap_get_planned_calendar_items_count' ) ? saiap_get_planned_calendar_items_count() : 0;
    182182    $dashboard_url   = admin_url( 'admin.php?page=saiap&tab=dashboard' );
    183183
  • clearpost-simple-ai-auto-post/trunk/includes/dashboard.php

    r3463429 r3468416  
    208208
    209209/**
     210 * Get the cached count of planned/scheduled calendar items.
     211 *
     212 * Returns the count of calendar items in 'planned' status (not yet generated).
     213 * The cache is populated when calendar items are fetched via AJAX.
     214 *
     215 * @return int The number of planned calendar items, or 0 if not cached.
     216 */
     217function saiap_get_planned_calendar_items_count() {
     218    $count = get_transient( 'saiap_planned_calendar_items_count' );
     219    return false !== $count ? (int) $count : 0;
     220}
     221
     222/**
    210223 * Render the dashboard status indicator.
    211224 *
     
    371384function saiap_render_dashboard_top_row( $variant ) {
    372385    $total_generated = saiap_get_generated_posts_count();
    373     $scheduled_count = wp_count_posts( 'post' )->future;
     386    $scheduled_count = saiap_get_planned_calendar_items_count();
    374387    $is_active       = in_array( $variant, array( 'trial_active', 'paid' ), true );
    375388
     
    11931206        set_transient( 'saiap_calendar_items_count', count( $body['items'] ), HOUR_IN_SECONDS );
    11941207
     1208        // Count planned items (scheduled but not yet generated).
     1209        $planned_count = 0;
     1210        foreach ( $body['items'] as $item ) {
     1211            if ( isset( $item['status'] ) && 'planned' === $item['status'] ) {
     1212                ++$planned_count;
     1213            }
     1214        }
     1215        set_transient( 'saiap_planned_calendar_items_count', $planned_count, HOUR_IN_SECONDS );
     1216
    11951217        // Enrich calendar items with local WP post IDs.
    11961218        // Look up WP posts that have matching _saiap_calendar_item_id meta.
  • clearpost-simple-ai-auto-post/trunk/readme.txt

    r3467819 r3468416  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 2.0.20
     6Stable tag: 2.0.21
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    233233
    234234== Changelog ==
     235
     236= 2.0.21 =
     237* Fixed: Posts scheduled count.
    235238
    236239= 2.0.20 =
  • clearpost-simple-ai-auto-post/trunk/simple-ai-auto-post.php

    r3467819 r3468416  
    44Description: Your AI Agent for SEO, in WordPress. An AI content marketer that knows your site, then schedules and generates posts every day.
    55Plugin URI: https://clearpostplugin.com/
    6 Version: 2.0.20
     6Version: 2.0.21
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1818
    1919// Define plugin version
    20 define( 'SAIAP_VERSION', '2.0.20' );
     20define( 'SAIAP_VERSION', '2.0.21' );
    2121
    2222// Define premium API URL
Note: See TracChangeset for help on using the changeset viewer.