| @@ -23,13 +23,17 @@ | ||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Returns the current state of the onboarding process |
| 27 | - * [ | |
| 28 | - * 'completed' => When the onboarding is completed, the user can start using the plugin | |
| 29 | - * 'authenticated' => The plugin is authenticated with the Metricool API | |
| 30 | - * 'blog_id_selected' => The plugin has stored the blog id and can retrieve the necessary information from the Metricool API | |
| 31 | - * ] | |
| 27 | + * | |
| 28 | + * [ | |
| 29 | + * // the onboarding is completed, the user can start using the plugin | |
| 30 | + * 'completed' => true, | |
| 31 | + * // the plugin is authenticated with the Metricool API | |
| 32 | + * 'authenticated' => true, | |
| 33 | + * // submit a blog_id when false | |
| 34 | + * 'blog_id_selected' => true | |
| 35 | + * ] | |
| 32 | 36 | */ |
| 33 | 37 | public function state(): array |
| 34 | 38 | { |
| 35 | 39 | return [ |
| @@ -40,12 +44,15 @@ | ||
| 40 | 44 | } |
| 41 | 45 | |
| 42 | 46 | /** |
| 43 | 47 | * Returns the current mode of the onboarding process |
| 44 | - * [ | |
| 45 | - * 'show_welcome_screen' => The welcome screen should be shown | |
| 46 | - * 'forced_login' => Force the user to log in | |
| 47 | - * ] | |
| 48 | + * | |
| 49 | + * [ | |
| 50 | + * // the welcome screen should be shown | |
| 51 | + * 'show_welcome_screen' => true, | |
| 52 | + * // force the user to log in with a forced login screen | |
| 53 | + * 'forced_login' => true | |
| 54 | + * ] | |
| 48 | 55 | */ |
| 49 | 56 | public function mode(): array |
| 50 | 57 | { |
| 51 | 58 | return [ |
| @@ -82,9 +89,9 @@ | ||
| 82 | 89 | * Set the forced login state |
| 83 | 90 | */ |
| 84 | 91 | public function setForcedLogin(bool $forcedLogin): bool |
| 85 | 92 | { |
| 86 | - return update_option(self::FORCED_LOGIN_OPTION, $forcedLogin); | |
| 93 | + return update_option(self::FORCED_LOGIN_OPTION, $forcedLogin, false); | |
| 87 | 94 | } |
| 88 | 95 | |
| 89 | 96 | /** |
| 90 | 97 | * Check if the current admin screen is the Leadinfo dashboard page |
| @@ -117,9 +124,9 @@ | ||
| 117 | 124 | $timestamp = time(); |
| 118 | 125 | |
| 119 | 126 | do_action('metricool_onboarding_completed', $timestamp); |
| 120 | 127 | |
| 121 | - return update_option(self::ONBOARDING_COMPLETED_OPTION, $timestamp); | |
| 128 | + return update_option(self::ONBOARDING_COMPLETED_OPTION, $timestamp, false); | |
| 122 | 129 | } |
| 123 | 130 | |
| 124 | 131 | /** |
| 125 | 132 | * Check if the welcome screen should be shown |
| @@ -144,7 +151,7 @@ | ||
| 144 | 151 | * Set the welcome screen as shown |
| 145 | 152 | */ |
| 146 | 153 | public function setShowWelcomeScreen(): void |
| 147 | 154 | { |
| 148 | - update_option('metricool_show_welcome_screen', true); | |
| 155 | + update_option('metricool_show_welcome_screen', true, false); | |
| 149 | 156 | } |
| 150 | 157 | } |