| 1 |
<?php |
| 2 |
include_once ( WPPB_PLUGIN_DIR.'/features/upgrades/upgrades-functions.php' ); |
| 3 |
|
| 4 |
/** |
| 5 |
* Function that assures backwards compatibility for all future versions, where this is needed |
| 6 |
* |
| 7 |
* @since v.1.3.13 |
| 8 |
* |
| 9 |
* @return void |
| 10 |
*/ |
| 11 |
function wppb_update_patch(){ |
| 12 |
if ( !get_option( 'wppb_version' ) ) { |
| 13 |
add_option( 'wppb_version', '1.3.13' ); |
| 14 |
|
| 15 |
do_action( 'wppb_set_initial_version_number', PROFILE_BUILDER_VERSION ); |
| 16 |
} |
| 17 |
|
| 18 |
$wppb_version = get_option( 'wppb_version' ); |
| 19 |
|
| 20 |
do_action( 'wppb_before_default_changes', PROFILE_BUILDER_VERSION, $wppb_version ); |
| 21 |
|
| 22 |
if ( version_compare( PROFILE_BUILDER_VERSION, $wppb_version, '>' ) ) { |
| 23 |
if ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) || ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) ){ |
| 24 |
|
| 25 |
/* stopped creating them on 01.02.2016 */ |
| 26 |
/*$upload_dir = wp_upload_dir(); |
| 27 |
wp_mkdir_p( $upload_dir['basedir'].'/profile_builder' ); |
| 28 |
wp_mkdir_p( $upload_dir['basedir'].'/profile_builder/attachments/' ); |
| 29 |
wp_mkdir_p( $upload_dir['basedir'].'/profile_builder/avatars/' );*/ |
| 30 |
|
| 31 |
// Flush the rewrite rules and add them, if need be, the proper way. |
| 32 |
if ( function_exists( 'wppb_flush_rewrite_rules' ) ) |
| 33 |
wppb_flush_rewrite_rules(); |
| 34 |
|
| 35 |
wppb_pro_hobbyist_v1_3_13(); |
| 36 |
} |
| 37 |
|
| 38 |
if ( PROFILE_BUILDER == 'Profile Builder Pro' ){ |
| 39 |
wppb_pro_v1_3_15(); |
| 40 |
} |
| 41 |
|
| 42 |
update_option( 'wppb_version', PROFILE_BUILDER_VERSION ); |
| 43 |
} |
| 44 |
|
| 45 |
//this should run only once, mainly if the old version is < 2.0 (can be anything) |
| 46 |
if ( version_compare( $wppb_version, 2.0, '<' ) ) { |
| 47 |
if ( ( PROFILE_BUILDER == 'Profile Builder Pro' ) || ( PROFILE_BUILDER == 'Profile Builder Hobbyist' ) || ( PROFILE_BUILDER == 'Profile Builder Free' ) ){ |
| 48 |
wppb_pro_hobbyist_free_v2_0(); |
| 49 |
} |
| 50 |
|
| 51 |
if ( PROFILE_BUILDER == 'Profile Builder Pro' ){ |
| 52 |
wppb_pro_userlisting_compatibility_upgrade(); |
| 53 |
wppb_pro_email_customizer_compatibility_upgrade(); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
// this should run only once, mainly if the old version is < 2.2.5 (can be anything) |
| 58 |
if ( version_compare( $wppb_version, '2.2.5', '<' ) ) { |
| 59 |
if ( PROFILE_BUILDER == 'Profile Builder Pro' ) { |
| 60 |
wppb_new_custom_redirects_compatibility(); |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
if ( version_compare( $wppb_version, '2.2.5', '<=' ) ) { |
| 65 |
if( is_multisite() ){ |
| 66 |
$wppb_general_settings = get_option( 'wppb_general_settings', 'not_set' ); |
| 67 |
if ( $wppb_general_settings != 'not_set' ) { |
| 68 |
$wppb_general_settings['emailConfirmation'] = 'yes'; |
| 69 |
update_option('wppb_general_settings', $wppb_general_settings); |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
do_action ( 'wppb_after_default_changes', PROFILE_BUILDER_VERSION, $wppb_version ); |
| 76 |
} |
| 77 |
add_action ( 'init', 'wppb_update_patch' ); |