PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.8.3
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.8.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 2.0.7 All 340 releases
profile-builder / admin / general-settings.php

general-settings.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.8.3, at admin/general-settings.php

460 lines 23.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3 /**
4 * Function that returns an array with the settings tabs(pages) and secondary tabs( can be sub-pages (we load a registered page as a secondary tab) or actual sub-tabs )
5 * @return array with the tabs
6 */
7 function wppb_get_settings_pages(){
8 $wppb_module_settings = get_option('wppb_module_settings');
9
10 $settings_pages['pages'] = array(
11 'profile-builder-general-settings' => __( 'General Settings', 'profile-builder' ),
12 'profile-builder-admin-bar-settings' => __( 'Admin Bar', 'profile-builder' ),
13 'profile-builder-content_restriction' => __( 'Content Restriction', 'profile-builder' ),
14 'profile-builder-private-website' => __( 'Private Website', 'profile-builder' ),
15 'profile-builder-toolbox-settings' => __( 'Advanced Settings', 'profile-builder' ),
16 );
17
18 //add tabs here for Advanced Settings
19 $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['forms'] = __( 'Forms', 'profile-builder' );
20 $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['fields'] = __( 'Fields', 'profile-builder' );
21
22 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) && isset( $wppb_module_settings['wppb_userListing'] ) && $wppb_module_settings['wppb_userListing'] === 'show' )
23 $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['userlisting'] = __( 'Userlisting', 'profile-builder' );
24
25 $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['shortcodes'] = __( 'Shortcodes', 'profile-builder' );
26 $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['admin'] = __( 'Admin', 'profile-builder' );
27
28 //add tab for 2FA
29 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists(WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php')) {
30 $settings_pages['pages']['profile-builder-two-factor-authentication'] = __( 'Two-Factor Authentication', 'profile-builder' );
31 }
32
33 //add sub-pages here for email customizer
34 if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){
35
36 $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' );
37 $settings_pages['sub-pages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' );
38 $settings_pages['sub-pages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' );
39
40 } else if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) {
41 if( ( isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) || ( isset($wppb_module_settings['wppb_emailCustomizer']) && $wppb_module_settings['wppb_emailCustomizer'] == 'show') ){
42 $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' );
43 $settings_pages['sub-pages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' );
44 $settings_pages['sub-pages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' );
45 }
46 }
47
48 return $settings_pages;
49 }
50
51 /**
52 * Function that generates the html for the tabs and subtabs on the settings page
53 */
54 function wppb_generate_settings_tabs(){
55 ?>
56 <nav class="nav-tab-wrapper">
57 <?php
58 $pages = wppb_get_settings_pages();
59
60 $active_tab = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
61 //if we are on a subpage we need to change the active tab to the parent
62 if( !empty( $pages['sub-pages'] ) ) {
63 foreach ($pages['sub-pages'] as $parent_slug => $subpages) {
64 if (array_key_exists($active_tab, $subpages)) {
65 $active_tab = $parent_slug;
66 }
67 }
68 }
69
70 foreach( $pages['pages'] as $page_slug => $tab_name ){
71 echo '<a href="' . esc_url( admin_url( add_query_arg( array( 'page' => $page_slug ), 'admin.php' ) ) ) . '" class="nav-tab ' . ( $active_tab == $page_slug ? 'nav-tab-active' : '' ) . '">'. esc_html( $tab_name ) .'</a>';
72 }
73 ?>
74 </nav>
75 <?php
76
77 // this is not always the same as the active tab
78 $active_subpage = sanitize_text_field($_GET['page']);
79
80 if( !empty( $pages['sub-pages'] ) ) {
81 foreach ($pages['sub-pages'] as $parent_slug => $subpages) {
82 if (array_key_exists( sanitize_text_field( $active_subpage ), $subpages)) {
83 echo '<ul class="wppb-subtabs subsubsub">';
84 foreach ($subpages as $subpage_slug => $subpage_name) {
85 echo '<li><a href="' . esc_url( admin_url( add_query_arg(array('page' => $subpage_slug), 'admin.php') ) ) . '" class="nav-sub-tab ' . ($active_subpage == $subpage_slug ? 'current' : '') . '">' . esc_html( $subpage_name ) . '</a></li>';
86 }
87 echo '</ul>';
88 }
89 }
90 }
91
92 if( !empty( $pages['sub-tabs'] ) ) {
93 foreach ($pages['sub-tabs'] as $parent_slug => $tabs) {
94 if ( $active_subpage == $parent_slug) {
95 echo '<ul class="wppb-subtabs subsubsub">';
96 //determine the active tab, if no tab present then default to the first one
97 if( isset($_GET['tab']) )
98 $active_tab = sanitize_text_field( $_GET['tab'] );
99 else {
100 $keys = array_keys($tabs);
101 $active_tab = array_shift( $keys );
102 }
103 foreach ($tabs as $tab_slug => $tab_name) {
104 echo '<li><a href="' . esc_url( add_query_arg( array('tab' => $tab_slug) ) ) . '" class="nav-sub-tab ' . ( $active_tab == $tab_slug ? 'current' : '') . '">' . esc_html( $tab_name ) . '</a></li>';
105 }
106 echo '</ul>';
107 }
108 }
109 }
110 }
111
112 /**
113 * Function that creates the "General Settings" submenu page
114 *
115 * @since v.2.0
116 *
117 * @return void
118 */
119 function wppb_register_general_settings_submenu_page() {
120 add_submenu_page( 'profile-builder', __( 'Settings', 'profile-builder' ), __( 'Settings', 'profile-builder' ), 'manage_options', 'profile-builder-general-settings', 'wppb_general_settings_content' );
121 }
122 add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 );
123
124
125 function wppb_generate_default_settings_defaults(){
126 add_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'automaticallyLogIn' => 'No', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail', 'rolesEditor' => 'no', 'conditional_fields_ajax' => 'no' ) );
127 }
128
129
130 /**
131 * Function that adds content to the "General Settings" submenu page
132 *
133 * @since v.2.0
134 *
135 * @return string
136 */
137 function wppb_general_settings_content() {
138 wppb_generate_default_settings_defaults();
139 ?>
140 <div class="wrap wppb-wrap">
141 <h2>
142 <?php esc_html_e( 'Profile Builder Settings', 'profile-builder' ); ?>
143 <a href="https://www.cozmoslabs.com/docs/profile-builder-2/general-settings/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help"></a>
144 </h2>
145
146 <?php settings_errors(); ?>
147
148 <?php wppb_generate_settings_tabs() ?>
149
150 <form method="post" action="options.php#general-settings">
151 <?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?>
152 <?php settings_fields( 'wppb_general_settings' ); ?>
153
154 <table class="form-table">
155 <tr>
156 <th scope="row">
157 <?php esc_html_e( "Load Profile Builder's own CSS file in the front-end:", "profile-builder" ); ?>
158 </th>
159 <td>
160 <label><input type="checkbox" name="wppb_general_settings[extraFieldsLayout]"<?php echo ( ( isset( $wppb_generalSettings['extraFieldsLayout'] ) && ( $wppb_generalSettings['extraFieldsLayout'] == 'default' ) ) ? ' checked' : '' ); ?> value="default" class="wppb-select"><?php esc_html_e( 'Yes', 'profile-builder' ); ?></label>
161 <ul>
162 <li class="description"><?php printf( esc_html__( 'You can find the default file here: %1$s', 'profile-builder' ), '<a href="'.dirname( plugin_dir_url( __FILE__ ) ).'/assets/css/style-front-end.css" target="_blank">'.dirname( dirname( plugin_basename( __FILE__ ) ) ).'\assets\css\style-front-end.css</a>' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></li>
163 </ul>
164 </td>
165 </tr>
166
167 <tr>
168 <th scope="row">
169 <?php esc_html_e( 'Automatically Log In:', 'profile-builder' );?>
170 </th>
171 <td>
172 <select name="wppb_general_settings[automaticallyLogIn]" class="wppb-select" id="wppb_settings_automatically_log_in" onchange="wppb_display_page_select(this.value)">
173 <option value="Yes" <?php if ( !empty( $wppb_generalSettings['automaticallyLogIn'] ) && $wppb_generalSettings['automaticallyLogIn'] === 'Yes' ) echo 'selected'; ?>><?php esc_html_e( 'Yes', 'profile-builder' ); ?></option>
174 <option value="No" <?php if ( empty( $wppb_generalSettings['automaticallyLogIn'] ) || ( !empty( $wppb_generalSettings['automaticallyLogIn'] ) && $wppb_generalSettings['automaticallyLogIn'] === 'No' ) ) echo 'selected'; ?>><?php esc_html_e( 'No', 'profile-builder' ); ?></option>
175 </select>
176 <ul>
177 <li class="description"><?php esc_html_e( 'Select "Yes" to automatically log in new users after successful registration.', 'profile-builder' ); ?></li>
178 </ul>
179 </td>
180 </tr>
181
182 <tr>
183 <th scope="row">
184 <?php esc_html_e( '"Email Confirmation" Activated:', 'profile-builder' );?>
185 </th>
186 <td>
187 <select name="wppb_general_settings[emailConfirmation]" class="wppb-select" id="wppb_settings_email_confirmation" onchange="wppb_display_page_select(this.value)">
188 <option value="yes" <?php if ( !empty( $wppb_generalSettings['emailConfirmation'] ) && $wppb_generalSettings['emailConfirmation'] === 'yes' ) echo 'selected'; ?>><?php esc_html_e( 'Yes', 'profile-builder' ); ?></option>
189 <option value="no" <?php if ( empty( $wppb_generalSettings['emailConfirmation'] ) || ( !empty( $wppb_generalSettings['emailConfirmation'] ) && $wppb_generalSettings['emailConfirmation'] === 'no' ) ) echo 'selected'; ?>><?php esc_html_e( 'No', 'profile-builder' ); ?></option>
190 </select>
191 <ul>
192 <li class="description"><?php esc_html_e( 'This works with front-end forms only. Recommended to redirect WP default registration to a Profile Builder one using "Custom Redirects" module.', 'profile-builder' ); ?></li>
193 <?php if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) { ?>
194 <li class="description dynamic1"><?php printf( esc_html__( 'You can find a list of unconfirmed email addresses %1$sUsers > All Users > Email Confirmation%2$s.', 'profile-builder' ), '<a href="'. esc_url( get_bloginfo( 'url' ) ).'/wp-admin/users.php?page=unconfirmed_emails">', '</a>' )?></li>
195 <?php } ?>
196 </ul>
197 </td>
198 </tr>
199
200 <tr id="wppb-settings-activation-page">
201 <th scope="row">
202 <?php esc_html_e( '"Email Confirmation" Landing Page:', 'profile-builder' ); ?>
203 </th>
204 <td>
205 <select name="wppb_general_settings[activationLandingPage]" class="wppb-select">
206 <option value="" <?php if ( empty( $wppb_generalSettings['emailConfirmation'] ) ) echo 'selected'; ?>></option>
207 <optgroup label="<?php esc_html_e( 'Existing Pages', 'profile-builder' ); ?>">
208 <?php
209 $pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) );
210
211 foreach ( $pages as $key => $value ){
212 echo '<option value="'.esc_attr( $value->ID ).'"';
213 if ( $wppb_generalSettings['activationLandingPage'] == $value->ID )
214 echo ' selected';
215
216 echo '>' . esc_html( $value->post_title ) . '</option>';
217 }
218 ?>
219 </optgroup>
220 </select>
221 <p class="description">
222 <?php esc_html_e( 'Specify the page where the users will be directed when confirming the email account. This page can differ from the register page(s) and can be changed at any time. If none selected, a simple confirmation page will be displayed for the user.', 'profile-builder' ); ?>
223 </p>
224 </td>
225 </tr>
226
227
228 <?php
229 if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR.'/features/admin-approval/admin-approval.php' ) ){
230 ?>
231 <tr>
232 <th scope="row">
233 <?php esc_html_e( '"Admin Approval" Activated:', 'profile-builder' ); ?>
234 </th>
235 <td>
236 <select id="adminApprovalSelect" name="wppb_general_settings[adminApproval]" class="wppb-select" onchange="wppb_display_page_select_aa(this.value)">
237 <option value="yes" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'yes' ) echo 'selected'; ?>><?php esc_html_e( 'Yes', 'profile-builder' ); ?></option>
238 <option value="no" <?php if( empty( $wppb_generalSettings['adminApproval'] ) || ( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'no' ) ) echo 'selected'; ?>><?php esc_html_e( 'No', 'profile-builder' ); ?></option>
239 </select>
240 <ul>
241 <li class="description dynamic2"><?php printf( esc_html__( 'You can find a list of users at %1$sUsers > All Users > Admin Approval%2$s.', 'profile-builder' ), '<a href="'. esc_url( get_bloginfo( 'url' ) ).'/wp-admin/users.php?page=admin_approval&orderby=registered&order=desc">', '</a>' )?></li>
242 <ul>
243 </td>
244 </tr>
245
246 <tr class="dynamic2">
247 <th scope="row">
248 <?php esc_html_e( '"Admin Approval" on User Role:', 'profile-builder' ); ?>
249 </th>
250 <td>
251 <div id="wrap">
252 <?php
253 $wppb_userRoles = wppb_adminApproval_onUserRole();
254
255 if( ! empty( $wppb_userRoles ) ) {
256 foreach( $wppb_userRoles as $role => $role_name ) {
257 echo '<label><input type="checkbox" id="adminApprovalOnUserRoleCheckbox" name="wppb_general_settings[adminApprovalOnUserRole][]" class="wppb-checkboxes" value="' . esc_attr( $role ) . '"';
258 if( ! empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) && in_array( $role, $wppb_generalSettings['adminApprovalOnUserRole'] ) ) echo ' checked';
259 if( empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) ) echo ' checked';
260 echo '>';
261 echo esc_html( $role_name ) . '</label><br>';
262 }
263 }
264 ?>
265 </div>
266 <ul>
267 <li class="description"><?php printf( esc_html__( 'Select on what user roles to activate Admin Approval.', 'profile-builder' ) ) ?></li>
268 <ul>
269 </td>
270 </tr>
271
272 <?php } ?>
273
274 <?php
275 if( file_exists( WPPB_PLUGIN_DIR.'/features/roles-editor/roles-editor.php' ) ) {
276 ?>
277 <tr>
278 <th scope="row">
279 <?php esc_html_e( '"Roles Editor" Activated:', 'profile-builder' ); ?>
280 </th>
281 <td>
282 <select id="rolesEditorSelect" name="wppb_general_settings[rolesEditor]" class="wppb-select" onchange="wppb_display_page_select_re(this.value)">
283 <option value="no" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'no' ) echo 'selected'; ?>><?php esc_html_e( 'No', 'profile-builder' ); ?></option>
284 <option value="yes" <?php if( !empty( $wppb_generalSettings['rolesEditor'] ) && $wppb_generalSettings['rolesEditor'] == 'yes' ) echo 'selected'; ?>><?php esc_html_e( 'Yes', 'profile-builder' ); ?></option>
285 </select>
286 <ul>
287 <li class="description dynamic3"><?php printf( esc_html__( 'You can add / edit user roles at %1$sUsers > Roles Editor%2$s.', 'profile-builder' ), '<a href="'. esc_url( get_bloginfo( 'url' ) ).'/wp-admin/edit.php?post_type=wppb-roles-editor">', '</a>' )?></li>
288 <ul>
289 </td>
290 </tr>
291 <?php } ?>
292
293 <?php
294 if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
295 ?>
296 <tr>
297 <th scope="row">
298 <?php esc_html_e( '"Admin Approval" Feature:', 'profile-builder' ); ?>
299 </th>
300 <td>
301 <p><em> <?php printf( esc_html__( 'You decide who is a user on your website. Get notified via email or approve multiple users at once from the WordPress UI. Enable Admin Approval by upgrading to %1$sBasic or PRO versions%2$s.', 'profile-builder' ),'<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=general-settings-link&utm_campaign=PBFree">', '</a>' )?></em></p>
302 </td>
303 </tr>
304 <?php } ?>
305
306 <tr>
307 <th scope="row">
308 <?php esc_html_e( 'Allow Users to Log in With:', 'profile-builder' ); ?>
309 </th>
310 <td>
311 <select name="wppb_general_settings[loginWith]" class="wppb-select">
312 <option value="usernameemail" <?php if ( $wppb_generalSettings['loginWith'] == 'usernameemail' ) echo 'selected'; ?>><?php esc_html_e( 'Username and Email', 'profile-builder' ); ?></option>
313 <option value="username" <?php if ( $wppb_generalSettings['loginWith'] == 'username' ) echo 'selected'; ?>><?php esc_html_e( 'Username', 'profile-builder' ); ?></option>
314 <option value="email" <?php if ( $wppb_generalSettings['loginWith'] == 'email' ) echo 'selected'; ?>><?php esc_html_e( 'Email', 'profile-builder' ); ?></option>
315 </select>
316 <ul>
317 <li class="description"><?php esc_html_e( '"Username and Email" - users can Log In with either their Username or their Email.', 'profile-builder' ); ?></li>
318 <li class="description"><?php esc_html_e( '"Username" - users can only Log In with their Username. Both the Username and Email fields will be shown in the front-end forms.', 'profile-builder' ); ?></li>
319 <li class="description"><?php esc_html_e( '"Email" - users can only Log In with their Email. The Username field will be hidden in the front-end forms and Usernames will be automatically generated based on the Emails.', 'profile-builder' ); ?></li>
320 </ul>
321 </td>
322 </tr>
323
324 <tr>
325 <th scope="row">
326 <?php esc_html_e( 'Minimum Password Length:', 'profile-builder' ); ?>
327 </th>
328 <td>
329 <input type="text" name="wppb_general_settings[minimum_password_length]" class="wppb-text" value="<?php if( !empty( $wppb_generalSettings['minimum_password_length'] ) ) echo esc_attr( $wppb_generalSettings['minimum_password_length'] ); ?>"/>
330 <ul>
331 <li class="description"><?php esc_html_e( 'Enter the minimum characters the password should have. Leave empty for no minimum limit', 'profile-builder' ); ?> </li>
332 </ul>
333 </td>
334 </tr>
335
336 <tr>
337 <th scope="row">
338 <?php esc_html_e( 'Minimum Password Strength:', 'profile-builder' ); ?>
339 </th>
340 <td>
341 <select name="wppb_general_settings[minimum_password_strength]" class="wppb-select">
342 <option value=""><?php esc_html_e( 'Disabled', 'profile-builder' ); ?></option>
343 <option value="short" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'short' ) echo 'selected'; ?>><?php esc_html_e( 'Very weak', 'profile-builder' ); ?></option>
344 <option value="bad" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'bad' ) echo 'selected'; ?>><?php esc_html_e( 'Weak', 'profile-builder' ); ?></option>
345 <option value="good" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'good' ) echo 'selected'; ?>><?php esc_html_e( 'Medium', 'profile-builder' ); ?></option>
346 <option value="strong" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'strong' ) echo 'selected'; ?>><?php esc_html_e( 'Strong', 'profile-builder' ); ?></option>
347 </select>
348 </td>
349 </tr>
350
351 <tr>
352 <th scope="row">
353 <?php esc_html_e( 'Select Recover Password Page:', 'profile-builder' ); ?>
354 </th>
355 <td>
356 <select name="wppb_general_settings[lost_password_page]" class="wppb-select">
357 <option value=""> <?php esc_html_e( 'None', 'profile-builder' ); ?></option>
358 <?php
359 $args = array(
360 'post_type' => 'page',
361 'post_status' => 'publish',
362 'numberposts' => -1,
363 'orderby' => 'name',
364 'order' => 'ASC'
365 );
366 $pages = get_posts( $args );
367
368 foreach ( $pages as $key => $value ){
369 echo '<option value="'.esc_attr( $value->guid ).'"';
370 if ( isset( $wppb_generalSettings['lost_password_page'] ) && $wppb_generalSettings['lost_password_page'] == $value->guid )
371 echo ' selected';
372
373 echo '>' . esc_html( $value->post_title ) . '</option>';
374 }
375
376 ?>
377
378 </select>
379
380 <ul>
381 <li class="description"><?php printf( esc_html__( 'Select the page which contains the %1$s[wppb-recover-password]%2$s shortcode.', 'profile-builder' ), '<strong>','</strong>' ) ?> </li>
382 </ul>
383
384 </td>
385 </tr>
386
387 <?php do_action( 'wppb_extra_general_settings', $wppb_generalSettings ); ?>
388 </table>
389
390
391
392 <input type="hidden" name="action" value="update" />
393 <p class="submit"><input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Changes', 'profile-builder' ); ?>" /></p>
394 </form>
395 </div>
396
397 <?php
398 }
399
400
401 /*
402 * Function that sanitizes the general settings
403 *
404 * @param array $wppb_generalSettings
405 *
406 * @since v.2.0.7
407 */
408 function wppb_general_settings_sanitize( $wppb_generalSettings ) {
409 $wppb_generalSettings = apply_filters( 'wppb_general_settings_sanitize_extra', $wppb_generalSettings );
410
411 if( !empty( $wppb_generalSettings ) ){
412 foreach( $wppb_generalSettings as $settings_name => $settings_value ){
413 if( $settings_name == "minimum_password_length" || $settings_name == "activationLandingPage" )
414 $wppb_generalSettings[$settings_name] = filter_var( $settings_value, FILTER_SANITIZE_NUMBER_INT );
415 elseif( $settings_name == "extraFieldsLayout" || $settings_name == "emailConfirmation" || $settings_name == "adminApproval" || $settings_name == "loginWith" || $settings_name == "minimum_password_strength" )
416 $wppb_generalSettings[$settings_name] = filter_var( $settings_value, FILTER_SANITIZE_STRING );
417 elseif( $settings_name == "adminApprovalOnUserRole" ){
418 if( is_array( $settings_value ) && !empty( $settings_value ) ){
419 foreach( $settings_value as $key => $value ){
420 $wppb_generalSettings[$settings_name][$key] = filter_var( $value, FILTER_SANITIZE_STRING );
421 }
422 }
423 }
424 }
425 }
426
427 return $wppb_generalSettings;
428 }
429
430
431 /*
432 * Function that pushes settings errors to the user
433 *
434 * @since v.2.0.7
435 */
436 function wppb_general_settings_admin_notices() {
437 settings_errors( 'wppb_general_settings' );
438 }
439 add_action( 'admin_notices', 'wppb_general_settings_admin_notices' );
440
441
442 /*
443 * Function that return user roles
444 *
445 * @since v.2.2.0
446 *
447 * @return array
448 */
449 function wppb_adminApproval_onUserRole() {
450 global $wp_roles;
451
452 $wp_roles = new WP_Roles();
453
454 $roles = $wp_roles->get_names();
455
456 unset( $roles['administrator'] );
457
458 return $roles;
459 }
460