PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
← All changes | includes/core/rest-api/Controllers/DashboardController.php +38 -0 3.13.1 → 3.13.3 View file →
@@ -16,8 +16,19 @@
16 16 class DashboardController extends Wpfnl_REST_Controller
17 17 {
18 18
19 19 /**
20 + * Transient holding the last known answer to "is the onboarding checklist
21 + * on show?", read by the admin page so it can decide whether to hold space
22 + * for it while the real status loads.
23 + *
24 + * @var string
25 + * @since 3.13.3
26 + */
27 + const ONBOARDING_VISIBILITY_KEY = 'wpfnl_onboarding_should_show';
28 +
29 +
30 + /**
20 31 * Endpoint namespace.
21 32 *
22 33 * @var string
23 34 * @since 3.2.0
@@ -299,8 +310,31 @@
299 310 }
300 311
301 312
302 313 /**
314 + * Remember whether the checklist was on show, for the next page load.
315 + *
316 + * Working this out costs several queries, so the admin page cannot ask
317 + * before it prints — but it can read the last answer. The React dashboard
318 + * uses it for one thing: whether to hold space for the checklist while the
319 + * real status loads. Someone who is done with onboarding then sees no
320 + * placeholder at all, instead of a skeleton that resolves to nothing.
321 + *
322 + * Short lived on purpose: it only has to outlive the gap between one page
323 + * load and the next, and a stale answer costs at most one wrong placeholder.
324 + *
325 + * @param bool $is_visible Whether the checklist is on show.
326 + *
327 + * @return void
328 + * @since 3.13.3
329 + */
330 + private function remember_onboarding_visibility( $is_visible )
331 + {
332 + set_transient( self::ONBOARDING_VISIBILITY_KEY, $is_visible ? 'yes' : 'no', 15 * MINUTE_IN_SECONDS );
333 + }
334 +
335 +
336 + /**
303 337 * Get onboarding status.
304 338 *
305 339 * Determines whether the onboarding section should be shown on the dashboard.
306 340 * The onboarding is hidden when ALL three conditions are met:
@@ -317,8 +351,10 @@
317 351 {
318 352 // ── Check if onboarding has been dismissed ──
319 353 $is_dismissed = get_transient( 'wpfnl_onboarding_dismissed' );
320 354 if ( $is_dismissed ) {
355 + $this->remember_onboarding_visibility( false );
356 +
321 357 return rest_ensure_response( array(
322 358 'success' => true,
323 359 'show_onboarding' => false,
324 360 'steps' => array(),
@@ -532,8 +568,10 @@
532 568 }
533 569
534 570 $total_steps = count($steps_status);
535 571 $progress_percent = $total_steps > 0 ? round(($completed_count / $total_steps) * 100) : 0;
572 +
573 + $this->remember_onboarding_visibility( !$should_hide_onboarding );
536 574
537 575 return rest_ensure_response(array(
538 576 'success' => true,
539 577 'show_onboarding' => !$should_hide_onboarding,