PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 3.2.7
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v3.2.7
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 AbstractSettingsPage.php 4 years ago AddNewForm.php 4 years ago AdminFooter.php 5 years ago ExtensionsSettingsPage.php 4 years ago FormList.php 5 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
477 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 // flush rewrite rule on save/persistence
27 add_action('wp_cspa_persist_settings', function () {
28 flush_rewrite_rules();
29 });
30
31 $this->custom_sanitize();
32 }
33
34 public function register_menu_page()
35 {
36 $hook = add_submenu_page(
37 PPRESS_SETTINGS_SLUG,
38 apply_filters('ppress_general_settings_admin_page_title', esc_html__('Settings', 'wp-user-avatar')) . ' - ProfilePress',
39 esc_html__('Settings', 'wp-user-avatar'),
40 'manage_options',
41 PPRESS_SETTINGS_SLUG,
42 array($this, 'admin_page_callback')
43 );
44
45 add_action("load-$hook", [$this, 'screen_option']);
46 }
47
48 public function default_header_menu()
49 {
50 return 'general';
51 }
52
53 public function header_menu_tabs()
54 {
55 $tabs = apply_filters('ppress_settings_page_tabs', [
56 20 => ['id' => 'general', 'url' => PPRESS_SETTINGS_SETTING_PAGE, 'label' => esc_html__('General', 'wp-user-avatar')],
57 40 => ['id' => 'email', 'url' => add_query_arg('view', 'email', PPRESS_SETTINGS_SETTING_PAGE), 'label' => esc_html__('Emails', 'wp-user-avatar')],
58 ]);
59
60 if ( ! empty($this->integrations_submenu_tabs())) {
61 $tabs[60] = ['id' => 'integrations', 'url' => add_query_arg('view', 'integrations', PPRESS_SETTINGS_SETTING_PAGE), 'label' => esc_html__('Integrations', 'wp-user-avatar')];
62 }
63
64 if ( ! ExtensionManager::is_premium()) {
65 $tabs[999] = ['url' => PPRESS_EXTENSIONS_SETTINGS_PAGE, 'label' => esc_html__('Premium Addons', 'wp-user-avatar')];
66 }
67
68 ksort($tabs);
69
70 return $tabs;
71 }
72
73 public function integrations_submenu_tabs()
74 {
75 return apply_filters('ppress_integrations_submenu_tabs', []);
76 }
77
78 public function header_submenu_tabs()
79 {
80 $tabs = apply_filters('ppress_settings_page_submenus_tabs', [
81 0 => ['parent' => 'general', 'id' => 'general', 'label' => esc_html__('General', 'wp-user-avatar')],
82 99999 => ['parent' => 'general', 'id' => 'tools', 'label' => esc_html__('Tools', 'wp-user-avatar')],
83 ]);
84
85 $tabs = $tabs + $this->integrations_submenu_tabs();
86
87 ksort($tabs);
88
89 return $tabs;
90 }
91
92 public function screen_option()
93 {
94 do_action('ppress_settings_page_screen_option');
95 }
96
97 public function settings_admin_page_callback()
98 {
99 $custom_page = apply_filters('ppress_general_settings_admin_page_short_circuit', false);
100
101 if (false !== $custom_page) return $custom_page;
102
103 $edit_profile_forms = array_reduce(FormRepository::get_forms(FormRepository::EDIT_PROFILE_TYPE),
104 function ($carry, $item) {
105 $carry[$item['form_id']] = $item['name'];
106
107 return $carry;
108 }, ['default' => esc_html__('My Account edit profile form (default)', 'wp-user-avatar')]);
109
110 $login_redirect_page_dropdown_args = [
111 ['key' => 'current_page', 'label' => esc_html__('Currently viewed page', 'wp-user-avatar')],
112 ['key' => 'none', 'label' => esc_html__('Previous/Referrer page (Pro feature)', 'wp-user-avatar'), 'disabled' => true],
113 ['key' => 'dashboard', 'label' => esc_html__('WordPress Dashboard', 'wp-user-avatar')]
114 ];
115
116 if (ExtensionManager::is_premium()) {
117 $login_redirect_page_dropdown_args[1] = ['key' => 'previous_page', 'label' => esc_html__('Previous/Referrer page', 'wp-user-avatar')];
118 }
119
120 $args = [
121 'global_settings' => apply_filters('ppress_global_settings_page', [
122 'tab_title' => esc_html__('Global', 'wp-user-avatar'),
123 'dashicon' => 'dashicons-admin-site-alt',
124 [
125 'section_title' => esc_html__('Global Settings', 'wp-user-avatar'),
126 'set_lost_password_url' => [
127 'type' => 'custom_field_block',
128 'label' => esc_html__('Password-reset Page', 'wp-user-avatar'),
129 'data' => $this->page_dropdown('set_lost_password_url'),
130 'description' => sprintf(
131 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'),
132 '<a href="' . add_query_arg('form-type', 'password-reset', PPRESS_FORMS_SETTINGS_PAGE) . '"><strong>', '</strong></a>', '<br/>'),
133 ],
134 'set_login_url' => [
135 'type' => 'custom_field_block',
136 'label' => esc_html__('Login Page', 'wp-user-avatar'),
137 'data' => $this->page_dropdown('set_login_url'),
138 'description' => sprintf(
139 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'),
140 '<a href="' . add_query_arg('form-type', 'login', PPRESS_FORMS_SETTINGS_PAGE) . '"><strong>', '</strong></a>', '<br/>'),
141 ],
142 'set_registration_url' => [
143 'type' => 'custom_field_block',
144 'label' => esc_html__('Registration Page', 'wp-user-avatar'),
145 'data' => $this->page_dropdown('set_registration_url'),
146 'description' => sprintf(
147 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'),
148 '<a href="' . add_query_arg('form-type', 'registration', PPRESS_FORMS_SETTINGS_PAGE) . '"><strong>', '</strong></a>', '<br/>'),
149 ],
150 'edit_user_profile_url' => [
151 'type' => 'custom_field_block',
152 'label' => esc_html__('My Account Page', 'wp-user-avatar'),
153 'data' => $this->page_dropdown('edit_user_profile_url'),
154 'description' => sprintf(
155 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'),
156 '<a href="' . add_query_arg('form-type', 'edit-profile', PPRESS_FORMS_SETTINGS_PAGE) . '"><strong>', '</strong></a>', '<code>[profilepress-my-account]</code>'),
157 ],
158 'disable_ajax_mode' => [
159 'type' => 'checkbox',
160 'label' => esc_html__('Disable Ajax Mode', 'wp-user-avatar'),
161 'value' => 'yes',
162 'checkbox_label' => esc_html__('Disable', 'wp-user-avatar'),
163 'description' => esc_html__('Check this box to disable ajax behaviour(whereby forms do not require page reload when submitted) in forms.', 'wp-user-avatar'),
164 ],
165 'remove_plugin_data' => [
166 'type' => 'checkbox',
167 'value' => 'yes',
168 'label' => esc_html__('Remove Data on Uninstall', 'wp-user-avatar'),
169 'checkbox_label' => esc_html__('Delete', 'wp-user-avatar'),
170 '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'),
171 ]
172 ]
173 ]),
174 'registration_settings' => apply_filters('ppress_registration_settings_page', [
175 'tab_title' => esc_html__('Registration', 'wp-user-avatar'),
176 'dashicon' => 'dashicons-welcome-learn-more',
177 [
178 'section_title' => esc_html__('Registration Settings', 'wp-user-avatar'),
179 'set_auto_login_after_reg' => [
180 'type' => 'checkbox',
181 'label' => esc_html__('Auto-login after registration', 'wp-user-avatar'),
182 'checkbox_label' => esc_html__('Enable auto-login', 'wp-user-avatar'),
183 'value' => 'on',
184 'description' => esc_html__('Check this option to automatically login users after successful registration.', 'wp-user-avatar')
185 ]
186 ]
187 ]),
188 'login_settings' => apply_filters('ppress_login_settings_page', [
189 'tab_title' => esc_html__('Login', 'wp-user-avatar'),
190 'dashicon' => 'dashicons-universal-access-alt',
191 [
192 'section_title' => esc_html__('Login Settings', 'wp-user-avatar'),
193 'login_username_email_restrict' => [
194 'type' => 'select',
195 'options' => [
196 'both' => esc_html__('Email Address and Username (default)', 'wp-user-avatar'),
197 'email' => esc_html__('Email Address Only', 'wp-user-avatar'),
198 'username' => esc_html__('Username Only', 'wp-user-avatar')
199 ],
200 'value' => '',
201 'label' => esc_html__('Login with Email or Username', 'wp-user-avatar'),
202 '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')
203 ],
204 ]
205 ]),
206 'my_account_settings' => apply_filters('ppress_my_account_settings_page', [
207 'tab_title' => esc_html__('My Account', 'wp-user-avatar'),
208 'section_title' => esc_html__('My Account Settings', 'wp-user-avatar'),
209 'dashicon' => 'dashicons-dashboard',
210 'redirect_default_edit_profile_to_custom' => [
211 'type' => 'checkbox',
212 'label' => esc_html__('Redirect Default Edit Profile', 'wp-user-avatar'),
213 'checkbox_label' => esc_html__('Activate', 'wp-user-avatar'),
214 'value' => 'yes',
215 'description' => sprintf(
216 __('Redirect <a target="_blank" href="%s">default WordPress profile</a> to My Account page.', 'wp-user-avatar'),
217 admin_url('profile.php')
218 )
219 ],
220 'myac_edit_account_endpoint' => [
221 'type' => 'text',
222 'value' => 'edit-profile',
223 'label' => esc_html__('Edit Account Endpoint', 'wp-user-avatar'),
224 'description' => __('Endpoint for the "My Account → Account Details" page.', 'wp-user-avatar'),
225 ],
226 'myac_change_password_endpoint' => [
227 'type' => 'text',
228 'value' => 'change-password',
229 'label' => esc_html__('Change Password Endpoint', 'wp-user-avatar'),
230 'description' => __('Endpoint for the "My Account → Change Password" page.', 'wp-user-avatar'),
231 ],
232 'myac_account_details_form' => [
233 'type' => 'select',
234 'options' => $edit_profile_forms,
235 'label' => esc_html__('Account Details Form', 'wp-user-avatar'),
236 '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')
237 ],
238 ]),
239 'frontend_profile_settings' => apply_filters('ppress_frontend_profile_settings_page', [
240 'tab_title' => esc_html__('Frontend Profile', 'wp-user-avatar'),
241 'section_title' => esc_html__('Frontend Profile Settings', 'wp-user-avatar'),
242 'dashicon' => 'dashicons-admin-users',
243 'set_user_profile_shortcode' => [
244 'type' => 'custom_field_block',
245 'label' => esc_html__('Page with Profile Shortcode', 'wp-user-avatar'),
246 'data' => $this->page_dropdown('set_user_profile_shortcode'),
247 'description' => sprintf(__('Select the page that contains your <a href="%s">Frontend user profile shortcode</a>.', 'wp-user-avatar'), PPRESS_USER_PROFILES_SETTINGS_PAGE),
248 ],
249 'set_user_profile_slug' => [
250 'type' => 'text',
251 'value' => 'profile',
252 'label' => esc_html__('Profile Slug', 'wp-user-avatar'),
253 '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>'),
254 ],
255 'disable_guests_can_view_profiles' => [
256 'type' => 'checkbox',
257 'label' => esc_html__('Disable Guests from Viewing Profiles', 'wp-user-avatar'),
258 'description' => esc_html__('Enable this option to stop disable guests or non-registered users from viewing users profiles.', 'wp-user-avatar'),
259 'value' => 'on'
260 ],
261 'disable_members_can_view_profiles' => [
262 'type' => 'checkbox',
263 'label' => esc_html__('Disable Members from Viewing Profiles', 'wp-user-avatar'),
264 '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'),
265 'value' => 'on'
266 ],
267 'comment_author_url_to_profile' => [
268 'type' => 'checkbox',
269 'label' => esc_html__('Comment Author URL to Profile', 'wp-user-avatar'),
270 'checkbox_label' => esc_html__('Enable option', 'wp-user-avatar'),
271 'value' => 'on',
272 'description' => sprintf(__("Change URL of comment authors to their ProfilePress front-end profile.", 'wp-user-avatar'))
273 ],
274 'author_slug_to_profile' => [
275 'type' => 'checkbox',
276 'label' => esc_html__('Authors Page to Profile', 'wp-user-avatar'),
277 'checkbox_label' => esc_html__('Enable option', 'wp-user-avatar'),
278 'value' => 'on',
279 '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>')
280 ],
281 ]
282 ),
283 'redirection_settings' => apply_filters('ppress_redirection_settings_page', [
284 'tab_title' => esc_html__('Redirection', 'wp-user-avatar'),
285 'section_title' => esc_html__('Redirection Settings', 'wp-user-avatar'),
286 'dashicon' => 'dashicons-redo',
287 'set_log_out_url' => [
288 'type' => 'custom_field_block',
289 'label' => esc_html__('Log out', 'wp-user-avatar'),
290 'data' => $this->page_dropdown('set_log_out_url',
291 [
292 ['key' => 'default', 'label' => esc_html__('Select...', 'wp-user-avatar')],
293 ['key' => 'current_view_page', 'label' => esc_html__('Currently viewed page', 'wp-user-avatar')]
294 ],
295 ['skip_append_default_select' => true]
296 ) . $this->custom_text_input('custom_url_log_out'),
297 'description' => sprintf(
298 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' .
299 esc_html__('Leave the "custom URL" field empty to fallback to the selected page.', 'wp-user-avatar'),
300 '<br/>'
301 )
302 ],
303 'set_login_redirect' => [
304 'type' => 'custom_field_block',
305 'label' => esc_html__('Login', 'wp-user-avatar'),
306 'data' => $this->page_dropdown('set_login_redirect', $login_redirect_page_dropdown_args) . $this->custom_text_input('custom_url_login_redirect'),
307 'description' => sprintf(
308 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' .
309 esc_html__('Leave the "custom URL" field empty to fallback to the selected page.', 'wp-user-avatar'),
310 '<br/>'
311 )
312 ],
313 'set_password_reset_redirect' => [
314 'type' => 'custom_field_block',
315 'label' => esc_html__('Password Reset', 'wp-user-avatar'),
316 'data' => $this->page_dropdown(
317 'set_password_reset_redirect',
318 [],
319 [
320 'show_option_none' => esc_html__('Default..', 'wp-user-avatar'),
321 'option_none_value' => 'no_redirect',
322 ]
323 ) . $this->custom_text_input('custom_url_password_reset_redirect'),
324 'description' => sprintf(
325 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' .
326 esc_html__('Leave the "custom URL" field empty to fallback to the selected page.', 'wp-user-avatar'),
327 '<br/>'
328 )
329 ]
330 ]),
331 'access_settings' => apply_filters('ppress_access_settings_page', [
332 'tab_title' => esc_html__('Access', 'wp-user-avatar'),
333 'section_title' => esc_html__('Access Settings', 'wp-user-avatar'),
334 'dashicon' => 'dashicons-products',
335 'global_site_access_notice' => [
336 'type' => 'arbitrary',
337 'data' => '',
338 'description' => sprintf(
339 '<div class="ppress-settings-page-notice">' . esc_html__('%sNote:%s Access setting takes precedence over %sContent Protection rules%s.', 'wp-user-avatar'),
340 '<strong>', '</strong>', '<a target="_blank" href="' . PPRESS_CONTENT_PROTECTION_SETTINGS_PAGE . '">', '</a>'
341 )
342 ],
343 'global_site_access' => [
344 'type' => 'select',
345 'label' => esc_html__('Global Site Access', 'wp-user-avatar'),
346 'options' => [
347 'everyone' => esc_html__('Accessible to Everyone', 'wp-user-avatar'),
348 'login' => esc_html__('Accessible to Logged-in Users', 'wp-user-avatar')
349 ]
350 ],
351 'global_site_access_redirect_page' => [
352 'type' => 'custom_field_block',
353 'label' => esc_html__('Redirect Page', 'wp-user-avatar'),
354 'data' => $this->page_dropdown('global_site_access_redirect_page') . $this->custom_text_input('global_site_access_custom_redirect_page'),
355 'description' => esc_html__('Select the page or custom URL to redirect users that are not logged in to.', 'wp-user-avatar')
356 ],
357 'global_site_access_exclude_pages' => [
358 'type' => 'select2',
359 'label' => esc_html__('Pages to Exclude', 'wp-user-avatar'),
360 'options' => array_reduce(get_pages(), function ($carry, $item) {
361 $carry[$item->ID] = $item->post_title;
362
363 return $carry;
364 }, []),
365 'description' => esc_html__('Select the pages to exclude beside the redirect page that will be accessible by everyone.', 'wp-user-avatar')
366 ],
367 'global_site_access_allow_homepage' => [
368 'type' => 'checkbox',
369 'value' => 'yes',
370 'checkbox_label' => esc_html__('Enable', 'wp-user-avatar'),
371 'label' => esc_html__('Accessible Homepage', 'wp-user-avatar'),
372 'description' => esc_html__('Check to allow homepage to be accessible by everyone.', 'wp-user-avatar')
373 ],
374 'global_restricted_access_message' => [
375 'type' => 'wp_editor',
376 'value' => esc_html__('You are unauthorized to view this page.', 'wp-user-avatar'),
377 'label' => esc_html__('Global Restricted Access Message', 'wp-user-avatar'),
378 'description' => esc_html__('This is the message shown to users that do not have permission to view the content.', 'wp-user-avatar')
379 ],
380 ])
381 ];
382
383 if (class_exists('\BuddyPress')) {
384 $args['buddypress_settings'] = apply_filters('ppress_buddypress_settings_page', [
385 'tab_title' => esc_html__('BuddyPress', 'wp-user-avatar'),
386 'section_title' => esc_html__('BuddyPress Settings', 'wp-user-avatar'),
387 'dashicon' => 'dashicons-buddicons-buddypress-logo',
388 'redirect_bp_registration_page' => [
389 'type' => 'checkbox',
390 'value' => 'yes',
391 'label' => esc_html__('Registration Page', 'wp-user-avatar'),
392 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
393 '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>')
394 ],
395 'override_bp_avatar' => [
396 'type' => 'checkbox',
397 'label' => esc_html__('Override Avatar', 'wp-user-avatar'),
398 'value' => 'yes',
399 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
400 'description' => esc_html__('Check to override BuddyPress users uploaded avatars with that of ProfilePress.', 'wp-user-avatar')
401 ],
402 'override_bp_profile_url' => [
403 'type' => 'checkbox',
404 'value' => 'yes',
405 'label' => esc_html__('Override Profile URL', 'wp-user-avatar'),
406 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
407 'description' => esc_html__('Check to change the profile URL of BuddyPress users to ProfilePress front-end profile.', 'wp-user-avatar')
408 ]
409 ]
410 );
411 }
412
413 if (class_exists('\bbPress')) {
414 $args['bbpress_settings'] = apply_filters('ppress_bbpress_settings_page', [
415 'tab_title' => esc_html__('bbPress', 'wp-user-avatar'),
416 'section_title' => esc_html__('bbPress Settings', 'wp-user-avatar'),
417 'dashicon' => 'dashicons-buddicons-bbpress-logo',
418 'override_bbp_profile_url' => [
419 'type' => 'checkbox',
420 'value' => 'yes',
421 'label' => esc_html__('Override Profile URL', 'wp-user-avatar'),
422 'checkbox_label' => esc_html__('Check to enable', 'wp-user-avatar'),
423 'description' => esc_html__('Check to change bbPress profile URL to ProfilePress front-end profile.', 'wp-user-avatar')
424 ]
425 ]
426 );
427 }
428
429 $this->settingsPageInstance->main_content(apply_filters('ppress_settings_page_args', $args));
430 $this->settingsPageInstance->build_sidebar_tab_style();
431 }
432
433 public function custom_sanitize()
434 {
435 $config = apply_filters('ppress_settings_custom_sanitize', [
436 'global_restricted_access_message' => function ($val) {
437 return wp_kses_post($val);
438 },
439 'uec_unactivated_error' => function ($val) {
440 return wp_kses_post($val);
441 },
442 'uec_invalid_error' => function ($val) {
443 return wp_kses_post($val);
444 },
445 'uec_success_message' => function ($val) {
446 return wp_kses_post($val);
447 },
448 'uec_activation_resent' => function ($val) {
449 return wp_kses_post($val);
450 },
451 'uec_already_confirm_message' => function ($val) {
452 return wp_kses_post($val);
453 }
454 ]);
455
456 foreach ($config as $fieldKey => $callback) {
457 add_filter('wp_cspa_sanitize_skip', function ($return, $key, $value) use ($fieldKey, $callback) {
458 if ($key == $fieldKey) {
459 return call_user_func($callback, $value);
460 }
461
462 return $return;
463 }, 10, 3);
464 }
465 }
466
467 public static function get_instance()
468 {
469 static $instance = null;
470
471 if (is_null($instance)) {
472 $instance = new self();
473 }
474
475 return $instance;
476 }
477 }