PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.3
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
← All changes | index.php +159 -81 3.9.94.0.3 View file →
@@ -2,16 +2,18 @@
2 2 /**
3 3 * Plugin Name: Profile Builder
4 4 * Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
5 5 * Description: Login, registration and edit profile shortcodes for the front-end. Also you can choose what fields should be displayed or add new (custom) ones both in the front-end and in the dashboard.
6 - * Version: 3.9.9
6 + * Version: 4.0.3
7 7 * Author: Cozmoslabs
8 8 * Author URI: https://www.cozmoslabs.com/
9 9 * Text Domain: profile-builder
10 10 * Domain Path: /translation
11 11 * License: GPL2
12 - * Elementor tested up to: 3.15.3
13 - * Elementor Pro tested up to: 3.15.3
12 + * WC requires at least: 3.0.0
13 + * WC tested up to: 11.1
14 + * Elementor tested up to: 4.3.0
15 + * Elementor Pro tested up to: 4.3.0
14 16 *
15 17 * == Copyright ==
16 18 * Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
17 19 *
@@ -103,8 +105,10 @@
103 105 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
104 106 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
105 107 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
106 108 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
109 + include_once(WPPB_PLUGIN_DIR . '/admin/setup-wizard.php');
110 + include_once(WPPB_PLUGIN_DIR . '/admin/dashboard.php');
107 111 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
108 112 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
109 113 include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
110 114 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
@@ -109,12 +113,17 @@
109 113 include_once(WPPB_PLUGIN_DIR . '/admin/advanced-settings/advanced-settings.php');
110 114 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
111 115 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
112 116 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
117 + include_once(WPPB_PLUGIN_DIR . '/admin/support-chat.php');
113 118 //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7
114 119 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
115 120 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
116 121
122 + if( file_exists( WPPB_PLUGIN_DIR . '/admin/plugin-optin/class-plugin-optin.php' ) ){
123 + include_once( WPPB_PLUGIN_DIR . '/admin/plugin-optin/class-plugin-optin.php' );
124 + }
125 +
117 126 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php' ) ) {
118 127 include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
119 128 include_once(WPPB_PAID_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
120 129 }
@@ -122,8 +131,16 @@
122 131 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php' ) ) {
123 132 include_once(WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php');
124 133 }
125 134
135 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/color-switcher.php' ) ) {
136 + include_once( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/color-switcher.php' );
137 + }
138 +
139 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/ajax/ajax-functions.php' ) ) {
140 + include_once( WPPB_PAID_PLUGIN_DIR . '/features/ajax/ajax-functions.php' );
141 + }
142 +
126 143 if ( wppb_conditional_fields_exists() ) {
127 144 include_once(WPPB_PAID_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
128 145 }
129 146
@@ -136,21 +153,27 @@
136 153 include_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' );
137 154 new WPPB_Two_Factor_Authenticator();
138 155 }
139 156
140 - if (file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php')) {
141 - include_once(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php');
142 - include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
157 + if ( file_exists( WPPB_PLUGIN_DIR . '/admin/register-version.php' ) ) {
158 + include_once( WPPB_PLUGIN_DIR . '/admin/register-version.php' );
143 159 }
144 160
161 + // Forms Rework (free): default forms always; extra forms need paid
162 + // (wppb_fb_multiple_forms_available). require_once — silent skip would
163 + // break per-form field lists with no error.
164 + require_once( WPPB_PLUGIN_DIR . 'form-builder/form-builder-init.php' );
165 +
145 166 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) {
146 167
147 168 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php');
148 - include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
169 + // include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php');
149 170 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/custom-redirects/custom-redirects.php');
150 - include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/multiple-forms/multiple-forms.php');
151 171 include_once(WPPB_PAID_PLUGIN_DIR . '/add-ons/user-listing/userlisting.php');
152 172
173 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' ) )
174 + include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/file-restriction/index.php' );
175 +
153 176 $wppb_module_settings = get_option('wppb_module_settings');
154 177 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
155 178 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
156 179 } else
@@ -170,8 +193,19 @@
170 193
171 194 /* added recaptcha and user role field since version 2.6.2 */
172 195 include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/recaptcha/recaptcha.php'); //need to load this here for displaying reCAPTCHA on Login and Recover Password forms
173 196
197 + /* added turnstile field since version 3.15. */
198 + include_once(WPPB_PLUGIN_DIR . '/front-end/default-fields/turnstile/turnstile.php');
199 +
200 + // Elementor PRO
201 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php' ) ) {
202 + $active_wp_plugins = get_option('active_plugins');
203 +
204 + if ( !empty( $active_wp_plugins ) && in_array( 'elementor-pro/elementor-pro.php', $active_wp_plugins ) )
205 + include_once(WPPB_PAID_PLUGIN_DIR . '/features/elementor-pro/elementor-pro.php');
206 + }
207 +
174 208 //Elementor Widgets
175 209 if ( did_action( 'elementor/loaded' ) ) {
176 210 if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'))
177 211 include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php';
@@ -176,17 +210,27 @@
176 210 if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php'))
177 211 include_once WPPB_PLUGIN_DIR . 'assets/misc/elementor/class-elementor.php';
178 212 }
179 213
180 - //Blocks
214 + //Divi Extension
215 + if (file_exists(WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php'))
216 + include_once WPPB_PLUGIN_DIR . 'assets/misc/divi/profile-builder-divi-extension.php';
217 +
218 + //Block Editor Assets
181 219 global $wp_version;
182 220 if ( version_compare( $wp_version, "5.0.0", ">=" ) ) {
183 - if( file_exists( WPPB_PLUGIN_DIR . '/assets/misc/gutenberg-blocks/manage-blocks.php' ) )
184 - include_once WPPB_PLUGIN_DIR . '/assets/misc/gutenberg-blocks/manage-blocks.php';
221 + if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php' ) )
222 + include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/enqueue-block-editor-assets.php';
185 223 }
186 224
225 + //Block Content Restriction
226 + global $content_restriction_activated;
227 + if ( $content_restriction_activated == 'yes' && version_compare( $wp_version, "5.0.0", ">=" ) ) {
228 + if( file_exists( WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php' ) )
229 + include_once WPPB_PLUGIN_DIR . 'assets/misc/gutenberg/block-content-restriction/block-content-restriction.php';
230 + }
231 +
187 232 //Elementor Content Restriction
188 - global $content_restriction_activated;
189 233 if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
190 234 if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
191 235 include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
192 236 }
@@ -219,8 +263,13 @@
219 263 if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php' ) )
220 264 include_once WPPB_PLUGIN_DIR . 'add-ons-free/maximum-character-length/maximum-character-length.php';
221 265 }
222 266
267 + if( isset( $wppb_free_add_ons_settings['user-profile-picture'] ) && $wppb_free_add_ons_settings['user-profile-picture'] ){
268 + if( file_exists( WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php' ) )
269 + include_once WPPB_PLUGIN_DIR . 'add-ons-free/user-profile-picture/metronet-profile-picture.php';
270 + }
271 +
223 272 }
224 273
225 274 //Include Advanced Add-ons
226 275
@@ -248,8 +297,13 @@
248 297 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php' ) )
249 298 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/index.php';
250 299 }
251 300
301 + if( isset( $wppb_advanced_add_ons_settings['form-fields-in-columns'] ) && $wppb_advanced_add_ons_settings['form-fields-in-columns'] ){
302 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php' ) )
303 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/index.php';
304 + }
305 +
252 306 if( isset( $wppb_advanced_add_ons_settings['mailchimp-integration'] ) && $wppb_advanced_add_ons_settings['mailchimp-integration'] ){
253 307 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php' ) )
254 308 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailchimp-integration/index.php';
255 309 }
@@ -283,8 +337,13 @@
283 337 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php' ) )
284 338 include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/mailpoet-integration/index.php';
285 339 }
286 340
341 + if( isset( $wppb_advanced_add_ons_settings['progress-bar'] ) && $wppb_advanced_add_ons_settings['progress-bar'] ){
342 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/progress-bar/index.php' ) )
343 + include_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/progress-bar/index.php';
344 + }
345 +
287 346 }
288 347
289 348 /**
290 349 * Include add-on files that contain activation hooks even when add-ons are deactivated
@@ -305,8 +364,11 @@
305 364
306 365 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php') )
307 366 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/multi-step-forms/multi-step-forms-activator.php';
308 367
368 + if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php') )
369 + require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/form-fields-in-columns/form-fields-in-columns-activator.php';
370 +
309 371 if( file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php') )
310 372 require_once WPPB_PAID_PLUGIN_DIR . '/add-ons-advanced/woocommerce/woocommerce-activator.php';
311 373
312 374 }
@@ -311,67 +373,8 @@
311 373
312 374 }
313 375
314 376
315 - /**
316 - * Add explanatory message on the plugins page when updates are not available
317 - *
318 - */
319 - if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php') ) {
320 -
321 - if ( class_exists('WPPB_EDD_SL_Plugin_Updater') ) {
322 -
323 - $serial = wppb_get_serial_number();
324 -
325 - if( ! function_exists('get_plugin_data') ){
326 - require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
327 - }
328 -
329 - $plugin_data = get_plugin_data( WPPB_PAID_PLUGIN_DIR . '/index.php', false );
330 - $pb_plugin_version = ( $plugin_data && $plugin_data['Version'] ) ? $plugin_data['Version'] : '3.7.6' ;
331 -
332 - if( PROFILE_BUILDER == 'Profile Builder Pro' )
333 - $pb_cl_plugin_id = '30695';
334 - else if( PROFILE_BUILDER == 'Profile Builder Basic' )
335 - $pb_cl_plugin_id = '30697';
336 - else if( PROFILE_BUILDER == 'Profile Builder Agency' )
337 - $pb_cl_plugin_id = '416191';
338 - else if( PROFILE_BUILDER == 'Profile Builder Unlimited' )
339 - $pb_cl_plugin_id = '30699';
340 -
341 - // setup the updater
342 - $wppb_edd_updater = new WPPB_EDD_SL_Plugin_Updater('https://cozmoslabs.com', WPPB_PAID_PLUGIN_DIR . '/index.php', array(
343 - 'version' => $pb_plugin_version, // current version number
344 - 'license' => $serial,
345 - 'item_name' => PROFILE_BUILDER, // name of this plugin
346 - 'item_id' => $pb_cl_plugin_id,
347 - 'author' => 'Cozmoslabs', // author of this plugin
348 - 'beta' => false
349 - )
350 - );
351 -
352 - }
353 -
354 - function wppb_plugin_update_message( $plugin_data, $new_data ) {
355 -
356 - $wppb_profile_builder_serial = wppb_get_serial_number();
357 - $wppb_profile_builder_serial_status = wppb_get_serial_number_status();
358 -
359 - if( empty( $wppb_profile_builder_serial ) ){
360 -
361 - echo '<br />' . wp_kses_post( sprintf( __('To enable updates, please enter your serial number on the <a href="%s">Register Version</a> page. If you don\'t have a serial number, please see <a href="%s" target="_blank">details & pricing</a>.', 'profile-builder' ), esc_url( admin_url('admin.php?page=profile-builder-register') ), 'https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=wppb-plugins-page&utm_campaign=WPPB' ) );
362 -
363 - } else if( $wppb_profile_builder_serial_status == 'expired' ) {
364 -
365 - echo '<br />' . wp_kses_post( sprintf( __('To enable updates, your licence needs to be renewed. Please go to the <a href="%s">Cozmoslabs Account</a> page and login to renew.', 'profile-builder' ), 'https://www.cozmoslabs.com/account/' ) );
366 -
367 - }
368 -
369 - }
370 - add_action( 'in_plugin_update_message-' . strtolower( str_replace( ' ', '-', PROFILE_BUILDER ) ) . '/index.php', 'wppb_plugin_update_message', 10, 2 );
371 - }
372 -
373 -
374 377 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
375 378 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
376 379 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
377 380
@@ -383,9 +386,9 @@
383 386 * Definitions
384 387 *
385 388 *
386 389 */
387 -define('PROFILE_BUILDER_VERSION', '3.9.9' );
390 +define('PROFILE_BUILDER_VERSION', '4.0.3' );
388 391 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
389 392 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
390 393 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
391 394 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
@@ -395,15 +398,15 @@
395 398 $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
396 399 $active_network_plugins = get_site_option('active_sitewide_plugins');
397 400
398 401 if ( in_array( 'profile-builder-pro/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-pro/index.php'] ) ){
399 -
402 +
400 403 define('PROFILE_BUILDER', 'Profile Builder Pro');
401 404 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-pro' );
402 405 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-pro/' );
403 406
404 407 } elseif ( in_array( 'profile-builder-dev/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-dev/index.php'] ) ){
405 -
408 +
406 409 define('PROFILE_BUILDER', 'Profile Builder Pro');
407 410 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-dev' );
408 411 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' );
409 412 define('PROFILE_BUILDER_PAID_VERSION', 'dev' );
@@ -408,21 +411,21 @@
408 411 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-dev/' );
409 412 define('PROFILE_BUILDER_PAID_VERSION', 'dev' );
410 413
411 414 } elseif ( in_array( 'profile-builder-agency/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-agency/index.php'] ) ){
412 -
415 +
413 416 define('PROFILE_BUILDER', 'Profile Builder Agency');
414 417 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-agency' );
415 418 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-agency/' );
416 419
417 420 } elseif ( in_array( 'profile-builder-unlimited/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-unlimited/index.php'] ) ){
418 -
421 +
419 422 define('PROFILE_BUILDER', 'Profile Builder Unlimited');
420 423 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-unlimited' );
421 424 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-unlimited/' );
422 425
423 426 } elseif ( in_array( 'profile-builder-hobbyist/index.php', $active_plugins ) || isset( $active_network_plugins['profile-builder-hobbyist/index.php'] ) ){
424 -
427 +
425 428 define('PROFILE_BUILDER', 'Profile Builder Basic');
426 429 define('WPPB_PAID_PLUGIN_DIR', WP_PLUGIN_DIR . '/profile-builder-hobbyist' );
427 430 define('WPPB_PAID_PLUGIN_URL', plugins_url() . '/profile-builder-hobbyist/' );
428 431
@@ -428,13 +431,48 @@
428 431
429 432 } else
430 433 define('PROFILE_BUILDER', 'Profile Builder Free');
431 434
435 +if ( ! function_exists( 'wppb_paid_plugin_owns_updates' ) ) {
436 + function wppb_paid_plugin_owns_updates() {
437 +
438 + if ( ! defined( 'WPPB_PAID_PLUGIN_DIR' ) || ! defined( 'WPPB_PLUGIN_DIR' ) )
439 + return false;
440 +
441 + if ( trailingslashit( WPPB_PAID_PLUGIN_DIR ) === trailingslashit( WPPB_PLUGIN_DIR ) )
442 + return false;
443 +
444 + return file_exists( WPPB_PAID_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php' );
445 +
446 + }
447 +}
448 +
449 +/**
450 + * Load the EDD updater from the paid wrapper when it owns updates.
451 + */
452 +if ( ! function_exists( 'wppb_paid_plugin_load_updater' ) ) {
453 + function wppb_paid_plugin_load_updater() {
454 +
455 + if ( class_exists( 'WPPB_Plugin_Updater', false ) )
456 + return;
457 +
458 + if ( ! function_exists( 'wppb_paid_plugin_owns_updates' ) || ! wppb_paid_plugin_owns_updates() )
459 + return;
460 +
461 + require_once WPPB_PAID_PLUGIN_DIR . '/update/class-edd-sl-plugin-updater.php';
462 +
463 + }
464 +}
465 +
466 +add_action( 'plugins_loaded', 'wppb_paid_plugin_load_updater', 0 );
467 +
468 +// Needs to be loaded early for Upload fields to work correctly
469 +if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' ) )
470 + include_once( WPPB_PAID_PLUGIN_DIR . '/add-ons/repeater-field/repeater-module.php' );
471 +
432 472 // This needs to be loaded here since we try to plug some functions, not suited for plugins_loaded hook
433 -if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php'))
434 - include_once( WPPB_PAID_PLUGIN_DIR . '/front-end/extra-fields/upload/upload_helper_functions.php');
435 -else if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) )
436 - include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php');
473 +if ( file_exists( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' ) )
474 + include_once( WPPB_PLUGIN_DIR . '/front-end/default-fields/upload/upload_helper_functions.php' );
437 475
438 476 /* add a redirect when plugin is activated */
439 477 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
440 478 function wppb_activate_plugin_redirect( $plugin ) {
@@ -444,4 +482,44 @@
444 482 }
445 483 }
446 484 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
447 485 }
486 +
487 +/**
488 + * Check if Setup Wizard should run
489 + *
490 + */
491 +function wppb_set_setup_wizard_transient() {
492 +
493 + $slugs = array(
494 + '/profile-builder-pro/index.php',
495 + '/profile-builder-dev/index.php',
496 + '/profile-builder-agency/index.php',
497 + '/profile-builder-unlimited/index.php',
498 + '/profile-builder-hobbyist/index.php',
499 + '/metronet-profile-picture/metronet-profile-picture.php',
500 + '/user-profile-picture-dev/metronet-profile-picture.php',
501 + '/user-profile-picture/metronet-profile-picture.php',
502 + );
503 +
504 + $paid_plugin_active = false;
505 +
506 + foreach( $slugs as $slug ){
507 + if( file_exists( WP_PLUGIN_DIR . $slug ) ){
508 + $paid_plugin_active = true;
509 + break;
510 + }
511 + }
512 +
513 + // Run Setup Wizard ?
514 + if ( !$paid_plugin_active )
515 + set_transient( 'wppb_run_setup_wizard', 'true', 120 );
516 +
517 + do_action( 'wppb_register_activation_hook' );
518 +
519 +}
520 +register_activation_hook( __FILE__, 'wppb_set_setup_wizard_transient' );
521 +
522 +function wppb_register_deactivation_hook() {
523 + do_action( 'wppb_register_deactivation_hook' );
524 +}
525 +register_deactivation_hook( __FILE__, 'wppb_register_deactivation_hook' );