Changeset 3468416
- Timestamp:
- 02/24/2026 09:07:36 AM (5 weeks ago)
- Location:
- clearpost-simple-ai-auto-post
- Files:
-
- 10 edited
- 1 copied
-
tags/2.0.21 (copied) (copied from clearpost-simple-ai-auto-post/trunk)
-
tags/2.0.21/assets/js/dashboard.js (modified) (5 diffs)
-
tags/2.0.21/includes/dashboard-widget.php (modified) (2 diffs)
-
tags/2.0.21/includes/dashboard.php (modified) (3 diffs)
-
tags/2.0.21/readme.txt (modified) (2 diffs)
-
tags/2.0.21/simple-ai-auto-post.php (modified) (2 diffs)
-
trunk/assets/js/dashboard.js (modified) (5 diffs)
-
trunk/includes/dashboard-widget.php (modified) (2 diffs)
-
trunk/includes/dashboard.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/simple-ai-auto-post.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
clearpost-simple-ai-auto-post/tags/2.0.21/assets/js/dashboard.js
r3467643 r3468416 194 194 updateStatusStepsComplete(); 195 195 196 // Update scheduled count197 updateScheduledCount(items.length);198 199 196 // Clear setup flag so page refresh shows correct state 200 197 clearSetupFlag(); … … 207 204 currentMonth = new Date(); 208 205 renderCalendar(); 206 207 // Update scheduled count (after calendarData is set) 208 updateScheduledCount(); 209 209 210 210 // Track setup completion … … 458 458 * Update the "Posts Scheduled" metric count. 459 459 * 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 }); 466 483 } 467 484 … … 615 632 calendarData = response.data.items || []; 616 633 renderCalendar(); 617 updateScheduledCount( calendarData.length);634 updateScheduledCount(); 618 635 } else { 619 636 // Handle error - might be trial expired or no access 620 637 calendarData = []; 621 638 renderCalendar(); 622 updateScheduledCount( 0);639 updateScheduledCount(); 623 640 624 641 if (response.data && response.data.error_code === 'trial_expired') { … … 876 893 currentMonth = new Date(); 877 894 renderCalendar(); 878 updateScheduledCount( calendarData.length);895 updateScheduledCount(); 879 896 } else { 880 897 hideRegeneratingBanner(); -
clearpost-simple-ai-auto-post/tags/2.0.21/includes/dashboard-widget.php
r3455555 r3468416 111 111 function saiap_widget_active_trial() { 112 112 $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; 114 114 $dashboard_url = admin_url( 'admin.php?page=saiap&tab=dashboard' ); 115 115 … … 179 179 function saiap_widget_paid() { 180 180 $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; 182 182 $dashboard_url = admin_url( 'admin.php?page=saiap&tab=dashboard' ); 183 183 -
clearpost-simple-ai-auto-post/tags/2.0.21/includes/dashboard.php
r3463429 r3468416 208 208 209 209 /** 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 */ 217 function 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 /** 210 223 * Render the dashboard status indicator. 211 224 * … … 371 384 function saiap_render_dashboard_top_row( $variant ) { 372 385 $total_generated = saiap_get_generated_posts_count(); 373 $scheduled_count = wp_count_posts( 'post' )->future;386 $scheduled_count = saiap_get_planned_calendar_items_count(); 374 387 $is_active = in_array( $variant, array( 'trial_active', 'paid' ), true ); 375 388 … … 1193 1206 set_transient( 'saiap_calendar_items_count', count( $body['items'] ), HOUR_IN_SECONDS ); 1194 1207 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 1195 1217 // Enrich calendar items with local WP post IDs. 1196 1218 // 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 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 2.0.2 06 Stable tag: 2.0.21 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later … … 233 233 234 234 == Changelog == 235 236 = 2.0.21 = 237 * Fixed: Posts scheduled count. 235 238 236 239 = 2.0.20 = -
clearpost-simple-ai-auto-post/tags/2.0.21/simple-ai-auto-post.php
r3467819 r3468416 4 4 Description: Your AI Agent for SEO, in WordPress. An AI content marketer that knows your site, then schedules and generates posts every day. 5 5 Plugin URI: https://clearpostplugin.com/ 6 Version: 2.0.2 06 Version: 2.0.21 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 // Define plugin version 20 define( 'SAIAP_VERSION', '2.0.2 0' );20 define( 'SAIAP_VERSION', '2.0.21' ); 21 21 22 22 // Define premium API URL -
clearpost-simple-ai-auto-post/trunk/assets/js/dashboard.js
r3467643 r3468416 194 194 updateStatusStepsComplete(); 195 195 196 // Update scheduled count197 updateScheduledCount(items.length);198 199 196 // Clear setup flag so page refresh shows correct state 200 197 clearSetupFlag(); … … 207 204 currentMonth = new Date(); 208 205 renderCalendar(); 206 207 // Update scheduled count (after calendarData is set) 208 updateScheduledCount(); 209 209 210 210 // Track setup completion … … 458 458 * Update the "Posts Scheduled" metric count. 459 459 * 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 }); 466 483 } 467 484 … … 615 632 calendarData = response.data.items || []; 616 633 renderCalendar(); 617 updateScheduledCount( calendarData.length);634 updateScheduledCount(); 618 635 } else { 619 636 // Handle error - might be trial expired or no access 620 637 calendarData = []; 621 638 renderCalendar(); 622 updateScheduledCount( 0);639 updateScheduledCount(); 623 640 624 641 if (response.data && response.data.error_code === 'trial_expired') { … … 876 893 currentMonth = new Date(); 877 894 renderCalendar(); 878 updateScheduledCount( calendarData.length);895 updateScheduledCount(); 879 896 } else { 880 897 hideRegeneratingBanner(); -
clearpost-simple-ai-auto-post/trunk/includes/dashboard-widget.php
r3455555 r3468416 111 111 function saiap_widget_active_trial() { 112 112 $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; 114 114 $dashboard_url = admin_url( 'admin.php?page=saiap&tab=dashboard' ); 115 115 … … 179 179 function saiap_widget_paid() { 180 180 $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; 182 182 $dashboard_url = admin_url( 'admin.php?page=saiap&tab=dashboard' ); 183 183 -
clearpost-simple-ai-auto-post/trunk/includes/dashboard.php
r3463429 r3468416 208 208 209 209 /** 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 */ 217 function 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 /** 210 223 * Render the dashboard status indicator. 211 224 * … … 371 384 function saiap_render_dashboard_top_row( $variant ) { 372 385 $total_generated = saiap_get_generated_posts_count(); 373 $scheduled_count = wp_count_posts( 'post' )->future;386 $scheduled_count = saiap_get_planned_calendar_items_count(); 374 387 $is_active = in_array( $variant, array( 'trial_active', 'paid' ), true ); 375 388 … … 1193 1206 set_transient( 'saiap_calendar_items_count', count( $body['items'] ), HOUR_IN_SECONDS ); 1194 1207 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 1195 1217 // Enrich calendar items with local WP post IDs. 1196 1218 // Look up WP posts that have matching _saiap_calendar_item_id meta. -
clearpost-simple-ai-auto-post/trunk/readme.txt
r3467819 r3468416 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 2.0.2 06 Stable tag: 2.0.21 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later … … 233 233 234 234 == Changelog == 235 236 = 2.0.21 = 237 * Fixed: Posts scheduled count. 235 238 236 239 = 2.0.20 = -
clearpost-simple-ai-auto-post/trunk/simple-ai-auto-post.php
r3467819 r3468416 4 4 Description: Your AI Agent for SEO, in WordPress. An AI content marketer that knows your site, then schedules and generates posts every day. 5 5 Plugin URI: https://clearpostplugin.com/ 6 Version: 2.0.2 06 Version: 2.0.21 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 // Define plugin version 20 define( 'SAIAP_VERSION', '2.0.2 0' );20 define( 'SAIAP_VERSION', '2.0.21' ); 21 21 22 22 // Define premium API URL
Note: See TracChangeset
for help on using the changeset viewer.