Skip to content

Commit 716d02a

Browse files
authored
Merge pull request #10 from creedally/fix-activator-settings
Fixed activator settings issue and uninstall settings issue
2 parents 870bbc5 + f712fb8 commit 716d02a

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

includes/activator.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,21 @@ class BFIE_Activator{
1313

1414
public static function activate() {
1515

16-
$settings = array(
17-
'general' => array(
18-
'bfi_per_page' => BFIE_PER_PAGE,
19-
'bfi_posttyps' => array( 'post', 'page' ),
20-
'enable_default_image' => array( 'post', 'page' ),
21-
),
22-
);
23-
24-
update_option( 'bfi_settings', $settings );
16+
$setting_key = 'bfi_settings';
17+
$bfi_settings = get_option( $setting_key );
18+
$bfi_settings = !empty( $bfi_settings ) ? $bfi_settings : array();
19+
20+
if( empty( $bfi_settings ) ) {
21+
$settings = array(
22+
'general' => array(
23+
'bfi_per_page' => BFIE_PER_PAGE,
24+
'bfi_posttyps' => array('post', 'page'),
25+
'enable_default_image' => array('post', 'page'),
26+
),
27+
);
28+
29+
update_option('bfi_settings', $settings);
30+
}
2531

2632
set_transient( '_bfie_activation_redirect', true, 30 );
2733
}
File renamed without changes.

0 commit comments

Comments
 (0)