PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.0.3
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.0.3
4.17.2 4.17.1 4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Admin / SettingsPages / GeneralSettings.php
wp-user-avatar / src / Admin / SettingsPages Last commit date
DragDropBuilder 4 years ago EmailSettings 4 years ago Membership 4 years ago AbstractSettingsPage.php 4 years ago AddNewForm.php 4 years ago AdminFooter.php 4 years ago ExtensionsSettingsPage.php 4 years ago FormList.php 4 years ago Forms.php 4 years ago GeneralSettings.php 4 years ago IDUserColumn.php 5 years ago MailOptin.php 4 years ago MemberDirectories.php 4 years ago MembersDirectoryList.php 5 years ago ToolsSettingsPage.php 4 years ago index.php 5 years ago
GeneralSettings.php
582 lines
1 <?php
2
3 namespace ProfilePress\Core\Admin\SettingsPages;
4
5 use ProfilePress\Core\Classes\ExtensionManager;
6 use ProfilePress\Core\Classes\FormRepository;
7 use ProfilePress\Custom_Settings_Page_Api;
8
9 class GeneralSettings extends AbstractSettingsPage
10 {
11 public $settingsPageInstance;
12
13 public function __construct()
14 {
15 // registers the global ProfilePress dashboard menu
16 add_action('admin_menu', array($this, 'register_core_menu'));
17
18 add_action('ppress_register_menu_page_general_general', function () {
19 $this->settingsPageInstance = Custom_Settings_Page_Api::instance([], PPRESS_SETTINGS_DB_OPTION_NAME, esc_html__('General', 'wp-user-avatar'));
20 });
21
22 add_action('ppress_register_menu_page', array($this, 'register_menu_page'));
23
24 add_action('ppress_admin_settings_submenu_page_general_general', [$this, 'settings_admin_page_callback']);
25
26 add_action('admin_footer', [$this, 'js_script']);
27
28 // flush rewrite rule on save/persistence
29 add_action('wp_cspa_persist_settings', function () {
30 flush_rewrite_rules();
31 });
32
33 $this->custom_sanitize();
34 }
35
36 public function register_menu_page()
37 {
38 $hook = add_submenu_page(
39 PPRESS_DASHBOARD_SETTINGS_SLUG,
40 'ProfilePress ' . apply_filters('ppress_general_settings_admin_page_title', esc_html__('Settings', 'wp-user-avatar')),
41 esc_html__('Settings', 'wp-user-avatar'),
42 'manage_options',
43 PPRESS_SETTINGS_SLUG,
44 array($this, 'admin_page_callback')
45 );
46
47 add_action("load-$hook", [$this, 'screen_option']);
48 }
49
50 public function default_header_menu()
51 {
52 return 'general';
53 }
54
55 public function header_menu_tabs()
56 {
57 $tabs = apply_filters('ppress_settings_page_tabs', [
58 20 => ['id' => 'general', 'url' => PPRESS_SETTINGS_SETTING_PAGE, 'label' => esc_html__('General', 'wp-user-avatar')],
59 40 => ['id' => 'email', 'url' => add_query_arg('view', 'email', PPRESS_SETTINGS_SETTING_PAGE), 'label' => esc_html__('Emails', 'wp-user-avatar')],
60 ]);
61
62 if ( ! empty($this->integrations_submenu_tabs())) {
63 $tabs[60] = ['id' => 'integrations', 'url' => add_query_arg('view', 'integrations', PPRESS_SETTINGS_SETTING_PAGE), 'label' => esc_html__('Integrations', 'wp-user-avatar')];
64 }
65
66 if ( ! ExtensionManager::is_premium()) {
67 $tabs[999] = ['url' => PPRESS_EXTENSIONS_SETTINGS_PAGE, 'label' => esc_html__('Premium Addons', 'wp-user-avatar')];
68 }
69
70 ksort($tabs);
71
72 return $tabs;
73 }
74
75 public function integrations_submenu_tabs()
76 {
77 return apply_filters('ppress_integrations_submenu_tabs', []);
78 }
79
80 public function header_submenu_tabs()
81 {
82 $tabs = apply_filters('ppress_settings_page_submenus_tabs', [
83 0 => ['parent' => 'general', 'id' => 'general', 'label' => esc_html__('General', 'wp-user-avatar')],
84 99999 => ['parent' => 'general', 'id' => 'tools', 'label' => esc_html__('Tools', 'wp-user-avatar')],
85 ]);
86
87 $tabs = $tabs + $this->integrations_submenu_tabs();
88
89 ksort($tabs);
90
91 return $tabs;
92 }
93
94 public function screen_option()
95 {
96 do_action('ppress_settings_page_screen_option');
97 }
98
99 public function settings_admin_page_callback()
100 {
101 $custom_page = apply_filters('ppress_general_settings_admin_page_short_circuit', false);
102
103 if (false !== $custom_page) return $custom_page;
104
105 $edit_profile_forms = array_reduce(FormRepository::get_forms(FormRepository::EDIT_PROFILE_TYPE),
106 function ($carry, $item) {
107 $carry[$item['form_id']] = $item['name'];
108
109 return $carry;
110 }, ['default' => esc_html__('My Account edit profile form (default)', 'wp-user-avatar')]);
111
112 $login_redirect_page_dropdown_args = [
113 ['key' => 'current_page', 'label' => esc_html__('Currently viewed page', 'wp-user-avatar')],
114 ['key' => 'none', 'label' => esc_html__('Previous/Referrer page (Pro feature)', 'wp-user-avatar'), 'disabled' => true],
115 ['key' => 'dashboard', 'label' => esc_html__('WordPress Dashboard', 'wp-user-avatar')]
116 ];
117
118 if (ExtensionManager::is_premium()) {
119 $login_redirect_page_dropdown_args[1] = ['key' => 'previous_page', 'label' => esc_html__('Previous/Referrer page', 'wp-user-avatar')];
120 }
121
122 $args = [
123 'global_settings' => apply_filters('ppress_global_settings_page', [
124 'tab_title' => esc_html__('Global', 'wp-user-avatar'),
125 'dashicon' => 'dashicons-admin-site-alt',
126 [
127 'section_title' => esc_html__('Global Settings', 'wp-user-avatar'),
128 'disable_ajax_mode' => [
129 'type' => 'checkbox',
130 'label' => esc_html__('Disable Ajax Mode', 'wp-user-avatar'),
131 'value' => 'yes',
132 'checkbox_label' => esc_html__('Disable', 'wp-user-avatar'),
133 'description' => esc_html__('Check this box to disable ajax behaviour(whereby forms do not require page reload when submitted) in forms.', 'wp-user-avatar'),
134 ],
135 'remove_plugin_data' => [
136 'type' => 'checkbox',
137 'value' => 'yes',
138 'label' => esc_html__('Remove Data on Uninstall', 'wp-user-avatar'),
139 'checkbox_label' => esc_html__('Delete', 'wp-user-avatar'),
140 'description' => esc_html__('Check this box if you would like ProfilePress to completely remove all of its data when the plugin is deleted.', 'wp-user-avatar'),
141 ]
142 ],
143 ]), /** Set default values on register activation */
144 'business_info' => apply_filters('ppress_business_info_settings_page', [
145 'tab_title' => esc_html__('Business Info', 'wp-user-avatar'),
146 'dashicon' => 'dashicons-info',
147 [
148 'section_title' => esc_html__('Business Information', 'wp-user-avatar'),
149 'business_name' => [
150 'type' => 'text',
151 'label' => esc_html__('Business Name', 'wp-user-avatar'),
152 'description' => esc_html__('The official (legal) name of your store. Defaults to Site Title if empty.', 'wp-user-avatar'),
153 ],
154 'business_address' => [
155 'type' => 'text',
156 'label' => esc_html__('Address', 'wp-user-avatar'),
157 'description' => esc_html__('The street address where your business is registered and located.', 'wp-user-avatar'),
158 ],
159 'business_city' => [
160 'type' => 'text',
161 'label' => esc_html__('City', 'wp-user-avatar'),
162 'description' => esc_html__('The city in which your business is registered and located.', 'wp-user-avatar'),
163 ],
164 'business_country' => [
165 'type' => 'select',
166 'label' => esc_html__('Country', 'wp-user-avatar'),
167 'description' => esc_html__('The country in which your business is registered and located.', 'wp-user-avatar'),
168 'options' => ['' => '&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;'] + ppress_array_of_world_countries()
169 ],
170 'business_state' => [
171 'type' => 'text',
172 'label' => esc_html__('State / Province / Region', 'wp-user-avatar'),
173 'description' => esc_html__('The state your business is located.', 'wp-user-avatar'),
174 ],
175 'business_postal_code' => [
176 'type' => 'text',
177 'label' => esc_html__('ZIP / Postal Code', 'wp-user-avatar'),
178 'description' => esc_html__('The country in which your business is located.', 'wp-user-avatar'),
179 ],
180 'business_tin' => [
181 'type' => 'text',
182 'label' => esc_html__('Tax Identification Number', 'wp-user-avatar'),
183 'description' => esc_html__('This can be your VAT number, GST/HST or ABN.', 'wp-user-avatar'),
184 ],
185 ],
186 ]),
187 'global_pages' => apply_filters('ppress_global_pages_settings_page', [
188 'tab_title' => esc_html__('Pages', 'wp-user-avatar'),
189 'dashicon' => 'dashicons-admin-page',
190 [
191 'section_title' => esc_html__('Global Pages', 'wp-user-avatar'),
192 'set_login_url' => [
193 'type' => 'custom_field_block',
194 'label' => esc_html__('Login Page', 'wp-user-avatar'),
195 'data' => $this->page_dropdown('set_login_url'),
196 'description' => sprintf(
197 esc_html__('Select the page you wish to make WordPress default Login page. %3$s This should be the page that contains a %1$slogin form shortcode%2$s.', 'wp-user-avatar'),
198 '<a href="' . add_query_arg('form-type', 'login', PPRESS_FORMS_SETTINGS_PAGE) . '">', '</a>', '<br/>'),
199 ],
200 'set_registration_url' => [
201 'type' => 'custom_field_block',
202 'label' => esc_html__('Registration Page', 'wp-user-avatar'),
203 'data' => $this->page_dropdown('set_registration_url'),
204 'description' => sprintf(
205 esc_html__('Select the page you wish to make WordPress default Registration page. %3$s This should be the page that contains a %1$sregistration form shortcode%2$s.', 'wp-user-avatar'),
206 '<a href="' . add_query_arg('form-type', 'registration', PPRESS_FORMS_SETTINGS_PAGE) . '">', '</a>', '<br/>'),
207 ],
208 'set_lost_password_url' => [
209 'type' => 'custom_field_block',
210 'label' => esc_html__('Password Reset Page', 'wp-user-avatar'),
211 'data' => $this->page_dropdown('set_lost_password_url'),
212 'description' => sprintf(
213 esc_html__('Select the page you wish to make WordPress default "Lost Password page". %3$s This should be the page that contains a %1$spassword reset form shortcode%2$s.', 'wp-user-avatar'),
214 '<a href="' . add_query_arg('form-type', 'password-reset', PPRESS_FORMS_SETTINGS_PAGE) . '">', '</a>', '<br/>'),
215 ],
216 'edit_user_profile_url' => [
217 'type' => 'custom_field_block',
218 'label' => esc_html__('My Account Page', 'wp-user-avatar'),
219 'data' => $this->page_dropdown('edit_user_profile_url'),
220 'description' => sprintf(
221 esc_html__('Select a page that contains %3$s shortcode. You can also use an %1$sedit profile shortcode%2$s on the My Account page in case you want something custom.', 'wp-user-avatar'),
222 '<a href="' . add_query_arg('form-type', 'edit-profile', PPRESS_FORMS_SETTINGS_PAGE) . '">', '</a>', '<code>[profilepress-my-account]</code>'),
223 ],
224 ],
225 [
226 'section_title' => esc_html__('Payment Pages', 'wp-user-avatar'),
227 'checkout_page_id' => [
228 'type' => 'custom_field_block',
229 'label' => esc_html__('Checkout Page', 'wp-user-avatar'),
230 'data' => $this->page_dropdown('checkout_page_id'),
231 'description' => sprintf(
232 esc_html__('The checkout page where members will complete their payments. %2$sThe shortcode %1$s must be on this page.', 'wp-user-avatar'),
233 '<code>[profilepress-checkout]</code>', '<br>'
234 ),
235 ],
236 'payment_success_page_id' => [
237 'type' => 'custom_field_block',
238 'label' => esc_html__('Order Success Page', 'wp-user-avatar'),
239 'data' => $this->page_dropdown('payment_success_page_id'),
240 'description' => sprintf(
241 esc_html__('The page customers are sent to after completing their orders.%2$sThe shortcode %1$s must be on this page.', 'wp-user-avatar'),
242 '<code>[profilepress-receipt]</code>', '<br>'
243 )
244 ],
245 'payment_failure_page_id' => [
246 'type' => 'custom_field_block',
247 'label' => esc_html__('Order Failure Page', 'wp-user-avatar'),
248 'data' => $this->page_dropdown('payment_failure_page_id'),
249 'description' => esc_html__('The page customers are sent to after a failed order.', 'wp-user-avatar')
250 ],
251 'terms_page_id' => [
252 'label' => esc_html__('Terms & Conditions Page', 'wp-user-avatar'),
253 'description' => esc_html__('If you select a "Terms" page, customers will be asked if they accept them when checking out.', 'wp-user-avatar'),
254 'type' => 'custom_field_block',
255 'data' => $this->page_dropdown('terms_page_id'),
256 ],
257 ]
258 ]),
259 'registration_settings' => apply_filters('ppress_registration_settings_page', [
260 'tab_title' => esc_html__('Registration', 'wp-user-avatar'),
261 'dashicon' => 'dashicons-welcome-learn-more',
262 [
263 'section_title' => esc_html__('Registration Settings', 'wp-user-avatar'),
264 'set_auto_login_after_reg' => [
265 'type' => 'checkbox',
266 'label' => esc_html__('Auto-login after registration', 'wp-user-avatar'),
267 'checkbox_label' => esc_html__('Enable auto-login', 'wp-user-avatar'),
268 'value' => 'on',
269 'description' => esc_html__('Check this option to automatically login users after successful registration.', 'wp-user-avatar')
270 ]
271 ]
272 ]),
273 'login_settings' => apply_filters('ppress_login_settings_page', [
274 'tab_title' => esc_html__('Login', 'wp-user-avatar'),
275 'dashicon' => 'dashicons-universal-access-alt',
276 [
277 'section_title' => esc_html__('Login Settings', 'wp-user-avatar'),
278 'login_username_email_restrict' => [
279 'type' => 'select',
280 'options' => [
281 'both' => esc_html__('Email Address and Username (default)', 'wp-user-avatar'),
282 'email' => esc_html__('Email Address Only', 'wp-user-avatar'),
283 'username' => esc_html__('Username Only', 'wp-user-avatar')
284 ],
285 'value' => '',
286 'label' => esc_html__('Login with Email or Username', 'wp-user-avatar'),
287 'description' => esc_html__('By default, WordPress allows users to log in using either an email address or username. This setting allows you to restrict logins to only accept email addresses or usernames.', 'wp-user-avatar')
288 ],
289 ]
290 ]),
291 'my_account_settings' => apply_filters('ppress_my_account_settings_page', [
292 'tab_title' => esc_html__('My Account', 'wp-user-avatar'),
293 'section_title' => esc_html__('My Account Settings', 'wp-user-avatar'),
294 'dashicon' => 'dashicons-dashboard',
295 'redirect_default_edit_profile_to_custom' => [
296 'type' => 'checkbox',
297 'label' => esc_html__('Redirect Default Edit Profile', 'wp-user-avatar'),
298 'checkbox_label' => esc_html__('Activate', 'wp-user-avatar'),
299 'value' => 'yes',
300 'description' => sprintf(
301 __('Redirect <a target="_blank" href="%s">default WordPress profile</a> to My Account page.', 'wp-user-avatar'),
302 admin_url('profile.php')
303 )
304 ],
305 'myac_edit_account_endpoint' => [
306 'type' => 'text',
307 'value' => 'edit-profile',
308 'label' => esc_html__('Edit Account Endpoint', 'wp-user-avatar'),
309 'description' => __('Endpoint for the "My Account → Account Details" page.', 'wp-user-avatar'),
310 ],
311 'myac_change_password_endpoint' => [
312 'type' => 'text',
313 'value' => 'change-password',
314 'label' => esc_html__('Change Password Endpoint', 'wp-user-avatar'),
315 'description' => __('Endpoint for the "My Account → Change Password" page.', 'wp-user-avatar'),
316 ],
317 'myac_account_details_form' => [
318 'type' => 'select',
319 'options' => $edit_profile_forms,
320 'label' => esc_html__('Account Details Form', 'wp-user-avatar'),
321 'description' => esc_html__('Do you want to replace the default form in "My Account → Account Details" page? select an Edit Profile form that will replace it.', 'wp-user-avatar')
322 ],
323 ]),
324 'frontend_profile_settings' => apply_filters('ppress_frontend_profile_settings_page', [
325 'tab_title' => esc_html__('Frontend Profile', 'wp-user-avatar'),
326 'section_title' => esc_html__('Frontend Profile Settings', 'wp-user-avatar'),
327 'dashicon' => 'dashicons-admin-users',
328 'set_user_profile_shortcode' => [
329 'type' => 'custom_field_block',
330 'label' => esc_html__('Page with Profile Shortcode', 'wp-user-avatar'),
331 'data' => $this->page_dropdown('set_user_profile_shortcode'),
332 'description' => sprintf(__('Select the page that contains your <a href="%s">Frontend user profile shortcode</a>.', 'wp-user-avatar'), PPRESS_USER_PROFILES_SETTINGS_PAGE),
333 ],
334 'set_user_profile_slug' => [
335 'type' => 'text',
336 'value' => 'profile',
337 'label' => esc_html__('Profile Slug', 'wp-user-avatar'),
338 'description' => sprintf(__('Enter your preferred profile URL slug. Default to "profile" if empty. If slug is "profile", URL becomes %s where "john" is a user\'s username.', 'wp-user-avatar'), '<strong>' . home_url() . '/profile/john</strong>'),
339 ],
340 'disable_guests_can_view_profiles' => [
341 'type' => 'checkbox',
342 'label' => esc_html__('Disable Guests from Viewing Profiles', 'wp-user-avatar'),
343 'description' => esc_html__('Enable this option to stop disable guests or non-registered users from viewing users profiles.', 'wp-user-avatar'),
344 'value' => 'on'
345 ],
346 'disable_members_can_view_profiles' => [
347 'type' => 'checkbox',
348 'label' => esc_html__('Disable Members from Viewing Profiles', 'wp-user-avatar'),
349 'description' => esc_html__('Enable this option to stop members from viewing other users profiles. If enabled, users can only see their own profile.', 'wp-user-avatar'),
350 'value' => 'on'
351 ],
352 'comment_author_url_to_profile' => [
353 'type' => 'checkbox',
354 'label' => esc_html__('Comment Author URL to Profile', 'wp-user-avatar'),
355 'checkbox_label' => esc_html__('Enable option', 'wp-user-avatar'),
356 'value' => 'on',
357 'description' => sprintf(__("Change URL of comment authors to their ProfilePress front-end profile.", 'wp-user-avatar'))
358 ],
359 'author_slug_to_profile' => [
360 'type' => 'checkbox',
361 'label' => esc_html__('Authors Page to Profile', 'wp-user-avatar'),
362 'checkbox_label' => esc_html__('Enable option', 'wp-user-avatar'),
363 'value' => 'on',
364 'description' => sprintf(__("Change and redirect authors pages %s to their front-end profiles %s.", 'wp-user-avatar'), '<strong>(' . home_url() . '/author/admin)</strong>', '<strong>(' . home_url() . '/' . ppress_get_profile_slug() . '/admin)</strong>')
365 ],
366 ]
367 ),
368 'redirection_settings' => apply_filters('ppress_redirection_settings_page', [
369 'tab_title' => esc_html__('Redirection', 'wp-user-avatar'),
370 'section_title' => esc_html__('Redirection Settings', 'wp-user-avatar'),
371 'dashicon' => 'dashicons-redo',
372 'set_log_out_url' => [
373 'type' => 'custom_field_block',
374 'label' => esc_html__('Log out', 'wp-user-avatar'),
375 'data' => $this->page_dropdown('set_log_out_url',
376 [
377 ['key' => 'default', 'label' => esc_html__('Select...', 'wp-user-avatar')],
378 ['key' => 'current_view_page', 'label' => esc_html__('Currently viewed page', 'wp-user-avatar')]
379 ],
380 ['skip_append_default_select' => true]
381 ) . $this->custom_text_input('custom_url_log_out'),
382 'description' => sprintf(
383 esc_html__('Select the page users will be redirected to after logout. To redirect to a custom URL instead of a selected page, enter the URL in input field directly above this description.', 'wp-user-avatar') . '%s' .
384 esc_html__('Leave the "custom URL" field empty to fallback to the selected page.', 'wp-user-avatar'),
385 '<br/>'
386 )
387 ],
388 'set_login_redirect' => [
389 'type' => 'custom_field_block',
390 'label' => esc_html__('Login', 'wp-user-avatar'),
391 'data' => $this->page_dropdown('set_login_redirect', $login_redirect_page_dropdown_args) . $this->custom_text_input('custom_url_login_redirect'),
392 'description' => sprintf(
393 esc_html__('Select the page or custom URL users will be redirected to after login. To redirect to a custom URL instead of a selected page, enter the URL in input field directly above this description', 'wp-user-avatar') . '%s' .
394 esc_html__('Leave the "custom URL" field empty to fallback to the selected page.', 'wp-user-avatar'),
395 '<br/>'
396 )
397 ],
398 'set_password_reset_redirect' => [
399 'type' => 'custom_field_block',
400 'label' => esc_html__('Password Reset', 'wp-user-avatar'),
401 'data' => $this->page_dropdown(
402 'set_password_reset_redirect',
403 [],
404 [
405 'show_option_none' => esc_html__('Default..', 'wp-user-avatar'),
406 'option_none_value' => 'no_redirect',
407 ]
408 ) . $this->custom_text_input('custom_url_password_reset_redirect'),
409 'description' => sprintf(
410 esc_html__('Select the page or custom URL users will be redirected to after they successfully reset or change their password. To redirect to a custom URL instead of a selected page, enter the URL in input field directly above this description.', 'wp-user-avatar') . '%s' .
411 esc_html__('Leave the "custom URL" field empty to fallback to the selected page.', 'wp-user-avatar'),
412 '<br/>'
413 )
414 ]
415 ]),
416 'access_settings' => apply_filters('ppress_access_settings_page', [
417 'tab_title' => esc_html__('Access', 'wp-user-avatar'),
418 'section_title' => esc_html__('Access Settings', 'wp-user-avatar'),
419 'dashicon' => 'dashicons-products',
420 'global_site_access_notice' => [
421 'type' => 'arbitrary',
422 'data' => '',
423 'description' => sprintf(
424 '<div class="ppress-settings-page-notice">' . esc_html__('%sNote:%s Access setting takes precedence over %sContent Protection rules%s.', 'wp-user-avatar'),
425 '<strong>', '</strong>', '<a target="_blank" href="' . PPRESS_CONTENT_PROTECTION_SETTINGS_PAGE . '">', '</a>'
426 )
427 ],
428 'global_site_access' => [
429 'type' => 'select',
430 'label' => esc_html__('Global Site Access', 'wp-user-avatar'),
431 'options' => [
432 'everyone' => esc_html__('Accessible to Everyone', 'wp-user-avatar'),
433 'login' => esc_html__('Accessible to Logged-in Users', 'wp-user-avatar')
434 ]
435 ],
436 'global_site_access_redirect_page' => [
437 'type' => 'custom_field_block',
438 'label' => esc_html__('Redirect Page', 'wp-user-avatar'),
439 'data' => $this->page_dropdown('global_site_access_redirect_page') . $this->custom_text_input('global_site_access_custom_redirect_page'),
440 'description' => esc_html__('Select the page or custom URL to redirect users that are not logged in to.', 'wp-user-avatar')
441 ],
442 'global_site_access_exclude_pages' => [
443 'type' => 'select2',
444 'label' => esc_html__('Pages to Exclude', 'wp-user-avatar'),
445 'options' => array_reduce(get_pages(), function ($carry, $item) {
446 $carry[$item->ID] = $item->post_title;
447
448 return $carry;
449 }, []),
450 'description' => esc_html__('Select the pages to exclude beside the redirect page that will be accessible by everyone.', 'wp-user-avatar')
451 ],
452 'global_site_access_allow_homepage' => [
453 'type' => 'checkbox',
454 'value' => 'yes',
455 'checkbox_label' => esc_html__('Enable', 'wp-user-avatar'),
456 'label' => esc_html__('Accessible Homepage', 'wp-user-avatar'),
457 'description' => esc_html__('Check to allow homepage to be accessible by everyone.', 'wp-user-avatar')
458 ],
459 'global_restricted_access_message' => [
460 'type' => 'wp_editor',
461 'value' => esc_html__('You are unauthorized to view this page.', 'wp-user-avatar'),
462 'label' => esc_html__('Global Restricted Access Message', 'wp-user-avatar'),
463 'description' => esc_html__('This is the message shown to users that do not have permission to view the content.', 'wp-user-avatar')
464 ],
465 ])
466 ];
467
468 $business_country = ppress_business_country();
469
470 if ( ! empty($business_country) && ! empty(ppress_array_of_world_states($business_country))) {
471 $args['business_info'][0]['business_state']['type'] = 'select';
472 $args['business_info'][0]['business_state']['options'] = ['' => '&mdash;&mdash;&mdash;'] + ppress_array_of_world_states($business_country);
473 }
474
475 if (class_exists('\BuddyPress')) {
476 $args['buddypress_settings'] = apply_filters('ppress_buddypress_settings_page', [
477 'tab_title' => esc_html__('BuddyPress', 'wp-user-avatar'),
478 'section_title' => esc_html__('BuddyPress Settings', 'wp-user-avatar'),
479 'dashicon' => 'dashicons-buddicons-buddypress-logo',
480 'redirect_bp_registration_page' => [
481 'type' => 'checkbox',
482 'value' => 'yes',
483 'label' => esc_html__('Registration Page', 'wp-user-avatar'),
484 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
485 'description' => sprintf(__('Check to redirect BuddyPress registration page to your selected %s', 'wp-user-avatar'), '<a href="#global_settings?set_registration_url_row">custom registration page</a>')
486 ],
487 'override_bp_avatar' => [
488 'type' => 'checkbox',
489 'label' => esc_html__('Override Avatar', 'wp-user-avatar'),
490 'value' => 'yes',
491 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
492 'description' => esc_html__('Check to override BuddyPress users uploaded avatars with that of ProfilePress.', 'wp-user-avatar')
493 ],
494 'override_bp_profile_url' => [
495 'type' => 'checkbox',
496 'value' => 'yes',
497 'label' => esc_html__('Override Profile URL', 'wp-user-avatar'),
498 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
499 'description' => esc_html__('Check to change the profile URL of BuddyPress users to ProfilePress front-end profile.', 'wp-user-avatar')
500 ]
501 ]
502 );
503 }
504
505 if (class_exists('\bbPress')) {
506 $args['bbpress_settings'] = apply_filters('ppress_bbpress_settings_page', [
507 'tab_title' => esc_html__('bbPress', 'wp-user-avatar'),
508 'section_title' => esc_html__('bbPress Settings', 'wp-user-avatar'),
509 'dashicon' => 'dashicons-buddicons-bbpress-logo',
510 'override_bbp_profile_url' => [
511 'type' => 'checkbox',
512 'value' => 'yes',
513 'label' => esc_html__('Override Profile URL', 'wp-user-avatar'),
514 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
515 'description' => esc_html__('Check to change bbPress profile URL to ProfilePress front-end profile.', 'wp-user-avatar')
516 ]
517 ]
518 );
519 }
520
521 $this->settingsPageInstance->main_content(apply_filters('ppress_settings_page_args', $args));
522 $this->settingsPageInstance->build_sidebar_tab_style();
523 }
524
525 public function custom_sanitize()
526 {
527 $config = apply_filters('ppress_settings_custom_sanitize', [
528 'global_restricted_access_message' => function ($val) {
529 return wp_kses_post($val);
530 },
531 'uec_unactivated_error' => function ($val) {
532 return wp_kses_post($val);
533 },
534 'uec_invalid_error' => function ($val) {
535 return wp_kses_post($val);
536 },
537 'uec_success_message' => function ($val) {
538 return wp_kses_post($val);
539 },
540 'uec_activation_resent' => function ($val) {
541 return wp_kses_post($val);
542 },
543 'uec_already_confirm_message' => function ($val) {
544 return wp_kses_post($val);
545 }
546 ]);
547
548 foreach ($config as $fieldKey => $callback) {
549 add_filter('wp_cspa_sanitize_skip', function ($return, $key, $value) use ($fieldKey, $callback) {
550 if ($key == $fieldKey) {
551 return call_user_func($callback, $value);
552 }
553
554 return $return;
555 }, 10, 3);
556 }
557 }
558
559 public function js_script()
560 {
561 ?>
562 <script type="text/javascript">
563 (function ($) {
564 $('#business_country').on('change', function () {
565 $('#business_info').find('.button-primary').click();
566 })
567 })(jQuery)
568 </script>
569 <?php
570 }
571
572 public static function get_instance()
573 {
574 static $instance = null;
575
576 if (is_null($instance)) {
577 $instance = new self();
578 }
579
580 return $instance;
581 }
582 }