PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.2.1
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.2.1
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 2.0.7 2.0.8 All 339 releases
profile-builder / index.php

index.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.2.1, at index.php

212 lines 10.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Profile Builder
4 Plugin URI: https://www.cozmoslabs.com/wordpress-profile-builder/
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.2.1
7 Author: Cozmoslabs
8 Author URI: https://www.cozmoslabs.com/
9 Text Domain: profile-builder
10 Domain Path: /translation
11 License: GPL2
12
13 == Copyright ==
14 Copyright 2014 Cozmoslabs (www.cozmoslabs.com)
15
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 2 of the License, or
19 (at your option) any later version.
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28
29 /* Check if another version of Profile Builder is activated, to prevent fatal errors*/
30 function wppb_free_plugin_init() {
31 if (function_exists('wppb_return_bytes')) {
32 function wppb_admin_notice()
33 {
34 ?>
35 <div class="error">
36 <p><?php printf( __( '%s is also activated. You need to deactivate it before activating this version of the plugin.', 'profile-builder'), PROFILE_BUILDER ); ?></p>
37 </div>
38 <?php
39 }
40 function wppb_plugin_deactivate() {
41 deactivate_plugins( plugin_basename( __FILE__ ) );
42 unset($_GET['activate']);
43 }
44
45 add_action('admin_notices', 'wppb_admin_notice');
46 add_action( 'admin_init', 'wppb_plugin_deactivate' );
47 } else {
48
49 /**
50 * Convert memory value from ini file to a readable form
51 *
52 * @since v.1.0
53 *
54 * @return integer
55 */
56 function wppb_return_bytes($val)
57 {
58 return wp_convert_hr_to_bytes($val);
59 }
60
61 /**
62 * Definitions
63 *
64 *
65 */
66 define('PROFILE_BUILDER_VERSION', '3.2.1' );
67 define('WPPB_PLUGIN_DIR', plugin_dir_path(__FILE__));
68 define('WPPB_PLUGIN_URL', plugin_dir_url(__FILE__));
69 define('WPPB_PLUGIN_BASENAME', plugin_basename(__FILE__));
70 define('WPPB_TRANSLATE_DIR', WPPB_PLUGIN_DIR . '/translation');
71 define('WPPB_TRANSLATE_DOMAIN', 'profile-builder');
72
73 /* include notices class */
74 if (file_exists(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php'))
75 include_once(WPPB_PLUGIN_DIR . '/assets/lib/class_notices.php');
76
77 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php'))
78 define('PROFILE_BUILDER', 'Profile Builder Pro');
79 elseif (file_exists(WPPB_PLUGIN_DIR . '/front-end/extra-fields/extra-fields.php'))
80 define('PROFILE_BUILDER', 'Profile Builder Hobbyist');
81 else
82 define('PROFILE_BUILDER', 'Profile Builder Free');
83
84 /**
85 * Initialize the translation for the Plugin.
86 *
87 * @since v.1.0
88 *
89 * @return null
90 */
91 function wppb_init_translation()
92 {
93 $current_theme = wp_get_theme();
94 if( !empty( $current_theme->stylesheet ) && file_exists( get_theme_root().'/'. $current_theme->stylesheet .'/local_pb_lang' ) )
95 load_plugin_textdomain( 'profile-builder', false, basename( dirname( __FILE__ ) ).'/../../themes/'.$current_theme->stylesheet.'/local_pb_lang' );
96 else
97 load_plugin_textdomain( 'profile-builder', false, basename(dirname(__FILE__)) . '/translation/' );
98 }
99
100 add_action('init', 'wppb_init_translation', 8);
101
102
103 /**
104 * Required files
105 *
106 *
107 */
108 include_once(WPPB_PLUGIN_DIR . '/assets/lib/wck-api/wordpress-creation-kit.php');
109 include_once(WPPB_PLUGIN_DIR . '/features/upgrades/upgrades.php');
110 include_once(WPPB_PLUGIN_DIR . '/features/functions.php');
111 include_once(WPPB_PLUGIN_DIR . '/admin/admin-functions.php');
112 include_once(WPPB_PLUGIN_DIR . '/admin/basic-info.php');
113 include_once(WPPB_PLUGIN_DIR . '/admin/general-settings.php');
114 include_once(WPPB_PLUGIN_DIR . '/admin/admin-bar.php');
115 include_once(WPPB_PLUGIN_DIR . '/admin/private-website.php');
116 include_once(WPPB_PLUGIN_DIR . '/admin/manage-fields.php');
117 include_once(WPPB_PLUGIN_DIR . '/admin/pms-cross-promotion.php');
118 //include_once(WPPB_PLUGIN_DIR . '/admin/feedback.php');//removed in version 2.9.7
119 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/email-confirmation.php');
120 include_once(WPPB_PLUGIN_DIR . '/features/email-confirmation/class-email-confirmation.php');
121 if (file_exists(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php')) {
122 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/admin-approval.php');
123 include_once(WPPB_PLUGIN_DIR . '/features/admin-approval/class-admin-approval.php');
124 }
125 if ( wppb_conditional_fields_exists() ) {
126 include_once(WPPB_PLUGIN_DIR . '/features/conditional-fields/conditional-fields.php');
127 }
128 include_once(WPPB_PLUGIN_DIR . '/features/login-widget/login-widget.php');
129 include_once(WPPB_PLUGIN_DIR . '/features/roles-editor/roles-editor.php');
130 include_once(WPPB_PLUGIN_DIR . '/features/content-restriction/content-restriction.php');
131
132 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
133 include_once(WPPB_PLUGIN_DIR . '/update/update-checker.php');
134 include_once(WPPB_PLUGIN_DIR . '/admin/register-version.php');
135 }
136
137 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
138 include_once(WPPB_PLUGIN_DIR . '/modules/modules.php');
139 include_once(WPPB_PLUGIN_DIR . '/modules/repeater-field/repeater-module.php');
140 include_once(WPPB_PLUGIN_DIR . '/modules/custom-redirects/custom-redirects.php');
141 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/email-customizer.php');
142 include_once(WPPB_PLUGIN_DIR . '/modules/multiple-forms/multiple-forms.php');
143 include_once(WPPB_PLUGIN_DIR . '/modules/user-listing/userlisting.php');
144
145 $wppb_module_settings = get_option('wppb_module_settings');
146 if (isset($wppb_module_settings['wppb_userListing']) && ($wppb_module_settings['wppb_userListing'] == 'show')) {
147 add_shortcode('wppb-list-users', 'wppb_user_listing_shortcode');
148 } else
149 add_shortcode('wppb-list-users', 'wppb_list_all_users_display_error');
150
151 $wppb_email_customizer_activate = 'hide';
152 if ( ( !empty( $wppb_module_settings['wppb_emailCustomizer'] ) && $wppb_module_settings['wppb_emailCustomizer'] == 'show' ) || ( !empty( $wppb_module_settings['wppb_emailCustomizerAdmin'] ) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) )
153 $wppb_email_customizer_activate = 'show';
154
155 if ( $wppb_email_customizer_activate == 'show')
156 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/admin-email-customizer.php');
157
158 if ( $wppb_email_customizer_activate == 'show' )
159 include_once(WPPB_PLUGIN_DIR . '/modules/email-customizer/user-email-customizer.php');
160 }
161
162 include_once(WPPB_PLUGIN_DIR . '/admin/add-ons.php');
163 include_once(WPPB_PLUGIN_DIR . '/assets/misc/plugin-compatibilities.php');
164
165 /* added recaptcha and user role field since version 2.6.2 */
166 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
167
168 //Elementor Content Restriction
169 global $content_restriction_activated;
170 if ( $content_restriction_activated == 'yes' && did_action( 'elementor/loaded' ) ) {
171 if( file_exists( WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php' ) )
172 include_once WPPB_PLUGIN_DIR . 'features/content-restriction/class-elementor-content-restriction.php';
173 }
174
175 /**
176 * Check for updates
177 *
178 *
179 */
180 if (file_exists(WPPB_PLUGIN_DIR . '/update/update-checker.php')) {
181 if (file_exists(WPPB_PLUGIN_DIR . '/modules/modules.php')) {
182 $localSerial = get_option('wppb_profile_builder_pro_serial');
183 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBP', __FILE__, 'profile-builder-pro-update');
184
185 } else {
186 $localSerial = get_option('wppb_profile_builder_hobbyist_serial');
187 $wppb_update = new wppb_PluginUpdateChecker('http://updatemetadata.cozmoslabs.com/?localSerialNumber=' . $localSerial . '&uniqueproduct=CLPBH', __FILE__, 'profile-builder-hobbyist-update');
188 }
189 }
190
191
192 // these settings are important, so besides running them on page load, we also need to do a check on plugin activation
193 add_action('init', 'wppb_generate_default_settings_defaults'); //prepoulate general settings
194 add_action('init', 'wppb_prepopulate_fields'); //prepopulate manage fields list
195
196 }
197 } //end wppb_free_plugin_init
198 add_action( 'plugins_loaded', 'wppb_free_plugin_init' );
199
200 if (file_exists( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php'))
201 include_once( plugin_dir_path(__FILE__) . '/front-end/extra-fields/upload/upload_helper_functions.php');
202
203 /* add a redirect when plugin is activated */
204 if( !function_exists( 'wppb_activate_plugin_redirect' ) ){
205 function wppb_activate_plugin_redirect( $plugin ) {
206 if( $plugin == plugin_basename( __FILE__ ) ) {
207 exit( wp_redirect( admin_url( 'admin.php?page=profile-builder-basic-info' ) ) );
208 }
209 }
210 add_action( 'activated_plugin', 'wppb_activate_plugin_redirect' );
211 }
212