@@ -58,39 +58,12 @@ private static function is_site_created_within_last_9_months(): bool {
58
58
return $ install_date_timestamp >= $ nine_months_ago ;
59
59
}
60
60
61
- /**
62
- * Checks if the request is a page refresh/reload.
63
- *
64
- * @return bool True if the page is a page refresh, false otherwise.
65
- */
66
- private static function is_page_refresh (): bool {
67
- if ( isset ( $ _SERVER ['HTTP_CACHE_CONTROL ' ] ) && 'max-age=0 ' === $ _SERVER ['HTTP_CACHE_CONTROL ' ] ) {
68
- return true ;
69
- }
70
-
71
- if ( ! isset ( $ _SERVER ['HTTP_REFERER ' ] ) ) {
72
- return true ;
73
- }
74
-
75
- $ referer = wp_parse_url ( $ _SERVER ['HTTP_REFERER ' ] );
76
- if ( isset ( $ referer ['query ' ] ) && strpos ( $ referer ['query ' ], 'page=nfd-onboarding ' ) !== false ) {
77
- return true ;
78
- }
79
-
80
- return false ;
81
- }
82
-
83
61
/**
84
62
* Checks if the user is eligible to restart onboarding based on brand configuration and AI SiteGen capability.
85
63
*
86
64
* @return bool True if eligible, false otherwise.
87
65
*/
88
66
public static function is_onboarding_restart_eligible (): bool {
89
- // If request is a page refresh, we either installing the theme or a user-invoked page refresh
90
- if ( self ::is_page_refresh () ) {
91
- return false ;
92
- }
93
-
94
67
// Check if the brand is eligible for Restarting Onboarding
95
68
$ brand_config = Brands::get_brands ()[ NFD_ONBOARDING_PLUGIN_BRAND ]['config ' ] ?? array ();
96
69
if ( empty ( $ brand_config ['canRestartOnboarding ' ] ) || ! $ brand_config ['canRestartOnboarding ' ] ) {
@@ -111,6 +84,9 @@ public static function is_onboarding_restart_eligible(): bool {
111
84
* @return void
112
85
*/
113
86
public static function update_onboarding_restart_status (): void {
87
+ if ( isset ( $ _GET ['page ' ] ) && \sanitize_text_field ( wp_unslash ( $ _GET ['page ' ] ) ) === 'nfd-onboarding ' ) {
88
+ return ;
89
+ }
114
90
115
91
// Don't do anything if the customer is not eligible
116
92
if ( ! self ::is_onboarding_restart_eligible () ) {
0 commit comments