PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.1.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.1.0
3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 All 195 releases
← All changes | includes/class-convertkit-setup.php +24 -61 3.3.13.1.0 View file →
@@ -133,8 +133,16 @@
133 133 $this->migrate_term_form_settings();
134 134 }
135 135
136 136 /**
137 + * 1.6.1+: Refresh Forms, Landing Pages and Tags data stored in settings,
138 + * to get new Forms Builder Settings.
139 + */
140 + if ( version_compare( $current_version, '1.6.1', '<' ) ) {
141 + $this->refresh_resources();
142 + }
143 +
144 + /**
137 145 * 1.9.6+: Migrate _wp_convertkit_settings[default_form] to _wp_convertkit_settings[page_form] and
138 146 * _wp_convertkit_settings[post_form], now that each Post Type has its own Default Form setting
139 147 * in Settings > Kit > General.
140 148 */
@@ -150,13 +158,8 @@
150 158 $posts = new ConvertKit_Resource_Posts( 'cron' );
151 159 $posts->schedule_cron_event();
152 160 }
153 161
154 - // Actions that should run regardless of the version number
155 - // whenever the Plugin is updated.
156 - $this->remove_v3_api_secret_from_settings();
157 - $this->maybe_delete_old_cached_resource_structure();
158 -
159 162 // Update the installed version number in the options table.
160 163 update_option( 'convertkit_version', CONVERTKIT_PLUGIN_VERSION );
161 164
162 165 }
@@ -161,64 +164,8 @@
161 164
162 165 }
163 166
164 167 /**
165 - * Remove v3 API Secret from settings.
166 - *
167 - * @since 3.2.4
168 - */
169 - private function remove_v3_api_secret_from_settings() {
170 -
171 - $settings = new ConvertKit_Settings();
172 - $settings->save(
173 - array(
174 - 'api_secret' => '',
175 - )
176 - );
177 -
178 - }
179 -
180 - /**
181 - * Deletes any cached resources stored in the options table if they are a flat array
182 - * that originates from between 1.6.0 and 1.9.5.2 of the Plugin.
183 - * i.e. [id => name], rather than the expected [id => [id => '...', name => '...', ...]].
184 - *
185 - * This will permit the Resources classes to fetch and cache the Form resources correctly
186 - * from the API, and prevent fatal errors when a user activates the latest version of the Plugin
187 - * on a site that previously had a very old Plugin version installed.
188 - *
189 - * @since 3.2.5
190 - */
191 - private function maybe_delete_old_cached_resource_structure() {
192 -
193 - // Define the resource options to check.
194 - $resource_options = array(
195 - 'convertkit_forms',
196 - 'convertkit_landing_pages',
197 - 'convertkit_tags',
198 - );
199 -
200 - foreach ( $resource_options as $resource_option ) {
201 - // Get the resource option.
202 - $resource = get_option( $resource_option, false );
203 -
204 - // If the resource option does not exist, there's nothing to delete.
205 - if ( false === $resource ) {
206 - return;
207 - }
208 -
209 - // If the resource structure is correct e.g. [id => [name => '...']], there's nothing to delete.
210 - if ( is_array( reset( $resource ) ) ) {
211 - return;
212 - }
213 -
214 - // Delete the cached resource.
215 - delete_option( $resource_option );
216 - }
217 -
218 - }
219 -
220 - /**
221 168 * Adds form_id column and key to form entries database table.
222 169 *
223 170 * @since 3.0.4
224 171 */
@@ -709,8 +656,24 @@
709 656 unset( $settings['default_form'] );
710 657
711 658 // Update.
712 659 update_option( $convertkit_settings::SETTINGS_NAME, $settings );
660 +
661 + }
662 +
663 + /**
664 + * 1.6.1: Refresh Forms, Landing Pages and Tags data stored in settings,
665 + * to get new Forms Builder Settings.
666 + */
667 + private function refresh_resources() {
668 +
669 + $forms = new ConvertKit_Resource_Forms( 'setup' );
670 + $landing_pages = new ConvertKit_Resource_Landing_Pages( 'setup' );
671 + $tags = new ConvertKit_Resource_Tags( 'setup' );
672 +
673 + $forms->refresh();
674 + $landing_pages->refresh();
675 + $tags->refresh();
713 676
714 677 }
715 678
716 679 /**