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 | admin/general-settings.php +1101 -185 2.0.64.0.3 View file →
@@ -1,186 +1,1102 @@
1 -<?php
2 -/**
3 - * Function that creates the "General Settings" submenu page
4 - *
5 - * @since v.2.0
6 - *
7 - * @return void
8 - */
9 -function wppb_register_general_settings_submenu_page() {
10 - add_submenu_page( 'profile-builder', __( 'General Settings', 'profilebuilder' ), __( 'General Settings', 'profilebuilder' ), 'manage_options', 'profile-builder-general-settings', 'wppb_general_settings_content' );
11 -}
12 -add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 );
13 -
14 -
15 -function wppb_generate_default_settings_defaults(){
16 - $wppb_general_settings = get_option( 'wppb_general_settings', 'not_found' );
17 -
18 - if ( $wppb_general_settings == 'not_found' )
19 - update_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'username' ) );
20 -}
21 -
22 -
23 -/**
24 - * Function that adds content to the "General Settings" submenu page
25 - *
26 - * @since v.2.0
27 - *
28 - * @return string
29 - */
30 -function wppb_general_settings_content() {
31 - wppb_generate_default_settings_defaults();
32 -?>
33 - <div class="wrap wppb-wrap">
34 - <form method="post" action="options.php#general-settings">
35 - <?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?>
36 - <?php settings_fields( 'wppb_general_settings' ); ?>
37 -
38 - <h2><?php _e( 'General Settings', 'profilebuilder' ); ?></h2>
39 - <table class="form-table">
40 - <tr>
41 - <th scope="row">
42 - <?php _e( "Load Profile Builder's own CSS file in the front-end:", "profilebuilder" ); ?>
43 - </th>
44 - <td>
45 - <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 _e( 'Yes', 'profilebuilder' ); ?></label>
46 - <ul>
47 - <li class="description"><?php printf( __( 'You can find the default file here: %1$s', 'profilebuilder' ), '<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>' ); ?></li>
48 - </ul>
49 - </td>
50 - </tr>
51 - <?php
52 - if ( !is_multisite() ){
53 - ?>
54 - <tr>
55 - <th scope="row">
56 - <?php _e( '"Email Confirmation" Activated:', 'profilebuilder' );?>
57 - </th>
58 - <td>
59 - <select name="wppb_general_settings[emailConfirmation]" class="wppb-select" id="wppb_settings_email_confirmation" onchange="wppb_display_page_select(this.value)">
60 - <option value="yes" <?php if ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profilebuilder' ); ?></option>
61 - <option value="no" <?php if ( $wppb_generalSettings['emailConfirmation'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profilebuilder' ); ?></option>
62 - </select>
63 - <ul>
64 - <li class="description"><?php _e( 'On single-site installations this works with front-end forms only. Recommended to redirect WP default registration to a Profile Builder one using "Custom Redirects" addon.', 'profilebuilder' ); ?></li>
65 - <li class="description"><?php _e( 'The "Email Confirmation" feature is active (by default) on WPMU installations.', 'profilebuilder' ); ?></li>
66 - <?php if ( is_multisite() || ( $wppb_generalSettings['emailConfirmation'] == 'yes' ) ) ?>
67 - <li class="description dynamic1"><?php printf( __( 'You can find a list of unconfirmed email addresses %1$sUsers > All Users > Email Confirmation%2$s.', 'profilebuilder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/users.php?page=unconfirmed_emails">', '</a>' )?></li>
68 - </ul>
69 - </td>
70 - </tr>
71 - <?php
72 - }else{
73 - echo '<input type="hidden" id="wppb_general_settings_hidden" value="multisite"/>';
74 - }
75 - ?>
76 -
77 - <tr id="wppb-settings-activation-page">
78 - <th scope="row">
79 - <?php _e( '"Email Confirmation" Landing Page:', 'profilebuilder' ); ?>
80 - </th>
81 - <td>
82 - <select name="wppb_general_settings[activationLandingPage]" class="wppb-select">
83 - <option value="" <?php if ( empty( $wppb_generalSettings['emailConfirmation'] ) ) echo 'selected'; ?>></option>
84 - <optgroup label="<?php _e( 'Existing Pages', 'profilebuilder' ); ?>">
85 - <?php
86 - $pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) );
87 -
88 - foreach ( $pages as $key => $value ){
89 - echo '<option value="'.$value->ID.'"';
90 - if ( $wppb_generalSettings['activationLandingPage'] == $value->ID )
91 - echo ' selected';
92 -
93 - echo '>' . $value->post_title . '</option>';
94 - }
95 - ?>
96 - </optgroup>
97 - </select>
98 - <p class="description">
99 - <?php _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.', 'profilebuilder' ); ?>
100 - </p>
101 - </td>
102 - </tr>
103 -
104 -
105 - <?php
106 - if ( file_exists( WPPB_PLUGIN_DIR.'/features/admin-approval/admin-approval.php' ) ){
107 - ?>
108 - <tr>
109 - <th scope="row">
110 - <?php _e( '"Admin Approval" Activated:', 'profilebuilder' ); ?>
111 - </th>
112 - <td>
113 - <select id="adminApprovalSelect" name="wppb_general_settings[adminApproval]" class="wppb-select" onchange="wppb_display_page_select_aa(this.value)">
114 - <option value="yes" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'yes' ) echo 'selected'; ?>><?php _e( 'Yes', 'profilebuilder' ); ?></option>
115 - <option value="no" <?php if( !empty( $wppb_generalSettings['adminApproval'] ) && $wppb_generalSettings['adminApproval'] == 'no' ) echo 'selected'; ?>><?php _e( 'No', 'profilebuilder' ); ?></option>
116 - </select>
117 - <ul>
118 - <li class="description dynamic2"><?php printf( __( 'You can find a list of users at %1$sUsers > All Users > Admin Approval%2$s.', 'profilebuilder' ), '<a href="'.get_bloginfo( 'url' ).'/wp-admin/users.php?page=admin_approval&orderby=registered&order=desc">', '</a>' )?></li>
119 - <ul>
120 - </td>
121 - </tr>
122 -
123 - <?php } ?>
124 -
125 - <?php
126 - if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
127 - ?>
128 - <tr>
129 - <th scope="row">
130 - <?php _e( '"Admin Approval" Feature:', 'profilebuilder' ); ?>
131 - </th>
132 - <td>
133 - <p><em> <?php printf( __( '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$sHobbyist or PRO versions%2$s.', 'profilebuilder' ),'<a href="http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=general-settings-link&utm_campaign=PBFree">', '</a>' )?></em></p>
134 - </td>
135 - </tr>
136 - <?php } ?>
137 -
138 - <tr>
139 - <th scope="row">
140 - <?php _e( 'Allow Users to Log in With:', 'profilebuilder' ); ?>
141 - </th>
142 - <td>
143 - <select name="wppb_general_settings[loginWith]" class="wppb-select">
144 - <option value="username" <?php if ( $wppb_generalSettings['loginWith'] == 'username' ) echo 'selected'; ?>><?php _e( 'Username', 'profilebuilder' ); ?></option>
145 - <option value="email" <?php if ( $wppb_generalSettings['loginWith'] == 'email' ) echo 'selected'; ?>><?php _e( 'Email', 'profilebuilder' ); ?></option>
146 - </select>
147 - </td>
148 - </tr>
149 -
150 - <tr>
151 - <th scope="row">
152 - <?php _e( 'Minimum Password Length:', 'profilebuilder' ); ?>
153 - </th>
154 - <td>
155 - <input type="text" name="wppb_general_settings[minimum_password_length]" class="wppb-text" value="<?php if( !empty( $wppb_generalSettings['minimum_password_length'] ) ) echo $wppb_generalSettings['minimum_password_length']; ?>"/>
156 - <ul>
157 - <li class="description"><?php _e( 'Enter the minimum characters the password should have. Leave empty for no minimum limit', 'profilebuilder' ); ?> </li>
158 - </ul>
159 - </td>
160 - </tr>
161 -
162 - <tr>
163 - <th scope="row">
164 - <?php _e( 'Minimum Password Strength:', 'profilebuilder' ); ?>
165 - </th>
166 - <td>
167 - <select name="wppb_general_settings[minimum_password_strength]" class="wppb-select">
168 - <option value=""><?php _e( 'Disabled', 'profilebuilder' ); ?></option>
169 - <option value="short" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'short' ) echo 'selected'; ?>><?php _e( 'Very weak', 'profilebuilder' ); ?></option>
170 - <option value="bad" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'bad' ) echo 'selected'; ?>><?php _e( 'Weak', 'profilebuilder' ); ?></option>
171 - <option value="good" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'good' ) echo 'selected'; ?>><?php _e( 'Medium', 'profilebuilder' ); ?></option>
172 - <option value="strong" <?php if ( !empty($wppb_generalSettings['minimum_password_strength']) && $wppb_generalSettings['minimum_password_strength'] == 'strong' ) echo 'selected'; ?>><?php _e( 'Strong', 'profilebuilder' ); ?></option>
173 - </select>
174 - </td>
175 - </tr>
176 - </table>
177 -
178 -
179 -
180 - <input type="hidden" name="action" value="update" />
181 - <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" /></p>
182 -</form>
183 -</div>
184 -
185 -<?php
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-content_restriction' => __( 'Content Restriction', 'profile-builder' ),
13 + 'profile-builder-private-website' => __( 'Private Website', 'profile-builder' ),
14 + 'profile-builder-toolbox-settings' => __( 'Advanced Settings', 'profile-builder' ),
15 + );
16 +
17 + //add tabs here for Advanced Settings
18 + $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['forms'] = __( 'Forms', 'profile-builder' );
19 + $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['fields'] = __( 'Fields', 'profile-builder' );
20 +
21 + 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' )
22 + $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['userlisting'] = __( 'Userlisting', 'profile-builder' );
23 +
24 + $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['shortcodes'] = __( 'Shortcodes', 'profile-builder' );
25 + $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['admin'] = __( 'Admin', 'profile-builder' );
26 +
27 + //add sub-pages here for email customizer
28 + if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){
29 +
30 + $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' );
31 + $settings_pages['sub-pages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' );
32 + $settings_pages['sub-pages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' );
33 +
34 + } else if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) {
35 + 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') ){
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 + }
41 +
42 + return $settings_pages;
43 +}
44 +
45 +/**
46 + * Function that generates the html for the tabs and subtabs on the settings page
47 + */
48 +function wppb_generate_settings_tabs(){
49 + ?>
50 + <nav class="nav-tab-wrapper cozmoslabs-nav-tab-wrapper">
51 + <?php
52 + $pages = wppb_get_settings_pages();
53 +
54 + $active_tab = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
55 + //if we are on a subpage we need to change the active tab to the parent
56 + if( !empty( $pages['sub-pages'] ) ) {
57 + foreach ($pages['sub-pages'] as $parent_slug => $subpages) {
58 + if (array_key_exists($active_tab, $subpages)) {
59 + $active_tab = $parent_slug;
60 + }
61 + }
62 + }
63 +
64 + foreach( $pages['pages'] as $page_slug => $tab_name ){
65 + 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>';
66 + }
67 + ?>
68 + </nav>
69 + <?php
70 +
71 + // this is not always the same as the active tab
72 + $active_subpage = sanitize_text_field($_GET['page']);
73 +
74 + if( !empty( $pages['sub-pages'] ) ) {
75 + foreach ($pages['sub-pages'] as $parent_slug => $subpages) {
76 + if (array_key_exists( sanitize_text_field( $active_subpage ), $subpages)) {
77 + echo '<ul class="wppb-subtabs subsubsub cozmoslabs-nav-sub-tab-wrapper">';
78 + foreach ($subpages as $subpage_slug => $subpage_name) {
79 + 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>';
80 + }
81 + echo '</ul>';
82 + }
83 + }
84 + }
85 +
86 + if( !empty( $pages['sub-tabs'] ) ) {
87 + foreach ($pages['sub-tabs'] as $parent_slug => $tabs) {
88 + if ( $active_subpage == $parent_slug) {
89 + echo '<ul class="wppb-subtabs subsubsub cozmoslabs-nav-sub-tab-wrapper">';
90 + //determine the active tab, if no tab present then default to the first one
91 + if( isset($_GET['tab']) )
92 + $active_tab = sanitize_text_field( $_GET['tab'] );
93 + else {
94 + $keys = array_keys($tabs);
95 + $active_tab = array_shift( $keys );
96 + }
97 + foreach ($tabs as $tab_slug => $tab_name) {
98 + 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>';
99 + }
100 + echo '</ul>';
101 + }
102 + }
103 + }
104 +}
105 +
106 +/**
107 + * Function that creates the "General Settings" submenu page
108 + *
109 + * @since v.2.0
110 + *
111 + * @return void
112 + */
113 +function wppb_register_general_settings_submenu_page() {
114 + add_submenu_page( 'profile-builder', __( 'Settings', 'profile-builder' ), __( 'Settings', 'profile-builder' ), 'manage_options', 'profile-builder-general-settings', 'wppb_general_settings_content' );
115 +}
116 +add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 );
117 +
118 +
119 +function wppb_generate_default_settings_defaults(){
120 + add_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'automaticallyLogIn' => 'No', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail', 'rolesEditor' => 'no', 'conditional_fields_ajax' => 'no', 'formsDesign' => 'form-style-default', 'hide_admin_bar_for' => '' ) );
121 +}
122 +
123 +
124 +/**
125 + * Function that adds content to the "General Settings" submenu page
126 + *
127 + * @since v.2.0
128 + *
129 + * @return string
130 + */
131 +function wppb_general_settings_content() {
132 + wppb_generate_default_settings_defaults();
133 +?>
134 + <div class="wrap wppb-wrap cozmoslabs-wrap">
135 +
136 + <h1></h1>
137 + <!-- WordPress Notices are added after the h1 tag -->
138 +
139 + <div class="cozmoslabs-page-header">
140 + <div class="cozmoslabs-section-title">
141 +
142 + <h2 class="cozmoslabs-page-title">
143 + <?php esc_html_e( 'Profile Builder Settings', 'profile-builder' ); ?>
144 + <a href="https://www.cozmoslabs.com/docs/profile-builder/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>
145 + </h2>
146 +
147 + </div>
148 + </div>
149 +
150 + <?php settings_errors(); ?>
151 +
152 + <?php wppb_generate_settings_tabs(); ?>
153 +
154 + <?php wppb_load_necessary_scripts(); ?>
155 +
156 + <div class="cozmoslabs-settings-container">
157 +
158 + <?php if ( !is_multisite() && defined( 'WPPB_PAID_PLUGIN_DIR' ) && defined( 'PROFILE_BUILDER_PAID_VERSION' ) ) : ?>
159 + <div class="cozmoslabs-form-subsection-wrapper" id="wppb-register-version">
160 + <?php wppb_add_register_version_form(); ?>
161 + </div>
162 + <?php endif; ?>
163 +
164 + <form method="post" action="options.php#general-settings">
165 + <?php $wppb_generalSettings = get_option( 'wppb_general_settings' ); ?>
166 + <?php settings_fields( 'wppb_general_settings' ); ?>
167 +
168 + <div class="cozmoslabs-settings">
169 +
170 + <?php if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/form-designs/form-designs.php' ) ) : ?>
171 + <div class="cozmoslabs-form-subsection-wrapper" id="wppb-form_desings">
172 + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Design & User Experience', 'profile-builder' ); ?></h4>
173 + <p class="cozmoslabs-description" style="margin-bottom: 5px;"><?php esc_html_e( 'Choose a style that better suits your website.', 'profile-builder' ); ?></p>
174 + <p class="cozmoslabs-description"><?php esc_html_e( 'The default style is there to let you customize the CSS and in general will receive the look and feel from your own theme’s styling.', 'profile-builder' ); ?></p>
175 +
176 + <div class="cozmoslabs-form-field-wrapper">
177 + <?php echo wppb_render_forms_design_selector(); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
178 + </div>
179 + </div>
180 + <?php endif; ?>
181 +
182 + <div class="cozmoslabs-form-subsection-wrapper">
183 + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Optimize The login and Registration flow for your members', 'profile-builder' ); ?></h4>
184 +
185 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
186 + <label class="cozmoslabs-form-field-label" for="wppb_settings_automatically_log_in"><?php esc_html_e('Automatically Log In', 'profile-builder'); ?></label>
187 +
188 + <div class="cozmoslabs-toggle-container">
189 + <input type="checkbox" name="wppb_general_settings[automaticallyLogIn]" id="wppb_settings_automatically_log_in" value="Yes" <?php echo (!empty($wppb_generalSettings['automaticallyLogIn']) && $wppb_generalSettings['automaticallyLogIn'] === 'Yes') ? 'checked' : ''; ?> >
190 + <label class="cozmoslabs-toggle-track" for="wppb_settings_automatically_log_in"></label>
191 + </div>
192 +
193 + <div class="cozmoslabs-toggle-description">
194 + <label for="wppb_settings_automatically_log_in" class="cozmoslabs-description"><?php esc_html_e( 'Enable to automatically log in new users after successful registration.', 'profile-builder' ); ?></label>
195 + </div>
196 + </div>
197 +
198 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
199 + <label class="cozmoslabs-form-field-label" for="wppb_settings_email_confirmation"><?php esc_html_e('Email Confirmation', 'profile-builder'); ?></label>
200 +
201 +
202 + <div class="cozmoslabs-toggle-container">
203 +
204 + <input type="checkbox" name="wppb_general_settings[emailConfirmation]" id="wppb_settings_email_confirmation" value="yes" <?php echo (!empty($wppb_generalSettings['emailConfirmation']) && $wppb_generalSettings['emailConfirmation'] === 'yes') ? 'checked' : ''; ?> >
205 + <label class="cozmoslabs-toggle-track" for="wppb_settings_email_confirmation"></label>
206 +
207 + </div>
208 + <div class="cozmoslabs-toggle-description">
209 + <label for="wppb_settings_email_confirmation" class="cozmoslabs-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' ); ?></label>
210 + </div>
211 +
212 + <p class="cozmoslabs-description cozmoslabs-description-space-left" id="unconfirmed-user-emails"><?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>' )?></p>
213 + </div>
214 +
215 + <div class="cozmoslabs-form-field-wrapper" id="wppb-settings-activation-page">
216 + <label class="cozmoslabs-form-field-label" for="wppb_settings_email_confirmation_page"><?php esc_html_e('Email Confirmation Page', 'profile-builder'); ?></label>
217 +
218 + <select name="wppb_general_settings[activationLandingPage]" class="wppb-select" id="wppb_settings_email_confirmation_page">
219 + <option value="" <?php if ( empty( $wppb_generalSettings['emailConfirmation'] ) ) echo 'selected'; ?>></option>
220 + <optgroup label="<?php esc_html_e( 'Existing Pages', 'profile-builder' ); ?>">
221 + <?php
222 + $pages = get_pages( apply_filters( 'wppb_page_args_filter', array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'post_type' => 'page', 'post_status' => array( 'publish' ) ) ) );
223 +
224 + foreach ( $pages as $key => $value ){
225 + echo '<option value="'.esc_attr( $value->ID ).'"';
226 + if ( $wppb_generalSettings['activationLandingPage'] == $value->ID )
227 + echo ' selected';
228 +
229 + echo '>' . esc_html( $value->post_title ) . '</option>';
230 + }
231 + ?>
232 + </optgroup>
233 + </select>
234 +
235 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?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.', 'profile-builder' ); ?></p>
236 + </div>
237 +
238 + <?php
239 + if ( PROFILE_BUILDER == 'Profile Builder Free' ) {
240 + ?>
241 +
242 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
243 + <label class="cozmoslabs-form-field-label"><?php esc_html_e('Admin Approval', 'profile-builder'); ?></label>
244 +
245 + <p class="cozmoslabs-description cozmoslabs-description-align-right cozmoslabs-description-upsell">
246 + <?php echo 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.', 'profile-builder' ); ?><br>
247 + <?php printf( esc_html__( '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=pb-general-settings&utm_medium=client-site&utm_campaign=pb-admin-approval#pricing">', '</a>' )?>
248 + </p>
249 + </div>
250 +
251 + <?php } ?>
252 +
253 +
254 + <?php
255 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR.'/features/admin-approval/admin-approval.php' ) ){
256 + ?>
257 +
258 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
259 + <label class="cozmoslabs-form-field-label" for="adminApprovalSelect"><?php esc_html_e('Admin Approval', 'profile-builder'); ?></label>
260 +
261 + <div class="cozmoslabs-toggle-container">
262 + <input type="checkbox" name="wppb_general_settings[adminApproval]" id="adminApprovalSelect" value="yes" <?php echo (!empty($wppb_generalSettings['adminApproval']) && $wppb_generalSettings['adminApproval'] === 'yes') ? 'checked' : ''; ?> >
263 + <label class="cozmoslabs-toggle-track" for="adminApprovalSelect"></label>
264 + </div>
265 +
266 + <div class="cozmoslabs-toggle-description">
267 + <label for="adminApprovalSelect" class="cozmoslabs-description wppb-aa-details"><?php esc_html_e( 'Each user that registers on the website will be given a Pending status and will need to be approved or unapproved by the admin before he/she can login.', 'profile-builder' ); ?></label>
268 + </div>
269 +
270 + <p class="cozmoslabs-description cozmoslabs-description-space-left wppb-aa-user-list"><?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>' )?></p>
271 + </div>
272 +
273 + <div class="cozmoslabs-form-field-wrapper wppb-aa-user-list">
274 + <label class="cozmoslabs-form-field-label" for="adminApprovalOnUserRoleSelect"><?php esc_html_e('Admin Approval User Role', 'profile-builder'); ?></label>
275 +
276 + <select name="wppb_general_settings[adminApprovalOnUserRole][]" class="wppb-select wppb-select2" multiple>
277 + <?php
278 + $wppb_userRoles = wppb_adminApproval_onUserRole();
279 +
280 + if( ! empty( $wppb_userRoles ) ) {
281 + foreach( $wppb_userRoles as $role => $role_name ) {
282 +
283 + echo '<option value="' . esc_attr( $role ) . '"' . (( !empty( $wppb_generalSettings['adminApprovalOnUserRole'] ) && in_array( $role, $wppb_generalSettings['adminApprovalOnUserRole'] ) ) || empty( $wppb_generalSettings['adminApprovalOnUserRole']) ? ' selected' : '') . '>' . esc_html( $role_name ) . '</option>';
284 +
285 + }
286 + }
287 + ?>
288 + </select>
289 + </div>
290 +
291 + <?php } ?>
292 +
293 + <div class="cozmoslabs-form-field-wrapper">
294 + <label class="cozmoslabs-form-field-label" for="loginWithSelect"><?php esc_html_e( 'Allow Users to Log in With:', 'profile-builder' ); ?></label>
295 +
296 + <select name="wppb_general_settings[loginWith]" class="wppb-select" id="loginWithSelect">
297 + <option value="usernameemail" <?php if ( $wppb_generalSettings['loginWith'] == 'usernameemail' ) echo 'selected'; ?>><?php esc_html_e( 'Username and Email', 'profile-builder' ); ?></option>
298 + <option value="username" <?php if ( $wppb_generalSettings['loginWith'] == 'username' ) echo 'selected'; ?>><?php esc_html_e( 'Username', 'profile-builder' ); ?></option>
299 + <option value="email" <?php if ( $wppb_generalSettings['loginWith'] == 'email' ) echo 'selected'; ?>><?php esc_html_e( 'Email', 'profile-builder' ); ?></option>
300 + </select>
301 +
302 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Choose what the user will be logging in with.', 'profile-builder' ); ?></p>
303 + </div>
304 +
305 + </div>
306 +
307 + <div class="cozmoslabs-form-subsection-wrapper">
308 + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Security', 'profile-builder' ); ?></h4>
309 +
310 + <div class="cozmoslabs-form-field-wrapper">
311 + <label class="cozmoslabs-form-field-label" for="minimumPasswordLength"><?php esc_html_e( 'Minimum Password Length', 'profile-builder' ); ?></label>
312 + <input type="text" name="wppb_general_settings[minimum_password_length]" class="wppb-text" id="minimumPasswordLength" value="<?php if( !empty( $wppb_generalSettings['minimum_password_length'] ) ) echo esc_attr( $wppb_generalSettings['minimum_password_length'] ); ?>"/>
313 +
314 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Enter the minimum characters the password should have. Leave empty for no minimum limit', 'profile-builder' ); ?></p>
315 + </div>
316 +
317 +
318 + <div class="cozmoslabs-form-field-wrapper">
319 + <label class="cozmoslabs-form-field-label" for="minimumPasswordStrength"><?php esc_html_e( 'Minimum Password Strength', 'profile-builder' ); ?></label>
320 +
321 + <select name="wppb_general_settings[minimum_password_strength]" class="wppb-select" id="minimumPasswordStrength">
322 + <option value=""><?php esc_html_e( 'Disabled', 'profile-builder' ); ?></option>
323 + <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>
324 + <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>
325 + <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>
326 + <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>
327 + </select>
328 +
329 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'A stronger password strength will probably force the user to not reuse passwords from other websites.', 'profile-builder' ); ?></p>
330 + </div>
331 +
332 +
333 + <div class="cozmoslabs-form-field-wrapper">
334 + <label class="cozmoslabs-form-field-label" for="lostPasswordPage"><?php esc_html_e( 'Password Recovery Page', 'profile-builder' ); ?></label>
335 +
336 + <select name="wppb_general_settings[lost_password_page]" class="wppb-select" id="lostPasswordPage">
337 + <option value=""> <?php esc_html_e( 'None', 'profile-builder' ); ?></option>
338 + <?php
339 + $args = array(
340 + 'post_type' => 'page',
341 + 'post_status' => 'publish',
342 + 'numberposts' => -1,
343 + 'orderby' => 'name',
344 + 'order' => 'ASC'
345 + );
346 + $pages = get_posts( $args );
347 +
348 + foreach ( $pages as $key => $value ){
349 + echo '<option value="'.esc_attr( $value->guid ).'"';
350 + if ( isset( $wppb_generalSettings['lost_password_page'] ) && $wppb_generalSettings['lost_password_page'] == $value->guid )
351 + echo ' selected';
352 +
353 + echo '>' . esc_html( $value->post_title ) . '</option>';
354 + }
355 + ?>
356 + </select>
357 +
358 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Select the page which contains the "[wppb-recover-password]" shortcode.', 'profile-builder' ); ?></p>
359 + </div>
360 + </div>
361 +
362 + <?php if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ) ) : ?>
363 + <div class="cozmoslabs-form-subsection-wrapper">
364 + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Two-Factor Authentication', 'profile-builder' ); ?></h4>
365 +
366 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
367 + <?php
368 + $wppb_two_factor_authentication_settings = get_option( 'wppb_two_factor_authentication_settings', 'not_found' );
369 +
370 + $enabled = 'no';
371 + if ( $wppb_two_factor_authentication_settings !== 'not_found' && is_array( $wppb_two_factor_authentication_settings ) && isset( $wppb_two_factor_authentication_settings['enabled'] ) ) {
372 + $enabled = $wppb_two_factor_authentication_settings['enabled'];
373 + }
374 + ?>
375 +
376 + <label class="cozmoslabs-form-field-label" for="wppb-auth-enable"><?php esc_html_e('Two-Factor Authentication', 'profile-builder'); ?></label>
377 +
378 + <div class="cozmoslabs-toggle-container">
379 + <input type="checkbox" name="wppb_two_factor_authentication_settings[enabled]" id="wppb-auth-enable" value="yes" <?php echo ($enabled === 'yes') ? 'checked' : ''; ?> >
380 + <label class="cozmoslabs-toggle-track" for="wppb-auth-enable"></label>
381 + </div>
382 +
383 + <?php
384 + $current_user = wp_get_current_user();
385 + ?>
386 +
387 + <script type="text/javascript">
388 + jQuery(document).ready(function($) {
389 + // Handle 2FA enable toggle
390 + $('#wppb-auth-enable').on('change', function() {
391 + if ($(this).is(':checked')) {
392 + $('#wppb-auth-roles-selector').show();
393 + $('#wppb-force-2fa-enable').closest('.cozmoslabs-form-field-wrapper').show();
394 + $('#wppb-2fa-require-totp-profile-edit').show();
395 + if ($('#wppb-force-2fa-enable').is(':checked')) {
396 + $('#wppb-force-2fa-roles-selector').show();
397 + $('#wppb-force-2fa-grace-period').show();
398 + $('#wppb-force-2fa-edit-profile-page-selector').show();
399 +
400 + }
401 + } else {
402 + $('#wppb-auth-roles-selector').hide();
403 + $('#wppb-force-2fa-enable').closest('.cozmoslabs-form-field-wrapper').hide();
404 + $('#wppb-force-2fa-roles-selector').hide();
405 + $('#wppb-force-2fa-grace-period').hide();
406 + $('#wppb-force-2fa-edit-profile-page-selector').hide();
407 +
408 + $('#wppb-2fa-require-totp-profile-edit').hide();
409 + }
410 + });
411 +
412 + // Handle force 2FA enable toggle
413 + $('#wppb-force-2fa-enable').on('change', function() {
414 + if ($(this).is(':checked')) {
415 + $('#wppb-force-2fa-roles-selector').show();
416 + $('#wppb-force-2fa-grace-period').show();
417 + $('#wppb-force-2fa-edit-profile-page-selector').show();
418 +
419 + } else {
420 + $('#wppb-force-2fa-roles-selector').hide();
421 + $('#wppb-force-2fa-grace-period').hide();
422 + $('#wppb-force-2fa-edit-profile-page-selector').hide();
423 +
424 + }
425 + });
426 +
427 + // Handle changes to "Enable Authenticator For" roles
428 + $('#wppb-auth-enable-roles').on('change', function() {
429 + updateForce2FARolesDropdown();
430 + });
431 +
432 + // Function to update the Force 2FA roles dropdown based on enabled roles
433 + function updateForce2FARolesDropdown() {
434 + var enabledRoles = $('#wppb-auth-enable-roles').val() || [];
435 + var force2FARolesSelect = $('#wppb-force-2fa-roles');
436 + var currentlySelected = force2FARolesSelect.val() || [];
437 +
438 + // Clear current options
439 + force2FARolesSelect.empty();
440 +
441 + // Get all available roles from the original select
442 + var allRoleOptions = $('#wppb-auth-enable-roles option');
443 +
444 + // If '*' (all roles) is selected, show all roles
445 + if (enabledRoles.indexOf('*') !== -1) {
446 + allRoleOptions.each(function() {
447 + var roleValue = $(this).val();
448 + if (roleValue !== '*') { // Skip the "ALL ROLES" option
449 + var option = $('<option></option>')
450 + .attr('value', roleValue)
451 + .text($(this).text());
452 + if (currentlySelected.indexOf(roleValue) !== -1) {
453 + option.prop('selected', true);
454 + }
455 + force2FARolesSelect.append(option);
456 + }
457 + });
458 + } else {
459 + // Only show roles that are specifically enabled for 2FA
460 + enabledRoles.forEach(function(roleKey) {
461 + allRoleOptions.each(function() {
462 + if ($(this).val() === roleKey) {
463 + var option = $('<option></option>')
464 + .attr('value', roleKey)
465 + .text($(this).text());
466 + if (currentlySelected.indexOf(roleKey) !== -1) {
467 + option.prop('selected', true);
468 + }
469 + force2FARolesSelect.append(option);
470 + }
471 + });
472 + });
473 + }
474 +
475 + // Trigger select2 update
476 + force2FARolesSelect.trigger('change');
477 + }
478 +
479 + // Initial state
480 + $('#wppb-auth-enable').trigger('change');
481 + updateForce2FARolesDropdown();
482 +
483 + // Force 2FA Confirmation Logic
484 + var currentUserRoles = <?php echo json_encode( $current_user->roles ); ?>;
485 + var currentUser2FAEnabled = <?php echo ( get_user_option( 'wppb_auth_enabled', $current_user->ID ) === 'enabled' ) ? 'true' : 'false'; ?>;
486 +
487 + // Store initial state
488 + var initialForce2FAEnabled = $('#wppb-force-2fa-enable').is(':checked');
489 + var initialMain2FAEnabled = $('#wppb-auth-enable').is(':checked');
490 + var initialSelectedRoles = $('#wppb-force-2fa-roles').val() || [];
491 + initialSelectedRoles.sort();
492 +
493 + // Create Modal
494 + $('body').append(
495 + '<div id="wppb-force-2fa-modal" style="display:none; position:fixed; z-index:10000; left:0; top:0; width:100%; height:100%; overflow:auto; background-color:rgba(0,0,0,0.4);">' +
496 + '<div style="background-color:#fefefe; margin:15% auto; padding:20px; border:1px solid #888; width:500px; max-width:90%; border-radius:4px; box-shadow:0 4px 6px rgba(0,0,0,0.1);">' +
497 + '<h3 style="margin-top:0;">' + <?php echo json_encode( esc_html__( 'Confirm Two-Factor Authentication Enforcement', 'profile-builder' ) ); ?> + '</h3>' +
498 + '<div id="wppb-force-2fa-message"></div>' +
499 + '<div style="margin-top:20px; text-align:right;">' +
500 + '<button type="button" id="wppb-force-2fa-cancel" class="button">' + <?php echo json_encode( esc_html__( 'Cancel', 'profile-builder' ) ); ?> + '</button> ' +
501 + '<button type="button" id="wppb-force-2fa-confirm" class="button button-primary">' + <?php echo json_encode( esc_html__( 'Confirm & Save', 'profile-builder' ) ); ?> + '</button>' +
502 + '</div>' +
503 + '</div>' +
504 + '</div>'
505 + );
506 +
507 + // Intercept form submission
508 + $('form').on('submit', function(e) {
509 + // Only check if we are on the general settings page and submitting the main form
510 + if ($(this).find('input[name="option_page"]').val() !== 'wppb_general_settings') {
511 + return;
512 + }
513 +
514 + var force2FAEnabled = $('#wppb-force-2fa-enable').is(':checked');
515 + var main2FAEnabled = $('#wppb-auth-enable').is(':checked');
516 + var selectedRoles = $('#wppb-force-2fa-roles').val() || [];
517 + selectedRoles.sort();
518 +
519 + // Check if settings have changed
520 + var settingsChanged = false;
521 +
522 + // Case 1: Force 2FA Enabled status changed
523 + if (force2FAEnabled !== initialForce2FAEnabled) {
524 + settingsChanged = true;
525 + }
526 +
527 + // Case 2: Roles selection changed (only if Force 2FA is enabled)
528 + if (force2FAEnabled) {
529 + if (selectedRoles.length !== initialSelectedRoles.length) {
530 + settingsChanged = true;
531 + } else {
532 + for (var i = 0; i < selectedRoles.length; i++) {
533 + if (selectedRoles[i] !== initialSelectedRoles[i]) {
534 + settingsChanged = true;
535 + break;
536 + }
537 + }
538 + }
539 + }
540 +
541 + // Case 3: Main 2FA enabled status changed (only if Force 2FA is enabled)
542 + // This covers the case where Force 2FA was already checked but inactive because Main 2FA was off
543 + if (force2FAEnabled && main2FAEnabled !== initialMain2FAEnabled) {
544 + settingsChanged = true;
545 + }
546 +
547 + // Only show popup if Force 2FA is enabled AND Main 2FA is enabled AND settings have changed
548 + if (force2FAEnabled && main2FAEnabled && settingsChanged) {
549 + // Check if we already confirmed
550 + if ($(this).data('force-2fa-confirmed')) {
551 + return;
552 + }
553 +
554 + var selectedRolesText = [];
555 +
556 + $('#wppb-force-2fa-roles option:selected').each(function() {
557 + selectedRolesText.push($(this).text());
558 + });
559 +
560 + if (selectedRoles.length > 0) {
561 + e.preventDefault();
562 + var form = $(this);
563 +
564 + var message = '<p>' + <?php echo json_encode( esc_html__( 'You are enforcing 2FA for the following user roles:', 'profile-builder' ) ); ?> + ' <strong>' + selectedRolesText.join(', ') + '</strong>.</p>';
565 + message += '<p>' + <?php echo json_encode( esc_html__( 'Users with these roles will be required to set up 2FA on their next login.', 'profile-builder' ) ); ?> + '</p>';
566 +
567 + // Check if current user is affected
568 + var userAffected = false;
569 + for (var i = 0; i < currentUserRoles.length; i++) {
570 + if (selectedRoles.indexOf(currentUserRoles[i]) !== -1) {
571 + userAffected = true;
572 + break;
573 + }
574 + }
575 +
576 + if (userAffected && !currentUser2FAEnabled) {
577 + message += '<div class="notice notice-warning inline" style="margin: 10px 0; padding: 10px; display: block !important;"><p><strong>' + <?php echo json_encode( esc_html__( 'Warning:', 'profile-builder' ) ); ?> + '</strong> ' +
578 + <?php echo json_encode( esc_html__( 'Based on the configured settings, your account is also required to set up 2FA. Once you confirm this change, you will be redirected to set it up.', 'profile-builder' ) ); ?> + '</p></div>';
579 + }
580 +
581 + $('#wppb-force-2fa-message').html(message);
582 + $('#wppb-force-2fa-modal').show();
583 +
584 + // Handle Confirm
585 + $('#wppb-force-2fa-confirm').off('click').on('click', function() {
586 + $('#wppb-force-2fa-modal').hide();
587 + form.data('force-2fa-confirmed', true);
588 + form.submit();
589 + });
590 +
591 + // Handle Cancel
592 + $('#wppb-force-2fa-cancel').off('click').on('click', function() {
593 + $('#wppb-force-2fa-modal').hide();
594 + });
595 + }
596 + }
597 + });
598 + });
599 + </script>
600 +
601 + <div class="cozmoslabs-toggle-description">
602 + <label for="wppb-auth-enable" class="cozmoslabs-description"><?php esc_html_e( 'Enable the Google Authenticator functionality.', 'profile-builder' ); ?></label>
603 + </div>
604 + </div>
605 +
606 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch" id="wppb-2fa-require-totp-profile-edit" <?php echo $enabled === 'no' ? 'style="display: none;"' : '' ?> >
607 + <?php
608 + $require_totp_profile_edit = 'yes';
609 + if ( $wppb_two_factor_authentication_settings !== 'not_found' && is_array( $wppb_two_factor_authentication_settings ) && isset( $wppb_two_factor_authentication_settings['require_totp_profile_edit'] ) ) {
610 + $require_totp_profile_edit = $wppb_two_factor_authentication_settings['require_totp_profile_edit'];
611 + }
612 + ?>
613 +
614 +
615 + <label class="cozmoslabs-form-field-label" for="wppb-require-totp-profile-edit"><?php esc_html_e('Require TOTP Verification on Profile Edit', 'profile-builder'); ?></label>
616 +
617 + <div class="cozmoslabs-toggle-container">
618 + <input type="checkbox" name="wppb_two_factor_authentication_settings[require_totp_profile_edit]" id="wppb-require-totp-profile-edit" value="yes" <?php echo ($require_totp_profile_edit === 'yes') ? 'checked' : ''; ?> >
619 + <label class="cozmoslabs-toggle-track" for="wppb-require-totp-profile-edit"></label>
620 + </div>
621 +
622 + <div class="cozmoslabs-toggle-description">
623 + <label for="wppb-require-totp-profile-edit" class="cozmoslabs-description"><?php esc_html_e( 'Require users with Two-Factor Authentication enabled to verify their TOTP code every time they edit their profile. This setting is enabled by default.', 'profile-builder' ); ?></label>
624 + </div>
625 + </div>
626 +
627 + <div class="cozmoslabs-form-field-wrapper" id="wppb-auth-roles-selector" <?php echo $enabled === 'no' ? 'style="display: none;"' : '' ?> >
628 + <?php
629 + $roles = get_editable_roles( );
630 + $network_roles = array( );
631 + if ( !empty( $wppb_two_factor_authentication_settings['roles'] ) )
632 + $network_roles = is_array( $wppb_two_factor_authentication_settings['roles'] ) ? $wppb_two_factor_authentication_settings['roles'] : array( $wppb_two_factor_authentication_settings['roles'] );
633 + ?>
634 +
635 + <label class="cozmoslabs-form-field-label" for="wppb-auth-enable-roles"><?php esc_html_e( 'Enable Authenticator For', 'profile-builder' ); ?></label>
636 +
637 + <select name="wppb_two_factor_authentication_settings[roles][]" id="wppb-auth-enable-roles" class="wppb-select wppb-select2" multiple>
638 + <?php
639 + echo '<option value="*"' . (in_array('*', $network_roles, true) ? ' selected' : '') . '>'. esc_html__('ALL ROLES', 'profile-builder') .'</option>';
640 +
641 + foreach ($roles as $role_key => $role) {
642 + echo '<option value="' . esc_attr($role_key) . '"' . (in_array($role_key, $network_roles, true) ? ' selected' : '') . '>' . esc_html($role['name']) . '</option>';
643 + }
644 + ?>
645 + </select>
646 +
647 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( '"ALL ROLES" - Two-Factor Authentication will be enabled for all user roles.', 'profile-builder' ); ?></p>
648 + </div>
649 +
650 + <hr style="margin: 20px 0; border: 0; border-top: 1px solid #ddd;">
651 +
652 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
653 + <?php
654 + $force_2fa_enabled = 'no';
655 + if ( $wppb_two_factor_authentication_settings !== 'not_found' && is_array( $wppb_two_factor_authentication_settings ) && isset( $wppb_two_factor_authentication_settings['force_2fa_enabled'] ) ) {
656 + $force_2fa_enabled = $wppb_two_factor_authentication_settings['force_2fa_enabled'];
657 + }
658 + ?>
659 +
660 + <label class="cozmoslabs-form-field-label" for="wppb-force-2fa-enable"><?php esc_html_e('Force 2FA for Selected Roles', 'profile-builder'); ?></label>
661 +
662 + <div class="cozmoslabs-toggle-container">
663 + <input type="checkbox" name="wppb_two_factor_authentication_settings[force_2fa_enabled]" id="wppb-force-2fa-enable" value="yes" <?php echo ($force_2fa_enabled === 'yes') ? 'checked' : ''; ?> >
664 + <label class="cozmoslabs-toggle-track" for="wppb-force-2fa-enable"></label>
665 + </div>
666 +
667 + <div class="cozmoslabs-toggle-description">
668 + <label for="wppb-force-2fa-enable" class="cozmoslabs-description"><?php esc_html_e( 'Force users with selected roles to set up Two-Factor Authentication. Users will be redirected to their profile page if 2FA is not configured.', 'profile-builder' ); ?></label>
669 + </div>
670 + </div>
671 +
672 + <div class="cozmoslabs-form-field-wrapper" id="wppb-force-2fa-roles-selector" <?php echo $force_2fa_enabled === 'no' ? 'style="display: none;"' : '' ?> >
673 + <?php
674 + $force_2fa_roles = array( );
675 + if ( !empty( $wppb_two_factor_authentication_settings['force_2fa_roles'] ) )
676 + $force_2fa_roles = is_array( $wppb_two_factor_authentication_settings['force_2fa_roles'] ) ? $wppb_two_factor_authentication_settings['force_2fa_roles'] : array( $wppb_two_factor_authentication_settings['force_2fa_roles'] );
677 + ?>
678 +
679 + <label class="cozmoslabs-form-field-label" for="wppb-force-2fa-roles"><?php esc_html_e( 'Force 2FA For', 'profile-builder' ); ?></label>
680 +
681 + <select name="wppb_two_factor_authentication_settings[force_2fa_roles][]" id="wppb-force-2fa-roles" class="wppb-select wppb-select2" multiple>
682 + <?php
683 + // Only show roles that are enabled for 2FA
684 + $enabled_roles = isset( $wppb_two_factor_authentication_settings['roles'] ) ?
685 + $wppb_two_factor_authentication_settings['roles'] : array();
686 +
687 + // If '*' (all roles) is selected, show all roles
688 + if ( in_array( '*', $enabled_roles, true ) ) {
689 + foreach ($roles as $role_key => $role) {
690 + echo '<option value="' . esc_attr($role_key) . '"' . (in_array($role_key, $force_2fa_roles, true) ? ' selected' : '') . '>' . esc_html($role['name']) . '</option>';
691 + }
692 + } else {
693 + // Only show roles that are specifically enabled for 2FA
694 + foreach ($enabled_roles as $enabled_role) {
695 + if ( isset( $roles[$enabled_role] ) ) {
696 + echo '<option value="' . esc_attr($enabled_role) . '"' . (in_array($enabled_role, $force_2fa_roles, true) ? ' selected' : '') . '>' . esc_html($roles[$enabled_role]['name']) . '</option>';
697 + }
698 + }
699 + }
700 + ?>
701 + </select>
702 +
703 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Select which user roles will be forced to set up Two-Factor Authentication. Only roles that have 2FA enabled above are available.', 'profile-builder' ); ?></p>
704 + </div>
705 +
706 + <div class="cozmoslabs-form-field-wrapper" id="wppb-force-2fa-grace-period" <?php echo $force_2fa_enabled === 'no' ? 'style="display: none;"' : '' ?> >
707 + <?php
708 + $grace_period_days = 0;
709 + if ( !empty( $wppb_two_factor_authentication_settings['grace_period_days'] ) )
710 + $grace_period_days = intval( $wppb_two_factor_authentication_settings['grace_period_days'] );
711 + ?>
712 +
713 + <label class="cozmoslabs-form-field-label" for="wppb-force-2fa-grace-period-days"><?php esc_html_e( 'Grace Period', 'profile-builder' ); ?></label>
714 +
715 + <input type="number" name="wppb_two_factor_authentication_settings[grace_period_days]" id="wppb-force-2fa-grace-period-days" class="wppb-text" min="0" max="365" value="<?php echo esc_attr( $grace_period_days ); ?>" />
716 +
717 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Number of days users have to set up Two-Factor Authentication. Set to 0 for immediate enforcement.', 'profile-builder' ); ?></p>
718 + </div>
719 +
720 + <div class="cozmoslabs-form-field-wrapper" id="wppb-force-2fa-edit-profile-page-selector" <?php echo $force_2fa_enabled === 'no' ? 'style="display: none;"' : '' ?> >
721 + <?php
722 + $edit_profile_page_id = 'admin';
723 + if ( !empty( $wppb_two_factor_authentication_settings['edit_profile_page_id'] ) ) {
724 + $edit_profile_page_id = $wppb_two_factor_authentication_settings['edit_profile_page_id'];
725 + }
726 +
727 + // Get pages with Edit Profile shortcode or block
728 + $edit_profile_pages = array();
729 + if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' ) ) {
730 + require_once( WPPB_PAID_PLUGIN_DIR . '/features/two-factor-authentication/class-two-factor-authentication.php' );
731 + // The method only exists in paid add-on versions matching this base plugin; guard against a stale add-on to avoid a fatal error.
732 + if ( method_exists( 'WPPB_Two_Factor_Authenticator', 'get_edit_profile_pages' ) ) {
733 + $edit_profile_pages = WPPB_Two_Factor_Authenticator::get_edit_profile_pages();
734 + }
735 + }
736 + ?>
737 +
738 + <label class="cozmoslabs-form-field-label" for="wppb-force-2fa-edit-profile-page"><?php esc_html_e( 'Redirect to Edit Profile Page', 'profile-builder' ); ?></label>
739 +
740 + <select name="wppb_two_factor_authentication_settings[edit_profile_page_id]" id="wppb-force-2fa-edit-profile-page" class="wppb-select">
741 + <option value="admin" <?php selected( $edit_profile_page_id, 'admin' ); ?>><?php esc_html_e( 'Admin Profile Page', 'profile-builder' ); ?></option>
742 + <?php
743 + if ( !empty( $edit_profile_pages ) ) {
744 + foreach ( $edit_profile_pages as $page ) {
745 + echo '<option value="' . esc_attr( $page['ID'] ) . '" ' . selected( $edit_profile_page_id, $page['ID'], false ) . '>' . esc_html( $page['title'] ) . '</option>';
746 + }
747 + }
748 + ?>
749 + </select>
750 +
751 + <div class="cozmoslabs-description cozmoslabs-description-space-left">
752 + <?php
753 + if ( empty( $edit_profile_pages ) ) {
754 + echo '<div class="cozmoslabs-description cozmoslabs-description-upsell" style="margin-top: 10px;">' . esc_html__( 'No pages with Edit Profile forms found. Please create a page with the [wppb-edit-profile] shortcode or block.', 'profile-builder' ) . '</div>';
755 + } else {
756 + esc_html_e( 'Select which page users should be redirected to when they need to set up Two-Factor Authentication.', 'profile-builder' );
757 + }
758 + ?>
759 + </div>
760 + </div>
761 +
762 +
763 +
764 + </div>
765 + <?php endif; ?>
766 +
767 + <div class="cozmoslabs-form-subsection-wrapper">
768 + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Other features', 'profile-builder' ); ?></h4>
769 +
770 + <div class="cozmoslabs-form-field-wrapper">
771 + <label class="cozmoslabs-form-field-label" for="hideAdminBarFor"><?php esc_html_e( 'Hide Admin Bar for User Roles', 'profile-builder' ); ?></label>
772 +
773 + <select name="wppb_general_settings[hide_admin_bar_for][]" class="wppb-select wppb-select2" id="hideAdminBarFor" multiple>
774 + <?php
775 + global $wp_roles;
776 + $general_settings = get_option( 'wppb_general_settings' );
777 + $selected_roles = isset($general_settings['hide_admin_bar_for']) ? $general_settings['hide_admin_bar_for'] : '';
778 +
779 + echo '<option value="allUserRoles"' . ( ( !empty( $selected_roles ) && in_array( 'allUserRoles', $selected_roles ) ) ? ' selected' : '' ) . '>' . esc_html__( 'All User Roles', 'profile-builder' ) . '</option>';
780 + echo '<option value="allUserRolesExceptAdmin"' . ( ( !empty( $selected_roles ) && in_array( 'allUserRolesExceptAdmin', $selected_roles ) ) ? ' selected' : '' ) . '>' . esc_html__( 'All User Roles Except Admin', 'profile-builder' ) . '</option>';
781 +
782 + foreach ( $wp_roles->roles as $role ) {
783 + $key = $role['name'];
784 +
785 + echo '<option value="'.esc_attr( $key ).'"' . ( ( !empty( $selected_roles ) && in_array( $key, $selected_roles ) ) ? ' selected' : '' ) . '>' . esc_html( translate_user_role( $key ) ) . '</option>';
786 + }
787 +
788 + ?>
789 + </select>
790 +
791 + <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Hide the WordPress Admin Bar for these user roles. You can select multiple roles to hide it for.', 'profile-builder' ); ?></p>
792 + </div>
793 +
794 + <?php
795 + if( file_exists( WPPB_PLUGIN_DIR.'/features/roles-editor/roles-editor.php' ) ) {
796 + ?>
797 +
798 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
799 + <label class="cozmoslabs-form-field-label" for="rolesEditorSelect"><?php esc_html_e('Roles Editor', 'profile-builder'); ?></label>
800 +
801 + <div class="cozmoslabs-toggle-container">
802 + <input type="checkbox" name="wppb_general_settings[rolesEditor]" id="rolesEditorSelect" value="yes" <?php echo (!empty($wppb_generalSettings['rolesEditor']) && $wppb_generalSettings['rolesEditor'] === 'yes') ? 'checked' : ''; ?> >
803 + <label class="cozmoslabs-toggle-track" for="rolesEditorSelect"></label>
804 + </div>
805 +
806 + <div class="cozmoslabs-toggle-description">
807 + <label for="rolesEditorSelect" class="cozmoslabs-description wppb-roles-editor-details"><?php esc_html_e( 'Easily create new custom user roles or customize any existing user role capabilities.', 'profile-builder' ); ?></label>
808 + </div>
809 +
810 + <p class="cozmoslabs-description cozmoslabs-description-space-left wppb-roles-editor-link"><?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>' )?></p>
811 + </div>
812 +
813 + <?php } ?>
814 +
815 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-toggle-switch">
816 + <label class="cozmoslabs-form-field-label" for="extraFieldsLayout"><?php esc_html_e('Load CSS', 'profile-builder'); ?></label>
817 +
818 + <div class="cozmoslabs-toggle-container">
819 + <input type="checkbox" id="extraFieldsLayout" name="wppb_general_settings[extraFieldsLayout]"<?php echo ( ( isset( $wppb_generalSettings['extraFieldsLayout'] ) && ( $wppb_generalSettings['extraFieldsLayout'] == 'default' ) ) ? ' checked' : '' ); ?> value="default">
820 + <label class="cozmoslabs-toggle-track" for="extraFieldsLayout"></label>
821 + </div>
822 + <div class="cozmoslabs-toggle-description">
823 + <label for="extraFieldsLayout" class="cozmoslabs-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 ?></label>
824 + </div>
825 + </div>
826 +
827 + </div>
828 +
829 + <?php do_action( 'wppb_extra_general_settings', $wppb_generalSettings ); ?>
830 +
831 + <input type="hidden" name="action" value="update" />
832 +
833 + </div>
834 +
835 + <div class="submit cozmoslabs-submit">
836 + <h3 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Update Settings', 'profile-builder' ) ?></h3>
837 + <div class="cozmoslabs-publish-button-group">
838 + <p class="submit">
839 + <input type="submit" class="button-primary" value="<?php esc_html_e( 'Save Changes', 'profile-builder' ); ?>" />
840 + </p>
841 + </div>
842 + </div>
843 +
844 + </form>
845 +
846 + </div>
847 +
848 + </div>
849 +
850 +<?php
851 +}
852 +
853 +
854 +/*
855 + * Function that sanitizes the general settings
856 + *
857 + * @param array $wppb_generalSettings
858 + *
859 + * @since v.2.0.7
860 + */
861 +function wppb_general_settings_sanitize( $wppb_generalSettings ) {
862 + $wppb_generalSettings = apply_filters( 'wppb_general_settings_sanitize_extra', $wppb_generalSettings );
863 +
864 + if( !empty( $wppb_generalSettings ) ){
865 + foreach( $wppb_generalSettings as $settings_name => $settings_value ){
866 + if( $settings_name == "minimum_password_length" || $settings_name == "activationLandingPage" )
867 + $wppb_generalSettings[$settings_name] = absint( $settings_value );
868 + elseif( $settings_name == "extraFieldsLayout" || $settings_name == "emailConfirmation" || $settings_name == "adminApproval" || $settings_name == "loginWith" || $settings_name == "minimum_password_strength" )
869 + $wppb_generalSettings[$settings_name] = sanitize_text_field( $settings_value );
870 + elseif( $settings_name == "adminApprovalOnUserRole" ){
871 + if( is_array( $settings_value ) && !empty( $settings_value ) ){
872 + foreach( $settings_value as $key => $value ){
873 + $wppb_generalSettings[$settings_name][$key] = sanitize_text_field( $value );
874 + }
875 + }
876 + }
877 + }
878 + }
879 +
880 + return $wppb_generalSettings;
881 +}
882 +
883 +
884 +/*
885 + * Function that pushes settings errors to the user
886 + *
887 + * @since v.2.0.7
888 + */
889 +function wppb_general_settings_admin_notices() {
890 + settings_errors( 'wppb_general_settings' );
891 +}
892 +add_action( 'admin_notices', 'wppb_general_settings_admin_notices' );
893 +
894 +
895 +/*
896 + * Function that return user roles
897 + *
898 + * @since v.2.2.0
899 + *
900 + * @return array
901 + */
902 +function wppb_adminApproval_onUserRole() {
903 + global $wp_roles;
904 +
905 + $wp_roles = new WP_Roles();
906 +
907 + $roles = $wp_roles->get_names();
908 +
909 + unset( $roles['administrator'] );
910 +
911 + return $roles;
912 +}
913 +
914 +
915 +
916 +/*
917 + * Generate the Form Designs Preview Showcase
918 + *
919 + */
920 +function wppb_display_form_designs_preview() {
921 + $form_designs_data = array(
922 + array(
923 + 'id' => 'form-style-default',
924 + 'name' => 'Default',
925 + 'images' => array(
926 + 'main' => WPPB_PLUGIN_URL.'assets/images/pb-default-forms.jpg',
927 + ),
928 + ),
929 + array(
930 + 'id' => 'form-style-1',
931 + 'name' => 'Sublime',
932 + 'images' => array(
933 + 'main' => WPPB_PLUGIN_URL.'assets/images/style1-slide1.jpg',
934 + 'slide1' => WPPB_PLUGIN_URL.'assets/images/style1-slide2.jpg',
935 + 'slide2' => WPPB_PLUGIN_URL.'assets/images/style1-slide3.jpg',
936 + ),
937 + ),
938 + array(
939 + 'id' => 'form-style-2',
940 + 'name' => 'Greenery',
941 + 'images' => array(
942 + 'main' => WPPB_PLUGIN_URL.'assets/images/style2-slide1.jpg',
943 + 'slide1' => WPPB_PLUGIN_URL.'assets/images/style2-slide2.jpg',
944 + 'slide2' => WPPB_PLUGIN_URL.'assets/images/style2-slide3.jpg',
945 + ),
946 + ),
947 + array(
948 + 'id' => 'form-style-3',
949 + 'name' => 'Slim',
950 + 'images' => array(
951 + 'main' => WPPB_PLUGIN_URL.'assets/images/style3-slide1.jpg',
952 + 'slide1' => WPPB_PLUGIN_URL.'assets/images/style3-slide2.jpg',
953 + 'slide2' => WPPB_PLUGIN_URL.'assets/images/style3-slide3.jpg',
954 + ),
955 + )
956 + );
957 +
958 + $output = '<div id="wppb-forms-design-browser">';
959 +
960 + foreach ( $form_designs_data as $form_design ) {
961 +
962 + if ( $form_design['id'] != 'form-style-default' ) {
963 + $preview_button = '<div class="wppb-forms-design-preview button-secondary" id="' . $form_design['id'] . '-info">Preview</div>';
964 + $title = esc_html__( 'Available in the Pro versions of the plugin', 'profile-builder' );
965 + }
966 + else {
967 + $preview_button = '';
968 + $title = '';
969 + }
970 +
971 + $output .= '<div class="wppb-forms-design" id="'. $form_design['id'] .'" title="'. $title .'">
972 + <label>
973 + <input type="radio" id="wppb-fd-option-' . $form_design['id'] . '" value="' . $form_design['id'] . '" name="" disabled ' . ( $form_design['id'] == 'form-style-default' ? 'checked' : '' ) .'>
974 + ' . $form_design['name'] . '</label>
975 + <div class="wppb-forms-design-screenshot">
976 + <img src="' . $form_design['images']['main'] . '" alt="Form Design">
977 + '. $preview_button .'
978 + </div>
979 + </div>';
980 +
981 + $img_count = 0;
982 + $image_list = '';
983 + foreach ( $form_design['images'] as $image ) {
984 + $img_count++;
985 + $active_img = ( $img_count == 1 ) ? ' active' : '';
986 + $image_list .= '<img class="wppb-forms-design-preview-image'. $active_img .'" src="'. $image .'">';
987 + }
988 +
989 + if ( $img_count > 1 ) {
990 + $previous_button = '<div class="wppb-slideshow-button wppb-forms-design-sildeshow-previous disabled" data-theme-id="'. $form_design['id'] .'" data-slideshow-direction="previous"> < </div>';
991 + $next_button = '<div class="wppb-slideshow-button wppb-forms-design-sildeshow-next" data-theme-id="'. $form_design['id'] .'" data-slideshow-direction="next"> > </div>';
992 + $justify_content = 'space-between';
993 + }
994 + else {
995 + $previous_button = $next_button = '';
996 + $justify_content = 'center';
997 + }
998 +
999 + $output .= '<div id="modal-'. $form_design['id'] .'" class="wppb-forms-design-modal" title="'. $form_design['name'] .'">
1000 + <div class="wppb-forms-design-modal-slideshow" style="justify-content: '. $justify_content .'">
1001 + '. $previous_button .'
1002 + <div class="wppb-forms-design-modal-images">
1003 + '. $image_list .'
1004 + </div>
1005 + '. $next_button .'
1006 + </div>
1007 + </div>';
1008 +
1009 + }
1010 +
1011 + $output .= '</div>';
1012 +
1013 + $output .= '<p class="cozmoslabs-description cozmoslabs-description-upsell">'. sprintf( esc_html__( 'You can now beautify your forms using pre-made templates. Enable %3$sForm Designs%4$s by upgrading to %1$sBasic or PRO versions%2$s.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=pb-general-settings&utm_medium=client-site&utm_campaign=pb-form-design-templates#pricing" target="_blank">', '</a>', '<strong>', '</strong>' ) .'</p>';
1014 +
1015 + return $output;
1016 +}
1017 +
1018 +
1019 +/*
1020 + * Generate the Register Version Form
1021 + *
1022 + */
1023 +function wppb_add_register_version_form() {
1024 + $status = wppb_get_serial_number_status();
1025 + $license = wppb_get_serial_number();
1026 + $license_details = get_option( 'wppb_license_details', false );
1027 +
1028 + if( !empty( $license ) ){
1029 + // process license so it doesn't get displayed in back-end
1030 + $license_length = strlen( $license );
1031 + $license = substr_replace( $license, '***************', 7, $license_length - 14 );
1032 + }
1033 + ?>
1034 +
1035 + <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Register Website', 'profile-builder' ) ?></h4>
1036 +
1037 + <form method="post" action="<?php echo !is_multisite() ? 'options.php' : 'edit.php'; ?>">
1038 + <?php settings_fields( 'wppb_license_key' ); ?>
1039 +
1040 + <div class="cozmoslabs-form-field-wrapper cozmoslabs-form-field-serial-number">
1041 +
1042 + <label class="cozmoslabs-form-field-label" for="wppb_license_key"><?php esc_html_e( 'License key', 'profile-builder' ); ?></label>
1043 +
1044 + <div class="cozmoslabs-serial-wrap__holder">
1045 + <input id="wppb_license_key" name="wppb_license_key" type="text" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
1046 + <?php wp_nonce_field( 'wppb_license_nonce', 'wppb_license_nonce' ); ?>
1047 +
1048 + <?php if( $status !== false && $status == 'valid' ) {
1049 + $button_name = 'wppb_edd_license_deactivate';
1050 + $button_value = __('Deactivate License', 'profile-builder' );
1051 +
1052 + if( empty( $details['invalid'] ) )
1053 + echo '<span title="'. esc_html__( 'Active on this site', 'profile-builder' ) .'" class="wppb-active-license dashicons dashicons-yes"></span>';
1054 + else
1055 + echo '<span title="'. esc_html__( 'Your license is invalid', 'profile-builder' ) .'" class="wppb-invalid-license dashicons dashicons-warning"></span>';
1056 +
1057 + } else {
1058 + $button_name = 'wppb_edd_license_activate';
1059 + $button_value = __('Activate License', 'profile-builder');
1060 + }
1061 + ?>
1062 + <input type="submit" class="button-secondary" name="<?php echo esc_attr( $button_name ); ?>" value="<?php echo esc_attr( $button_value ); ?>"/>
1063 + </div>
1064 +
1065 + <?php if( $status != 'expired' && ( !empty( $license_details ) && !empty( $license_details->expires ) && $license_details->expires !== 'lifetime' ) && ( ( !isset( $license_details->subscription_status ) || $license_details->subscription_status != 'active' ) && strtotime( $license_details->expires ) < strtotime( '+14 days' ) ) ) : ?>
1066 + <div class="cozmoslabs-description-container yellow">
1067 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'Your %s license is about to expire on %s', 'profile-builder' ), '<strong>' . PROFILE_BUILDER . '</strong>', '<strong>' . date_i18n( get_option( 'date_format' ), strtotime( $license_details->expires ) ) . '</strong>' ) ); ?>
1068 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'Please %sRenew Your Licence%s to continue receiving access to new features, premium addons, product downloads & automatic updates — including important security patches and WordPress compatibility.', 'profile-builder' ), "<a href='https://www.cozmoslabs.com/account/?utm_source=wpbackend&utm_medium=clientsite&utm_campaign=PBPro&utm_content=license-about-to-expire' target='_blank'>", "</a>" ) ); ?></p>
1069 + </div>
1070 + <?php elseif( $status == 'expired' ) : ?>
1071 + <div class="cozmoslabs-description-container red">
1072 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'Your %s license has expired.', 'profile-builder' ), '<strong>' . PROFILE_BUILDER . '</strong>' ) ); ?>
1073 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'Please %1$sRenew Your Licence%2$s to continue receiving access to new features, premium addons, product downloads & automatic updates — including important security patches and WordPress compatibility.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/account/?utm_source=wpbackend&utm_medium=clientsite&utm_campaign=PBPro&utm_content=license-expired" target="_blank">', '</a>' ) ); ?></p>
1074 + </div>
1075 + <?php elseif( $status == 'no_activations_left' ) : ?>
1076 + <div class="cozmoslabs-description-container red">
1077 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'Your %s license has reached its activation limit.', 'profile-builder' ), '<strong>' . PROFILE_BUILDER . '</strong>' ) ); ?>
1078 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( '%sUpgrade now%s for unlimited activations and extra features like multiple registration and edit profile forms, userlisting, custom redirects and more.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/account/?utm_source=wpbackend&utm_medium=clientsite&utm_campaign=PBPro&utm_content=license-activation-limit" target="_blank">', '</a>' ) ); ?>
1079 + </div>
1080 + <?php elseif( empty( $license ) || $status != 'valid' ) : ?>
1081 + <div class="cozmoslabs-description-container">
1082 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'Enter your license key. Your license key can be found in your %sCozmoslabs account%s. ', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/account/?utm_source=wpbackend&utm_medium=clientsite&utm_campaign=PBPro&utm_content=license-missing" target="_blank">', '</a>' ) ); ?></p>
1083 + <p class="cozmoslabs-description"><?php echo wp_kses_post( sprintf( __( 'You can use this core version of Profile Builder for free. For priority support and advanced functionality, %sa license key is required%s.', 'profile-builder' ), '<a href="https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_campaign=PBPro&utm_content=license-missing#pricing" target="_blank">', '</a>' ) ); ?></p>
1084 + </div>
1085 + <?php endif; ?>
1086 +
1087 + </div>
1088 + </form>
1089 +
1090 + <?php
1091 +}
1092 +
1093 +
1094 +/*
1095 + * Load scripts and styles we need on the page ( ex. Select2 )
1096 + *
1097 + */
1098 +function wppb_load_necessary_scripts() {
1099 + wp_enqueue_script( 'wppb-select2', WPPB_PLUGIN_URL . 'assets/js/select2/select2.min.js', array(), PROFILE_BUILDER_VERSION );
1100 + wp_enqueue_script( 'wppb-select2-compat', WPPB_PLUGIN_URL . 'assets/js/select2-compat.js', array(), PROFILE_BUILDER_VERSION );
1101 + wp_enqueue_style( 'wppb_select2_css', WPPB_PLUGIN_URL .'assets/css/select2/select2.min.css', array(), PROFILE_BUILDER_VERSION );
186 1102 }