PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.2.0.9
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.2.0.9
1.2.73 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 All 173 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.0.9, at admin/settings/class-uwp-settings-general.php

641 lines 26.5 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 '' => __( 'General', 'userswp' ),
70 'pages' => __( 'Pages', 'userswp' ),
71 'register' => __( 'Register', 'userswp' ),
72 'login' => __( 'Login', 'userswp' ),
73 'change-password' => __( 'Change Password', 'userswp' ),
74 'profile' => __( 'Profile', 'userswp' ),
75 'users' => __( 'Users', '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 ( 'pages' == $current_section ) {
91 /**
92 * Filter pages settings array.
93 *
94 * @package userswp
95 */
96 $settings = apply_filters( 'uwp_page_options', array(
97 array(
98 'title' => __( 'Page Settings', 'userswp' ),
99 'type' => 'title',
100 '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.',
101 'id' => 'page_options',
102 'desc_tip' => true,
103 ),
104 array(
105 'name' => __( 'User Profile Page', 'userswp' ),
106 'desc' => __( 'This is the front end user\'s profile page. This page automatically overrides the default WordPress author page.', 'userswp' ),
107 'id' => 'profile_page',
108 'type' => 'single_select_page',
109 'class' => 'uwp-select',
110 'desc_tip' => true,
111 ),
112 array(
113 'name' => __( 'Register Page', 'userswp' ),
114 'desc' => __( 'This is the front end register page. This is where users create their account.', 'userswp' ),
115 'id' => 'register_page',
116 'type' => 'single_select_page',
117 'class' => 'uwp-select',
118 'desc_tip' => true,
119 ),
120 array(
121 'name' => __( 'Login Page', 'userswp' ),
122 'desc' => __( 'This is the front end login page. This is where users will login after creating their account.', 'userswp' ),
123 'id' => 'login_page',
124 'type' => 'single_select_page',
125 'class' => 'uwp-select',
126 'desc_tip' => true,
127 ),
128 array(
129 'name' => __( 'Account Page', 'userswp' ),
130 'desc' => __( 'This is the front end account page. This is where users can edit their account.', 'userswp' ),
131 'id' => 'account_page',
132 'type' => 'single_select_page',
133 'class' => 'uwp-select',
134 'desc_tip' => true,
135 ),
136 array(
137 'name' => __( 'Change Password Page', 'userswp' ),
138 'desc' => __( 'This is the front end Change Password page.', 'userswp' ),
139 'id' => 'change_page',
140 'type' => 'single_select_page',
141 'class' => 'uwp-select',
142 'desc_tip' => true,
143 ),
144 array(
145 'name' => __( 'Forgot Password Page', 'userswp' ),
146 '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' ),
147 'id' => 'forgot_page',
148 'type' => 'single_select_page',
149 'class' => 'uwp-select',
150 'desc_tip' => true,
151 ),
152 array(
153 'name' => __( 'Reset Password Page', 'userswp' ),
154 'desc' => __( 'This is the front end Reset Password page. This is the page where users can reset their password when they lose it.', 'userswp' ),
155 'id' => 'reset_page',
156 'type' => 'single_select_page',
157 'class' => 'uwp-select',
158 'desc_tip' => true,
159 ),
160 array(
161 'name' => __( 'Users List Page', 'userswp' ),
162 'desc' => __( 'This is the front end Users List page. This is the page where all registered users of the websites are listed.', 'userswp' ),
163 'id' => 'users_page',
164 'type' => 'single_select_page',
165 'class' => 'uwp-select',
166 'desc_tip' => true,
167 ),
168 array(
169 'name' => __( 'Users List Item Page', 'userswp' ),
170 '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' ),
171 'id' => 'user_list_item_page',
172 'type' => 'single_select_page',
173 'class' => 'uwp-select',
174 'desc_tip' => true,
175 ),
176 array( 'type' => 'sectionend', 'id' => 'page_options' ),
177 ));
178 } else if ( 'register' == $current_section ) {
179 /**
180 * Filter registration settings array.
181 *
182 * @package userswp
183 */
184 $settings = apply_filters( 'uwp_register_options', array(
185 array(
186 'title' => __( 'Register Settings', 'userswp' ),
187 'type' => 'title',
188 'id' => 'register_options',
189 ),
190 array(
191 'id' => 'register_modal',
192 'name' => __( 'Register lightbox', 'userswp' ),
193 'desc' => __( 'When enabled some register links will open in a lightbox instead of changing page.','userswp'),
194 'type' => 'checkbox',
195 'default' => '1',
196 'class' => 'uwp_label_inline',
197 ),
198 array(
199 'id' => 'uwp_registration_action',
200 'name' => __('Registration Action', 'userswp'),
201 'desc' => __('Select how registration should be handled.', 'userswp'),
202 'type' => 'select',
203 'options' => uwp_registration_status_options(),
204 'class' => 'uwp-select',
205 'desc_tip' => true,
206 ),
207 array(
208 'id' => 'register_redirect_to',
209 'name' => __( 'Register Redirect Page', 'userswp' ),
210 'desc' => __( 'Set the page to redirect the user to after signing up. If no page has been set WordPress default will be used.', 'userswp' ),
211 'type' => 'single_select_page',
212 'class' => 'uwp-select',
213 'desc_tip' => true,
214 ),
215 array(
216 'id' => 'register_terms_page',
217 'name' => __( 'Register TOS Page', 'userswp' ),
218 'desc' => __( 'Terms of Service page. When set "Accept terms and Conditions" checkbox will appear on the register form.', 'userswp' ),
219 'type' => 'single_select_page',
220 'class' => 'uwp-select',
221 'desc_tip' => true,
222 ),
223 array(
224 'id' => 'wp_register_redirect',
225 'name' => __( 'Redirect admin default register page', 'userswp' ),
226 'desc' => __( 'When enabled /wp-login.php?action=register page will be redirected to UsersWP register page.', 'userswp' ),
227 'type' => 'checkbox',
228 'default' => '1',
229 ),
230 array(
231 'id' => 'register_admin_notify',
232 'name' => __( 'Enable admin email notification?', 'userswp' ),
233 'desc' => __( 'When enabled an email will be sent to the admin for every user registration.', 'userswp' ),
234 'type' => 'checkbox',
235 'default' => '0',
236 ),
237
238 array( 'type' => 'sectionend', 'id' => 'register_options' ),
239 ));
240 } else if ( 'login' == $current_section ) {
241 /**
242 * Filter login settings array.
243 *
244 * @package userswp
245 */
246 $pages = get_pages();
247 $pages_options = array( '-1' => __( 'Last User Page', 'userswp' ) );
248 if ( $pages ) {
249 foreach ( $pages as $page ) {
250 $pages_options[ $page->ID ] = $page->post_title;
251 }
252 }
253
254 $settings = apply_filters( 'uwp_login_options', array(
255 array(
256 'title' => __( 'Login Settings', 'userswp' ),
257 'type' => 'title',
258 'id' => 'login_options',
259 ),
260 array(
261 'id' => 'login_modal',
262 'name' => __( 'Login lightbox', 'userswp' ),
263 'desc' => __( 'When enabled some login links will open in a lightbox instead of changing page.','userswp'),
264 'type' => 'checkbox',
265 'default' => '1',
266 'class' => 'uwp_label_inline',
267 ),
268 array(
269 'id' => 'login_redirect_to',
270 'name' => __( 'Login Redirect Page', 'userswp' ),
271 'desc' => __( 'Set the page to redirect the user to after logging in. If no page has been set WordPress default will be used.', 'userswp' ),
272 'type' => 'select',
273 'options' => $pages_options,
274 'class' => 'uwp-select',
275 'default' => '-1',
276 'desc_tip' => true,
277 ),
278 array(
279 'id' => 'block_wp_login',
280 'name' => __( 'Redirect wp-login.php?', 'userswp' ),
281 'desc' => __('When enabled /wp-login.php page will be redirected to UsersWP login page.','userswp' ),
282 'type' => 'checkbox',
283 'default' => '0',
284 'class' => 'uwp_label_inline',
285 ),
286 array(
287 'id' => 'logout_redirect_to',
288 'name' => __( 'Logout Redirect Page', 'userswp' ),
289 'desc' => __( 'Set the page to redirect the user to after logging out. If no page has been set WordPress default will be used.', 'userswp' ),
290 'type' => 'single_select_page',
291 'class' => 'uwp-select',
292 'desc_tip' => true,
293 ),
294 array( 'type' => 'sectionend', 'id' => 'login_options' ),
295 ));
296 } else if ( 'change-password' == $current_section ) {
297 /**
298 * Filter change password settings array.
299 *
300 * @package userswp
301 */
302 $settings = apply_filters( 'uwp_change_password_options', array(
303 array(
304 'title' => __( 'Change Password Settings', 'userswp' ),
305 'type' => 'title',
306 'id' => 'change_password_options',
307 ),
308 array(
309 'id' => 'forgot_modal',
310 'name' => __( 'Forgot password lightbox', 'userswp' ),
311 'desc' => __( 'When enabled some forgot password links will open in a lightbox instead of changing page.','userswp'),
312 'type' => 'checkbox',
313 'default' => '1',
314 'class' => 'uwp_label_inline',
315 ),
316 array(
317 'id' => 'change_enable_old_password',
318 'name' => __( 'Enabled Old Password?', 'userswp' ),
319 'desc' => __( 'Ask user to enter their old password before changing the password to add an extra layer of security.', 'userswp' ),
320 'type' => 'checkbox',
321 'default' => '1',
322 ),
323 array(
324 'id' => 'change_disable_password_nag',
325 'name' => __( 'Disable system generated password notice.', 'userswp' ),
326 'desc' => __( 'This option will disable system generated password notice if user has not changed default password after registration.', 'userswp' ),
327 'type' => 'checkbox',
328 'default' => '0',
329 ),
330
331 array( 'type' => 'sectionend', 'id' => 'change_password_options' ),
332 ));
333 } else if ( 'profile' == $current_section ) {
334 /**
335 * Filter profile settings array.
336 *
337 * @package userswp
338 */
339 $file_obj = new UsersWP_Files();
340
341 $settings = apply_filters( 'uwp_profile_options', array(
342 array(
343 'title' => __( 'Profile Settings', 'userswp' ),
344 'type' => 'title',
345 'id' => 'profile_options',
346 ),
347 // array(
348 // 'id' => 'enable_profile_tabs',
349 // 'name' => __( 'Choose the tabs to display in Profile', 'userswp' ),
350 // 'desc' => __( 'Choose the tabs to display in UsersWP Profile', 'userswp' ),
351 // 'type' => 'multiselect',
352 // 'sortable' => true,
353 // 'class' => 'uwp-select',
354 // 'options' => $this->uwp_available_tab_items(),
355 // 'desc_tip' => true,
356 // ),
357 array(
358 'id' => 'profile_default_banner',
359 'name' => __( 'Default banner image', 'userswp' ),
360 'desc' => __( 'Recommended image size: 1000x300', 'userswp'),
361 'type' => 'image',
362 'default' => '',
363 'desc_tip' => true,
364 ),
365 array(
366 'id' => 'profile_default_profile',
367 'name' => __( 'Default profile image', 'userswp' ),
368 'desc' => __( 'Recommended image size: 150x150', 'userwp'),
369 'type' => 'image',
370 'default' => '',
371 'desc_tip' => true,
372 ),
373 array(
374 'id' => 'enable_profile_header',
375 'name' => __( 'Display Header in Profile', 'userswp' ),
376 'type' => 'checkbox',
377 'default' => '1',
378 'advanced' => true,
379 ),
380 array(
381 'id' => 'enable_profile_body',
382 'name' => __( 'Display Body in Profile', 'userswp' ),
383 'type' => 'checkbox',
384 'default' => '1',
385 'advanced' => true,
386 ),
387 array(
388 'id' => 'profile_avatar_size',
389 'name' => __( 'Profile Avatar max file size', 'userswp' ),
390 '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>'),
391 'type' => 'number',
392 'default' => '',
393 'desc_tip' => true,
394 'advanced' => true,
395 ),
396 array(
397 'id' => 'profile_banner_size',
398 'name' => __( 'Profile Banner max file size', 'userswp' ),
399 '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>'),
400 'type' => 'number',
401 'default' => '',
402 'desc_tip' => true,
403 'advanced' => true,
404 ),
405 array(
406 'id' => 'profile_banner_width',
407 'name' => __( 'Profile banner width', 'userswp' ),
408 'type' => 'number',
409 'default' => '1000',
410 'advanced' => true,
411 ),
412 array(
413 'id' => 'profile_no_of_items',
414 'name' => __( 'Number of Items', 'userswp' ),
415 'type' => 'text',
416 'default' => '',
417 'desc' => __( 'Enter number of items to display in profile tabs.', 'userswp' ),
418 'desc_tip' => true,
419 'advanced' => true,
420 ),
421 array(
422 'id' => 'uwp_disable_author_link',
423 'name' => __( 'Disable author link redirect to UsersWP profile page.', 'userswp' ),
424 'type' => 'checkbox',
425 'default' => '0',
426 'advanced' => true,
427 ),
428 array( 'type' => 'sectionend', 'id' => 'profile_options' ),
429 ));
430 } else if ( 'users' == $current_section ) {
431 /**
432 * Filter general settings array.
433 *
434 * @package userswp
435 */
436 $settings = apply_filters( 'uwp_users_options', array(
437 array(
438 'title' => __( 'Users Settings', 'userswp' ),
439 'type' => 'title',
440 'id' => 'users_options',
441 ),
442
443 array(
444 'id' => 'users_default_layout',
445 'name' => __( 'Users default layout', 'userswp' ),
446 'desc' => __( 'Choose the default layout for Users Page - Users List', 'userswp' ),
447 'type' => 'select',
448 'options' => $this->uwp_available_users_layout(),
449 'class' => 'uwp-select',
450 'desc_tip' => true,
451 ),
452 array(
453 'id' => 'users_excluded_from_list',
454 'name' => __( 'Users to exclude', 'userswp' ),
455 'type' => 'text',
456 'desc' => __( 'Enter comma separated ids of users to exclude from users listing.', 'userswp' ),
457 'desc_tip' => true,
458 ),
459
460 array( 'type' => 'sectionend', 'id' => 'users_options' ),
461 ));
462 }else if ( 'authorbox' == $current_section ) {
463 /**
464 * Filter general settings array.
465 *
466 * @package userswp
467 */
468 $settings = apply_filters( 'uwp_authorbox_options', array(
469 array(
470 'title' => __( 'Author Box Settings', 'userswp' ),
471 'type' => 'title',
472 'id' => 'authorbox_options',
473 ),
474 array(
475 'id' => 'author_box_enable_disable',
476 'name' => __( 'Enable Author Box', 'userswp' ),
477 'desc' => __( 'Displays author box based on settings', 'userswp' ),
478 'type' => 'checkbox',
479 'default' => '1',
480 ),
481 array(
482 'id' => 'author_box_display_content',
483 'name' => __('Where to display?', 'userswp'),
484 'desc' => __('Displays the author box above or below post content.', 'userswp'),
485 'type' => 'select',
486 'options' => array(
487 'above_content' => __('Above content', 'userswp'),
488 'below_content' => __('Below content', 'userswp'),
489 ),
490 'class' => 'uwp-select',
491 'desc_tip' => true,
492 'default' => 'below_content',
493 ),
494 array(
495 'id' => 'author_box_display_post_types',
496 'name' => __( 'Post types', 'userswp' ),
497 'desc' => __( 'Choose post types to display author box', 'userswp' ),
498 'type' => 'multiselect',
499 'sortable' => true,
500 'class' => 'uwp-select',
501 'options' => uwp_get_posttypes(),
502 'desc_tip' => true,
503 'default' => 'post',
504 ),
505 array(
506 'name' => __('Author box Content', 'userswp'),
507 'desc' => __('The author box body, this can be text or HTML.', 'userswp'),
508 'id' => 'author_box_content',
509 'type' => 'textarea',
510 'class' => 'code uwp-authorbox-body',
511 'desc_tip' => true,
512 'placeholder' => UsersWP_Defaults::author_box_content(),
513 'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_authbox_tags()
514 ),
515 array(
516 'name' => __('Author box Content (bootstrap)', 'userswp'),
517 'desc' => __('The author box body, this can be text or HTML.', 'userswp'),
518 'id' => 'author_box_content_bootstrap',
519 'type' => 'textarea',
520 'class' => 'code uwp-authorbox-body',
521 'desc_tip' => true,
522 'placeholder' => UsersWP_Defaults::author_box_content_bootstrap(),
523 'custom_desc' => __('Available template tags:', 'userswp') . ' ' . uwp_authbox_tags()
524 ),
525
526 array( 'type' => 'sectionend', 'id' => 'authorbox_options' ),
527 ));
528 }else if ( 'developer' == $current_section ) {
529 /**
530 * Filter general settings array.
531 *
532 * @package userswp
533 */
534 $settings = apply_filters( 'uwp_developer_options', array(
535 array(
536 'title' => __( 'Developer Settings', 'userswp' ),
537 'type' => 'title',
538 'id' => 'developer_options',
539 ),
540
541 array(
542 'id' => 'disable_avatar_override',
543 'name' => __( 'Disable Avatar Override?', 'userswp' ),
544 'desc' => __( 'By default UsersWP will change the avatar to profile image. You can disable this using this option.', 'userswp' ),
545 'type' => 'checkbox',
546 ),
547
548
549 // @todo to be move to own design section
550 array(
551 'id' => 'design_style',
552 'name' => __('Default Design Style', 'userswp'),
553 'desc' => __('The default design style to use.', 'userswp'),
554 'type' => 'select',
555 'options' => array(
556 'bootstrap' => __('Bootstrap', 'userswp'),
557 '' => __('Legacy (non-bootstrap)', 'userswp'),
558 ),
559 'class' => 'uwp-select',
560 'desc_tip' => true,
561 'default' => 'bootstrap',
562 ),
563
564
565 array( 'type' => 'sectionend', 'id' => 'developer_options' ),
566 ));
567 } else {
568 /**
569 * Filter general settings array.
570 *
571 * @package userswp
572 */
573 $settings = apply_filters( 'uwp_settings_general_main', array(
574 array(
575 'title' => __( 'Welcome to UsersWP', 'userswp' ),
576 'type' => 'title',
577 'desc' => '',
578 'id' => 'general_options'
579 ),
580
581 array( 'type' => 'sectionend', 'id' => 'general_options' ),
582
583 array(
584 'type' => 'general_shortcodes',
585 ),
586
587 array( 'type' => 'sectionend', 'id' => 'general_options_add' ),
588
589 ) );
590 }
591
592
593 return apply_filters( 'uwp_get_settings_' . $this->id, $settings );
594 }
595
596 /**
597 * Output a color picker input box.
598 *
599 * @param mixed $name
600 * @param string $id
601 * @param mixed $value
602 * @param string $desc (default: '')
603 */
604 public function color_picker( $name, $id, $value, $desc = '' ) {
605 echo '<div class="color_box">' . uwp_help_tip( $desc ) . '
606 <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>
607 </div>';
608 }
609
610 public function uwp_available_tab_items() {
611 $tabs_arr = array(
612 'more_info' => __( 'More Info', 'userswp' ),
613 'posts' => __( 'Posts', 'userswp' ),
614 'comments' => __( 'Comments', 'userswp' ),
615 );
616
617 $tabs_arr = apply_filters('uwp_available_tab_items', $tabs_arr);
618
619 return $tabs_arr;
620 }
621
622 public function uwp_available_users_layout() {
623 $tabs_arr = array(
624 'list' => __( 'List View', 'userswp' ),
625 '2col' => __( 'Grid View - 2 Column', 'userswp' ),
626 '3col' => __( 'Grid View - 3 Column', 'userswp' ),
627 '4col' => __( 'Grid View - 4 Column', 'userswp' ),
628 '5col' => __( 'Grid View - 5 Column', 'userswp' ),
629 );
630
631 $tabs_arr = apply_filters('uwp_available_users_layout', $tabs_arr);
632
633 return $tabs_arr;
634 }
635
636 }
637
638 endif;
639
640 return new UsersWP_Settings_General();
641