-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupgrade.php
34 lines (31 loc) · 1.1 KB
/
upgrade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*
* This plugin was previously known as new-members-only, and options were
* named as new_members_only_[option_name]. If you previously had that plugin installed,
* and you don't currently have dxw-members-only options setup, this will take the
* new-members-only options and copy them across to the dxw_members_only format.
*/
function transfer_new_members_only_options()
{
$options = [
'list_type',
'list_content',
'ip_whitelist',
'referrer_allow_list',
'redirect',
'redirect_root',
'upload_default',
'max_age',
'max_age_static',
'max_age_public'
];
foreach ($options as $option) {
$old_option = 'new_members_only_' . $option;
$new_option = 'dxw_members_only_'. $option;
//use is_null because don't want to overwrite existing but empty options
if (!is_null(get_option($old_option, null)) && is_null(get_option($new_option, null))) {
$old_option_val = get_option($old_option);
add_option($new_option, $old_option_val);
}
}
}