Skip to content

Commit 11cf315

Browse files
authored
Merge pull request #278 from ProgressPlanner/filip/add-onboard-for-existing-users
Handle upgrading for existing users & add new tasks to the list
2 parents f81af62 + 2f2c605 commit 11cf315

4 files changed

Lines changed: 35 additions & 1 deletion

File tree

classes/class-plugin-upgrade-handler.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,23 @@ public function get_newly_added_task_provider_ids() {
5454

5555
if ( null === $newly_added_task_providers ) {
5656

57-
// Check if task providers option exists, it will not on fresh installs.
57+
// Privacy policy is not accepted, so it's a fresh install.
58+
$fresh_install = ! \progress_planner()->is_privacy_policy_accepted();
59+
60+
// Check if task providers option exists, it will not on fresh installs and v1.0.4 and older.
5861
$old_task_providers = \get_option( 'progress_planner_previous_version_task_providers', [] );
5962

63+
// We're upgrading from v1.0.4 and older, set the old task providers to what we had before the upgrade.
64+
if ( ! $fresh_install && empty( $old_task_providers ) ) {
65+
$old_task_providers = [
66+
'core-blogdescription',
67+
'wp-debug-display',
68+
'sample-page',
69+
'hello-world',
70+
'core-siteicon',
71+
];
72+
}
73+
6074
$newly_added_task_providers = [];
6175

6276
foreach ( $this->onboard_task_provider_ids as $task_provider_id ) {

classes/suggested-tasks/local-tasks/providers/one-time/class-permalink-structure.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class Permalink_Structure extends One_Time {
2626
*/
2727
const ID = 'core-permalink-structure';
2828

29+
/**
30+
* Whether the task is an onboarding task.
31+
*
32+
* @var bool
33+
*/
34+
protected $is_onboarding_task = true;
2935

3036
/**
3137
* Check if the task condition is satisfied.

classes/suggested-tasks/local-tasks/providers/one-time/class-rename-uncategorized-category.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ class Rename_Uncategorized_Category extends One_Time {
3333
*/
3434
protected $capability = 'manage_categories';
3535

36+
/**
37+
* Whether the task is an onboarding task.
38+
*
39+
* @var bool
40+
*/
41+
protected $is_onboarding_task = true;
42+
3643
/**
3744
* The Uncategorized category.
3845
*

classes/suggested-tasks/local-tasks/providers/one-time/class-search-engine-visibility.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ class Search_Engine_Visibility extends One_Time {
2626
*/
2727
const ID = 'search-engine-visibility';
2828

29+
/**
30+
* Whether the task is an onboarding task.
31+
*
32+
* @var bool
33+
*/
34+
protected $is_onboarding_task = true;
35+
2936
/**
3037
* Check if the task should be added.
3138
*

0 commit comments

Comments
 (0)