PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.34
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.34
1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.23 All 172 releases
userswp / admin / settings / class-uwp-settings-general.php

class-uwp-settings-general.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.2.34, at admin/settings/class-uwp-settings-general.php

798 lines 32.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * UsersWP General Settings
4 *
5 * @author AyeCode
6 * @category Admin
7 * @package userswp/Admin
8 * @version 1.0.24
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14
15 if ( ! class_exists( 'UsersWP_Settings_General', false ) ) :
16
17 /**
18 * UsersWP_Settings_General.
19 */
20 class UsersWP_Settings_General extends UsersWP_Settings_Page {
21
22 /**
23 * Constructor.
24 */
25 public function __construct() {
26
27 $this->id = 'general';
28 $this->label = __( 'General', 'userswp' );
29
30 add_filter( 'uwp_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
31 add_action( 'uwp_settings_' . $this->id, array( $this, 'output' ) );
32 add_action( 'uwp_sections_' . $this->id, array( $this, 'output_toggle_advanced' ) );
33 add_action( 'uwp_settings_save_' . $this->id, array( $this, 'save' ) );
34 add_action( 'uwp_sections_' . $this->id, array( $this, 'output_sections' ) );
35
36
37 }
38
39 /**
40 * Output the settings.
41 */
42 public function output() {
43 global $current_section;
44
45 $settings = $this->get_settings( $current_section );
46
47 UsersWP_Admin_Settings::output_fields( $settings );
48 }
49
50
51 /**
52 * Save settings.
53 */
54 public function save() {
55 global $current_section;
56
57 $settings = $this->get_settings( $current_section );
58 UsersWP_Admin_Settings::save_fields( $settings );
59 }
60
61 /**
62 * Get sections.
63 *
64 * @return array
65 */
66 public function get_sections() {
67
68 $sections = array(
69 '' => __( 'Pages', 'userswp' ),
70 'register' => __( 'Register', 'userswp' ),
71 'login' => __( 'Login', 'userswp' ),
72 'change-password' => __( 'Change Password', 'userswp' ),
73 'profile' => __( 'Profile', 'userswp' ),
74 'users' => __( 'Users', 'userswp' ),
75 'account' => __( 'Account', 'userswp' ),
76 'authorbox' => __( 'Author box', 'userswp' ),
77 'developer' => __( 'Developer', 'userswp' ),
78 );
79
80 return apply_filters( 'uwp_get_sections_' . $this->id, $sections );
81 }
82
83 /**
84 * Get general settings array.
85 *
86 * @return array
87 */
88 public function get_settings( $current_section = '' ) {
89
90 if ( 'register' == $current_section ) {
91 /**
92 * Filter registration settings array.
93 *
94 * @package userswp
95 */
96
97 $settings = apply_filters( 'uwp_register_options', array(
98 array(
99 'title' => __( 'Register Settings', 'userswp' ),
100 'type' => 'title',
101 'id' => 'register_options',
102 ),
103 array(
104 'id' => 'register_modal',
105 'name' => __( 'Register Lightbox', 'userswp' ),
106 'desc' => __( 'When enabled some register links will open in a lightbox instead of changing page.','userswp'),
107 'type' => 'checkbox',
108 'default' => '1',
109 ),
110 array(
111 'id' => 'register_modal_form',
112 'name' => __( 'Lightbox Form(s)', 'userswp' ),
113 'desc' => __( 'Choose form(s) to display in lighbox. You can select multiple forms.','userswp'),
114 'type' => 'multiselect',
115 'options' => uwp_get_register_forms_dropdown_options(),
116 'default' => '1',
117 'desc_tip' => true,
118 ),
119 array(
120 'id' => 'wp_register_redirect',
121 'name' => __( 'Redirect Admin Default Register Page', 'userswp' ),
122 'desc' => __( 'When enabled /wp-login.php?action=register page will be redirected to UsersWP register page.', 'userswp' ),
123 'type' => 'checkbox',
124 'default' => '1',
125 ),
126 array(
127 'id' => 'register_min_password_strength',
128 'name' => __( 'Minimum password strength', 'userswp' ),
129 'desc' => __( 'Forces users to use strong password on registration if set.', 'userswp' ),
130 'type' => 'select',
131 'options' => array(''=>'None','3'=>'Medium','4'=>'Strong'),
132 'default' => '',
133 'desc_tip' => true,
134 ),
135 array(
136 'id' => 'register_uwp_strong_pass_msg',
137 'name' => __( 'Error message for entering strong password', 'userswp' ),
138 'desc' => __( 'Enter the message to show when user enters weak password in registration form.', 'userswp' ),
139 'type' => 'text',
140 'default' => '',
141 'placeholder' => __( 'Please enter valid strong password.', 'userswp' ),
142 'desc_tip' => true,
143 'advanced' => true,
144 ),
145 array(
146 'id' => 'register_username_length',
147 'name' => __( 'Username Minimum Length', 'userswp' ),
148 'desc' => __( 'Minimum username character limit required for registration.', 'userswp' ),
149 'desc_tip' => true,
150 'type' => 'number',
151 'default' => '4',
152 'advanced' => true,
153 ),
154 array(
155 'id' => 'register_password_min_length',
156 'name' => __( 'Minimum Password Limit', 'userswp' ),
157 'desc' => __( 'Minimum Password limit user should enter in the form.', 'userswp' ),
158 'desc_tip' => true,
159 'type' => 'number',
160 'default' => '8',
161 'advanced' => true,
162 ),
163 array(
164 'id' => 'register_password_max_length',
165 'name' => __( 'Maximum Password Limit', 'userswp' ),
166 'desc' => __( 'Maximum Password limit user should enter in the form.', 'userswp' ),
167 'desc_tip' => true,
168 'type' => 'number',
169 'default' => '15',
170 'advanced' => true,
171 ),
172
173 array( 'type' => 'sectionend', 'id' => 'register_options' ),
174 ));
175 } else if ( 'login' == $current_section ) {
176 /**
177 * Filter login settings array.
178 *
179 * @package userswp
180 */
181 $pages = get_pages();
182 $pages_options = array(
183 '-1' => __( 'Last User Page', 'userswp' ),
184 '0' => __( 'Default Redirect', 'userswp'),
185 '-2' => __( 'Custom Redirect', 'userswp'),
186 );
187 if ( $pages ) {
188 foreach ( $pages as $page ) {
189 $pages_options[ $page->ID ] = $page->post_title;
190 }
191 }
192
193 $settings = apply_filters( 'uwp_login_options', array(
194 array(
195 'title' => __( 'Login Settings', 'userswp' ),
196 'type' => 'title',
197 'id' => 'login_options',
198 ),
199 array(
200 'id' => 'login_modal',
201 'name' => __( 'Login Lightbox', 'userswp' ),
202 'desc' => __( 'When enabled some login links will open in a lightbox instead of changing page. The page will be reloaded after successful login instead of a redirect.','userswp'),
203 'type' => 'checkbox',
204 'default' => '1',
205 ),
206 array(
207 'id' => 'login_modal_enable_redirect',
208 'name' => __( 'Enable Login Lightbox Redirect', 'userswp' ),
209 'desc' => __( 'When enabled the login in lightbox will follow login redirect settings.','userswp'),
210 'type' => 'checkbox',
211 'default' => '0',
212 ),
213 array(
214 'id' => 'login_redirect_to',
215 'name' => __( 'Login Redirect Page', 'userswp' ),
216 'desc' => __( 'Set the page to redirect the user to after logging in. If default redirect has been set then WordPress default will be used.', 'userswp' ),
217 'type' => 'select',
218 'options' => $pages_options,
219 'default' => '-1',
220 'desc_tip' => true,
221 ),
222 array(
223 'id' => 'login_redirect_custom_url',
224 'name' => __( 'Redirect Custom URL', 'userswp' ),
225 'desc' => __( 'Set the custom url to redirect the user to after logging in.', 'userswp' ),
226 'type' => 'text',
227 'default' => '',
228 'desc_tip' => true,
229 'class' => 'uwp-login-redirect-custom-url',
230 ),
231 array(
232 'id' => 'register_link_title',
233 'name' => __( 'Register Link Title', 'userswp' ),
234 'desc' => __( 'Enter the register link title.', 'userswp' ),
235 'type' => 'text',
236 'default' => '',
237 'placeholder' => __( 'Create account', 'userswp' ),
238 'desc_tip' => true,
239 'advanced' => true,
240 ),
241 array(
242 'id' => 'forgot_link_title',
243 'name' => __( 'Forgot Password Link Title', 'userswp' ),
244 'desc' => __( 'Enter the forgot password title.', 'userswp' ),
245 'type' => 'text',
246 'default' => '',
247 'placeholder' => __( 'Forgot password?', 'userswp' ),
248 'desc_tip' => true,
249 'advanced' => true,
250 ),
251 array(
252 'id' => 'block_wp_login',
253 'name' => __( 'Redirect wp-login.php?', 'userswp' ),
254 'desc' => __('When enabled /wp-login.php page will be redirected to UsersWP login page.','userswp' ),
255 'type' => 'checkbox',
256 'default' => '0',
257 ),
258 array(
259 'name' => __( 'Restrict wp-admin', 'userswp' ),
260 'desc' => __( 'The user roles that should be restricted from accessing the wp-admin area.', 'userswp' ),
261 'id' => 'admin_blocked_roles',
262 'default' => array('subscriber'),
263 'type' => 'multiselect',
264 'class' => 'uwp-select',
265 'options' => uwp_get_user_roles(array('administrator')),
266 'desc_tip' => true,
267 ),
268 array(
269 'id' => 'logout_redirect_to',
270 'name' => __( 'Logout Redirect Page', 'userswp' ),
271 'desc' => __( 'Set the page to redirect the user to after logging out. If no page has been set WordPress default will be used.', 'userswp' ),
272 'type' => 'single_select_page',
273 'desc_tip' => true,
274 ),
275 array(
276 'id' => 'disable_wp_2fa',
277 'name' => __( 'Disable WP-2FA', 'userswp' ),
278 'desc' => __('This will disable integration with WP 2FA - Two-factor authentication for WordPress plugin.','userswp' ),
279 'type' => 'checkbox',
280 'default' => '0',
281 ),
282 array( 'type' => 'sectionend', 'id' => 'login_options' ),
283 ));
284 } else if ( 'change-password' == $current_section ) {
285 /**
286 * Filter change password settings array.
287 *
288 * @package userswp
289 */
290 $settings = apply_filters( 'uwp_change_password_options', array(
291 array(
292 'title' => __( 'Change Password Settings', 'userswp' ),
293 'type' => 'title',
294 'id' => 'change_password_options',
295 ),
296 array(
297 'id' => 'forgot_modal',
298 'name' => __( 'Forgot password lightbox', 'userswp' ),
299 'desc' => __( 'When enabled some forgot password links will open in a lightbox instead of changing page.','userswp'),
300 'type' => 'checkbox',
301 'default' => '1',
302 ),
303 array(
304 'id' => 'login_link_title',
305 'name' => __( 'Login Link Title', 'userswp' ),
306 'desc' => __( 'Enter the login link title.', 'userswp' ),
307 'type' => 'text',
308 'default' => '',
309 'placeholder' => __( 'Login', 'userswp' ),
310 'desc_tip' => true,
311 'advanced' => true,
312 ),
313 array(
314 'id' => 'profile_link_title',
315 'name' => __( 'Profile Link Title', 'userswp' ),
316 'desc' => __( 'Enter the profile link title.', 'userswp' ),
317 'type' => 'text',
318 'default' => '',
319 'placeholder' => __( 'Profile', 'userswp' ),
320 'desc_tip' => true,
321 'advanced' => true,
322 ),
323 array(
324 'id' => 'account_link_title',
325 'name' => __( 'Account Link Title', 'userswp' ),
326 'desc' => __( 'Enter the account link title.', 'userswp' ),
327 'type' => 'text',
328 'default' => '',
329 'placeholder' => __( 'Account', 'userswp' ),
330 'desc_tip' => true,
331 'advanced' => true,
332 ),
333 array(
334 'id' => 'change_enable_old_password',
335 'name' => __( 'Enabled Old Password?', 'userswp' ),
336 'desc' => __( 'Ask user to enter their old password before changing the password to add an extra layer of security.', 'userswp' ),
337 'type' => 'checkbox',
338 'default' => '1',
339 ),
340 array(
341 'id' => 'change_disable_password_nag',
342 'name' => __( 'Disable system generated password notice.', 'userswp' ),
343 'desc' => __( 'This option will disable system generated password notice if user has not changed default password after registration.', 'userswp' ),
344 'type' => 'checkbox',
345 'default' => '0',
346 ),
347
348 array( 'type' => 'sectionend', 'id' => 'change_password_options' ),
349 ));
350 } else if ( 'profile' == $current_section ) {
351 /**
352 * Filter profile settings array.
353 *
354 * @package userswp
355 */
356 $file_obj = new UsersWP_Files();
357
358 $settings = apply_filters( 'uwp_profile_options', array(
359 array(
360 'title' => __( 'Profile Settings', 'userswp' ),
361 'type' => 'title',
362 'id' => 'profile_options',
363 ),
364 array(
365 'id' => 'profile_default_banner',
366 'name' => __( 'Default banner image', 'userswp' ),
367 'desc' => __( 'Recommended image size: 1000x300', 'userswp'),
368 'type' => 'image',
369 'default' => '',
370 'desc_tip' => true,
371 ),
372 array(
373 'id' => 'profile_default_profile',
374 'name' => __( 'Default profile image', 'userswp' ),
375 'desc' => __( 'Recommended image size: 150x150', 'userswp'),
376 'type' => 'image',
377 'default' => '',
378 'desc_tip' => true,
379 ),
380 array(
381 'id' => 'enable_profile_header',
382 'name' => __( 'Display header in profile', 'userswp' ),
383 'type' => 'checkbox',
384 'default' => '1',
385 'advanced' => true,
386 ),
387 array(
388 'id' => 'enable_profile_body',
389 'name' => __( 'Display body in profile', 'userswp' ),
390 'type' => 'checkbox',
391 'default' => '1',
392 'advanced' => true,
393 ),
394 array(
395 'id' => 'profile_avatar_size',
396 'name' => __( 'Profile avatar max file size', 'userswp' ),
397 'desc' => sprintf(__( 'Enter Profile Avatar max file size in Kb. e.g. 512 for 512 kb, 1024 for 1 Mb, 2048 for 2 Mb etc. If empty WordPress default (%s) will be used.', 'userswp' ), '<b>'.$file_obj->uwp_formatSizeinKb($file_obj->uwp_get_max_upload_size()).'</b>'),
398 'type' => 'number',
399 'default' => '',
400 'desc_tip' => true,
401 'advanced' => true,
402 ),
403 array(
404 'id' => 'profile_banner_size',
405 'name' => __( 'Profile banner max file size', 'userswp' ),
406 'desc' => sprintf(__( 'Enter Profile Banner max file size in Kb. e.g. 512 for 512 kb, 1024 for 1 Mb, 2048 for 2 Mb etc. If empty WordPress default (%s) will be used.', 'userswp' ), '<b>'.$file_obj->uwp_formatSizeinKb($file_obj->uwp_get_max_upload_size()).'</b>'),
407 'type' => 'number',
408 'default' => '',
409 'desc_tip' => true,
410 'advanced' => true,
411 ),
412 array(
413 'id' => 'profile_avatar_width',
414 'name' => __( 'Profile avatar width', 'userswp' ),
415 'type' => 'number',
416 'default' => 150,
417 'advanced' => true,
418 ),
419 array(
420 'id' => 'profile_avatar_height',
421 'name' => __( 'Profile avatar height', 'userswp' ),
422 'type' => 'number',
423 'default' => 150,
424 'advanced' => true,
425 ),
426 array(
427 'id' => 'profile_banner_width',
428 'name' => __( 'Profile banner width', 'userswp' ),
429 'type' => 'number',
430 'default' => 1000,
431 'advanced' => true,
432 ),
433 array(
434 'id' => 'profile_banner_height',
435 'name' => __( 'Profile banner height', 'userswp' ),
436 'type' => 'number',
437 'default' => 300,
438 'advanced' => true,
439 ),
440 array(
441 'id' => 'profile_no_of_items',
442 'name' => __( 'Number of items', 'userswp' ),
443 'type' => 'number',
444 'default' => 10,
445 'desc' => __( 'Enter number of items to display in profile tabs.', 'userswp' ),
446 'desc_tip' => true,
447 'advanced' => true,
448 ),
449 array(
450 'id' => 'uwp_disable_author_link',
451 'name' => __( 'Disable author redirect to UsersWP profile page.', 'userswp' ),
452 'type' => 'checkbox',
453 'default' => '0',
454 'advanced' => true,
455 ),
456 array(
457 'id' => 'user_post_counts_cpts',
458 'name' => __( 'User Counts CPTs', 'userswp' ),
459 'desc' => __( 'Choose post types to display user counts in profile page for all users.', 'userswp' ),
460 'type' => 'multiselect',
461 'sortable' => true,
462 'options' => uwp_get_posttypes(),
463 'desc_tip' => true,
464 ),
465 array(
466 'id' => 'login_user_post_counts_cpts',
467 'name' => __( 'User Counts CPTs for profile owner', 'userswp' ),
468 'desc' => __( 'Choose post types to display user counts in profile page for profile owners.', 'userswp' ),
469 'type' => 'multiselect',
470 'sortable' => true,
471 'options' => uwp_get_posttypes(),
472 'desc_tip' => true,
473 ),
474 array( 'type' => 'sectionend', 'id' => 'profile_options' ),
475 ));
476 } else if ( 'users' == $current_section ) {
477 /**
478 * Filter general settings array.
479 *
480 * @package userswp
481 */
482 $settings = apply_filters( 'uwp_users_options', array(
483 array(
484 'title' => __( 'Users Settings', 'userswp' ),
485 'type' => 'title',
486 'id' => 'users_options',
487 ),
488
489 array(
490 'id' => 'users_default_layout',
491 'name' => __( 'Users default layout', 'userswp' ),
492 'desc' => __( 'Choose the default layout for users listing page.', 'userswp' ),
493 'type' => 'select',
494 'options' => $this->uwp_available_users_layout(),
495 'desc_tip' => true,
496 ),
497 array(
498 'id' => 'users_no_of_items',
499 'name' => __( 'Number of items', 'userswp' ),
500 'type' => 'number',
501 'default' => 10,
502 'desc' => __( 'Enter number of items to display in users list page.', 'userswp' ),
503 'desc_tip' => true,
504 'advanced' => true,
505 ),
506 array(
507 'id' => 'users_excluded_from_list',
508 'name' => __( 'Users to exclude', 'uwp-messaging' ),
509 'desc' => __( 'Select users to exclude from the users listing.', 'userswp' ),
510 'desc_tip' => true,
511 'type' => 'multiselect',
512 'size' => 'regular',
513 'options' => $this->get_users(),
514 ),
515
516 array( 'type' => 'sectionend', 'id' => 'users_options' ),
517 ));
518 }else if ( 'account' == $current_section ) {
519 /**
520 * Filter general settings array.
521 *
522 * @package userswp
523 */
524 $settings = apply_filters( 'uwp_users_options', array(
525 array(
526 'title' => __( 'User Account Settings', 'userswp' ),
527 'type' => 'title',
528 'id' => 'accounts_options',
529 ),
530
531 array(
532 'id' => 'disable_account_delete',
533 'name' => __( 'Disable Account Delete', 'userswp' ),
534 'desc' => __( 'Don\'t allow users to delete their own account. Default enabled.' , 'userswp' ),
535 'type' => 'checkbox',
536 'default' => 0,
537 ),
538
539 array( 'type' => 'sectionend', 'id' => 'accounts_options' ),
540 ));
541 }else if ( 'authorbox' == $current_section ) {
542 /**
543 * Filter general settings array.
544 *
545 * @package userswp
546 */
547 $settings = apply_filters( 'uwp_authorbox_options', array(
548 array(
549 'title' => __( 'Author Box Settings', 'userswp' ),
550 'type' => 'title',
551 'id' => 'authorbox_options',
552 ),
553 array(
554 'id' => 'author_box_enable_disable',
555 'name' => __( 'Enable Author Box', 'userswp' ),
556 'desc' => __( 'Displays author box based on settings', 'userswp' ),
557 'type' => 'checkbox',
558 'default' => '1',
559 ),
560 array(
561 'id' => 'author_box_display_content',
562 'name' => __('Where to display?', 'userswp'),
563 'desc' => __('Displays the author box above or below post content.', 'userswp'),
564 'type' => 'select',
565 'options' => array(
566 'above_content' => __('Above content', 'userswp'),
567 'below_content' => __('Below content', 'userswp'),
568 ),
569 'desc_tip' => true,
570 'default' => 'below_content',
571 ),
572 array(
573 'id' => 'author_box_display_post_types',
574 'name' => __( 'Post types', 'userswp' ),
575 'desc' => __( 'Choose post types to display author box', 'userswp' ),
576 'type' => 'multiselect',
577 'sortable' => true,
578 'options' => uwp_get_posttypes(),
579 'desc_tip' => true,
580 'default' => 'post',
581 ),
582 array(
583 'id' => 'author_box_bio_limit',
584 'name' => __( 'Bio Length', 'userswp' ),
585 'desc' => __( 'Author bio word limit in Author box.', 'userswp' ),
586 'desc_tip' => true,
587 'type' => 'number',
588 'default' => '200',
589 'advanced' => true,
590 ),
591 array(
592 'name' => __('Author box Content', 'userswp'),
593 'desc' => __('The author box body, this can be text or HTML.', 'userswp'),
594 'id' => 'author_box_content',
595 'type' => 'textarea',
596 'class' => 'code uwp-authorbox-body',
597 'desc_tip' => true,
598 'placeholder' => UsersWP_Defaults::author_box_content(),
599 'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_authbox_tags(),
600 'advanced' => true,
601 ),
602 array(
603 'name' => __('Author box Content (bootstrap)', 'userswp'),
604 'desc' => __('The author box body, this can be text or HTML.', 'userswp'),
605 'id' => 'author_box_content_bootstrap',
606 'type' => 'textarea',
607 'class' => 'code uwp-authorbox-body',
608 'desc_tip' => true,
609 'placeholder' => UsersWP_Defaults::author_box_content_bootstrap(),
610 'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_authbox_tags(),
611 'advanced' => true,
612 ),
613
614 array( 'type' => 'sectionend', 'id' => 'authorbox_options' ),
615 ));
616 }else if ( 'developer' == $current_section ) {
617 /**
618 * Filter general settings array.
619 *
620 * @package userswp
621 */
622 $settings = apply_filters( 'uwp_developer_options', array(
623 array(
624 'title' => __( 'Developer Settings', 'userswp' ),
625 'type' => 'title',
626 'id' => 'developer_options',
627 ),
628
629 array(
630 'id' => 'disable_avatar_override',
631 'name' => __( 'Disable Avatar Override?', 'userswp' ),
632 'desc' => __( 'By default UsersWP will change the avatar to profile image. You can disable this using this option.', 'userswp' ),
633 'type' => 'checkbox',
634 ),
635
636 array(
637 'name' => __( 'Advanced settings', 'userswp' ),
638 'desc' => __( 'Disable advanced toggle, show advanced settings at all times (not recommended).', 'userswp' ),
639 'id' => 'admin_disable_advanced',
640 'type' => 'checkbox',
641 ),
642
643 array(
644 'id' => 'enable_uwp_error_log',
645 'name' => __( 'Debugging', 'userswp' ),
646 'desc' => __( 'Show debugging info in the error logs.', 'userswp' ),
647 'type' => 'checkbox',
648 ),
649
650 // @todo to be move to own design section
651 array(
652 'id' => 'design_style',
653 'name' => __('Default Design Style', 'userswp'),
654 'desc' => __('The default design style to use.', 'userswp'),
655 'type' => 'select',
656 'options' => array(
657 'bootstrap' => __('Bootstrap', 'userswp'),
658 '' => __('Legacy (non-bootstrap)', 'userswp'),
659 ),
660 'desc_tip' => true,
661 'default' => 'bootstrap',
662 ),
663
664 array( 'type' => 'sectionend', 'id' => 'developer_options' ),
665 ));
666 } else {
667 /**
668 * Filter pages settings array.
669 *
670 * @package userswp
671 */
672 $settings = apply_filters( 'uwp_page_options', array(
673 array(
674 'title' => __( 'Page Settings', 'userswp' ),
675 'type' => 'title',
676 'desc' => 'These are essential pages used by UWP, you can set the pages here and edit the title/slug of the page via WP page settings.',
677 'id' => 'page_options',
678 'desc_tip' => true,
679 ),
680 array(
681 'name' => __( 'User Profile Page', 'userswp' ),
682 'desc' => __( 'This is the front end user\'s profile page. This page automatically overrides the default WordPress author page.', 'userswp' ),
683 'id' => 'profile_page',
684 'type' => 'single_select_page',
685 'desc_tip' => true,
686 ),
687 array(
688 'name' => __( 'Register Page', 'userswp' ),
689 'desc' => __( 'This is the front end register page. This is where users create their account.', 'userswp' ),
690 'id' => 'register_page',
691 'type' => 'single_select_page',
692 'desc_tip' => true,
693 ),
694 array(
695 'name' => __( 'Login Page', 'userswp' ),
696 'desc' => __( 'This is the front end login page. This is where users will login after creating their account.', 'userswp' ),
697 'id' => 'login_page',
698 'type' => 'single_select_page',
699 'desc_tip' => true,
700 ),
701 array(
702 'name' => __( 'Account Page', 'userswp' ),
703 'desc' => __( 'This is the front end account page. This is where users can edit their account.', 'userswp' ),
704 'id' => 'account_page',
705 'type' => 'single_select_page',
706 'desc_tip' => true,
707 ),
708 array(
709 'name' => __( 'Change Password Page', 'userswp' ),
710 'desc' => __( 'This is the front end Change Password page.', 'userswp' ),
711 'id' => 'change_page',
712 'type' => 'single_select_page',
713 'desc_tip' => true,
714 ),
715 array(
716 'name' => __( 'Forgot Password Page', 'userswp' ),
717 'desc' => __( 'This is the front end Forgot Password page. This is the page where users are sent to reset their password when they lose it.', 'userswp' ),
718 'id' => 'forgot_page',
719 'type' => 'single_select_page',
720 'desc_tip' => true,
721 ),
722 array(
723 'name' => __( 'Reset Password Page', 'userswp' ),
724 'desc' => __( 'This is the front end Reset Password page. This is the page where users can reset their password when they lose it.', 'userswp' ),
725 'id' => 'reset_page',
726 'type' => 'single_select_page',
727 'desc_tip' => true,
728 ),
729 array(
730 'name' => __( 'Users List Page', 'userswp' ),
731 'desc' => __( 'This is the front end Users List page. This is the page where all registered users of the websites are listed.', 'userswp' ),
732 'id' => 'users_page',
733 'type' => 'single_select_page',
734 'desc_tip' => true,
735 ),
736 array(
737 'name' => __( 'Users List Item Page', 'userswp' ),
738 'desc' => __( 'This is the page/template for displaying user item in users list page. You can change the template as you want which will apply to each user item in users list page.', 'userswp' ),
739 'id' => 'user_list_item_page',
740 'type' => 'single_select_page',
741 'desc_tip' => true,
742 ),
743 array( 'type' => 'sectionend', 'id' => 'page_options' ),
744 ));
745 }
746
747
748 return apply_filters( 'uwp_get_settings_' . $this->id, $settings );
749 }
750
751 /**
752 * Output a color picker input box.
753 *
754 * @param mixed $name
755 * @param string $id
756 * @param mixed $value
757 * @param string $desc (default: '')
758 */
759 public function color_picker( $name, $id, $value, $desc = '' ) {
760 echo '<div class="color_box">' . uwp_help_tip( $desc ) . '<input name="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '" type="text" value="' . esc_attr( $value ) . '" class="colorpick" /> <div id="colorPickerDiv_' . esc_attr( $id ) . '" class="colorpickdiv"></div></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
761 }
762
763 public function uwp_available_users_layout() {
764 $tabs_arr = array(
765 'list' => __( 'Grid View - 1 Column (List View)', 'userswp' ),
766 '2col' => __( 'Grid View - 2 Column', 'userswp' ),
767 '3col' => __( 'Grid View - 3 Column', 'userswp' ),
768 '4col' => __( 'Grid View - 4 Column', 'userswp' ),
769 '5col' => __( 'Grid View - 5 Column', 'userswp' ),
770 );
771
772 $tabs_arr = apply_filters('uwp_available_users_layout', $tabs_arr);
773
774 return $tabs_arr;
775 }
776
777 /**
778 * Get users lists.
779 *
780 * @return array $users
781 */
782 public function get_users() {
783 $get_users = get_users();
784
785 $users = array();
786 if(!empty($get_users) ) {
787 foreach ($get_users as $key => $user) {
788 $users[$user->ID] = esc_attr( $user->display_name );
789 }
790 }
791
792 return $users;
793 }
794 }
795
796 endif;
797
798 return new UsersWP_Settings_General();