Changeset 2154896
- Timestamp:
- 09/11/2019 03:18:14 PM (7 years ago)
- File:
-
- 1 edited
-
metapic/trunk/classes/WP_MTPC_Settings.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
metapic/trunk/classes/WP_MTPC_Settings.php
r2154893 r2154896 20 20 function () use ( $api_url ) { 21 21 check_admin_referer( 'mtpc_site_settings', 'mtpc' ); 22 22 $auto_link_default = get_site_option( 'mtpc_deeplink_auto_default' ); 23 $auto_link_default_update = (bool) $_POST['mtpc_deeplink_auto_default']; 23 24 update_site_option( 'mtpc_deeplink_auto_default', 24 (bool) $_POST['mtpc_deeplink_auto_default']);25 $auto_link_default_update ); 25 26 update_site_option( 'mtpc_registration_auto', 26 27 (bool) $_POST['mtpc_registration_auto'] ); … … 31 32 update_site_option( 'mtpc_force_ssl', 32 33 (bool) $_POST['mtpc_force_ssl'] ); 33 update_site_option( 'mtpc_commercial_interest_message',34 (bool) $_POST['mtpc_commercial_interest_message'] );34 update_site_option( 'mtpc_commercial_interest_message', 35 (bool) $_POST['mtpc_commercial_interest_message'] ); 35 36 36 37 $posted_api_url = isset( $_POST['mtpc_api_url'] ) … … 47 48 $new_api_key = $_POST['api_key']; 48 49 $new_secret_key = $_POST['secret_key']; 49 50 51 $reset_blogs = false; 52 $update_auto_link_default = ( $auto_link_default !== $auto_link_default_update ); 53 50 54 if ( $current_api_key !== $new_api_key 51 55 || $current_secret_key !== $new_secret_key 52 || ! $is_valid_client56 || ! $is_valid_client 53 57 ) { 54 58 update_site_option( 'mtpc_api_key', $new_api_key ); … … 72 76 } 73 77 78 $reset_blogs = true; 79 } 80 81 if ( $reset_blogs || $update_auto_link_default ) { 74 82 $current_site = get_current_blog_id(); 75 $sites = wp_get_sites(); 76 if ( count( $sites ) <= 50 ) { 77 foreach ( $sites as $site ) { 78 switch_to_blog( $site['blog_id'] ); 79 $this->deactivate_account(); 83 if ( ! wp_is_large_network() ) { 84 foreach ( get_sites() as $site ) { 85 /* @var WP_Site $site */ 86 switch_to_blog( $site->blog_id ); 87 if ( $reset_blogs ) { 88 $this->deactivate_account(); 89 } 90 91 if ( $update_auto_link_default ) { 92 update_option( 'mtpc_deeplink_auto_default', $auto_link_default_update ); 93 } 80 94 } 81 95 82 96 switch_to_blog( $current_site ); 83 97 } 98 84 99 } 85 100 … … 98 113 $return_url = remove_query_arg( 'mtpc-account-activated', 99 114 $return_url ); 100 115 101 116 if ( isset( $_POST['deactivate'] ) 102 117 || isset( $_POST['logout'] ) 103 118 ) { 104 119 105 120 $this->deactivate_account(); 106 121 … … 119 134 update_option( 'mtpc_deeplink_auto_default', 120 135 (bool) $_POST['mtpc_deeplink_auto_default'] ); 121 122 update_option( 'mtpc_commercial_interest_message',123 (bool) $_POST['mtpc_commercial_interest_message'] );136 137 update_option( 'mtpc_commercial_interest_message', 138 (bool) $_POST['mtpc_commercial_interest_message'] ); 124 139 125 140 if ( $is_debug ) { … … 172 187 173 188 $ref 174 = admin_url( 'admin.php?page=metapic-settings' );189 = admin_url( 'admin.php?page=metapic-settings' ); 175 190 $fail_ref 176 191 = admin_url( 'admin.php?page=metapic' );
Note: See TracChangeset
for help on using the changeset viewer.