Version Description
Download this release
Release Info
Developer | nsinelnikov |
Plugin | ![]() |
Version | 2.2.5 |
Comparing to | |
See all releases |
Code changes from version 2.2.4 to 2.2.5
- assets/js/um-members.js +1790 -1785
- assets/js/um-members.min.js +1 -1
- includes/admin/assets/js/um-admin-forms.js +7 -3
- includes/admin/class-admin.php +12 -2
- includes/admin/core/class-admin-metabox.php +2 -2
- includes/admin/core/class-admin-settings.php +3475 -3455
- includes/admin/core/list-tables/roles-list-table.php +17 -12
- includes/admin/templates/access/restrict_content.php +1 -1
- includes/admin/templates/role/role-edit.php +10 -4
- includes/class-config.php +809 -807
- includes/class-functions.php +410 -395
- includes/core/class-access.php +33 -4
- includes/core/class-builtin.php +1917 -1917
- includes/core/class-fields.php +2 -2
- includes/core/class-member-directory.php +2644 -2640
- includes/core/class-password.php +721 -716
- includes/core/class-user-posts.php +14 -12
- includes/core/class-user.php +2185 -2177
- includes/core/um-actions-account.php +0 -147
assets/js/um-members.js
CHANGED
@@ -1,1785 +1,1790 @@
|
|
1 |
-
var um_members_directory_busy = [];
|
2 |
-
|
3 |
-
var um_member_directories = [];
|
4 |
-
|
5 |
-
var um_member_directory_last_data = [];
|
6 |
-
|
7 |
-
function um_parse_current_url() {
|
8 |
-
var data = {};
|
9 |
-
|
10 |
-
var query = window.location.search.substring(1);
|
11 |
-
var attrs = query.split( '&' );
|
12 |
-
jQuery.each( attrs, function( i ) {
|
13 |
-
var attr = attrs[ i ].split( '=' );
|
14 |
-
data[ attr[0] ] = attr[1];
|
15 |
-
});
|
16 |
-
return data;
|
17 |
-
}
|
18 |
-
|
19 |
-
|
20 |
-
function um_get_data_for_directory( directory, search_key ) {
|
21 |
-
var hash = um_members_get_hash( directory );
|
22 |
-
var data = {};
|
23 |
-
|
24 |
-
var url_data = um_parse_current_url();
|
25 |
-
jQuery.each( url_data, function( key ) {
|
26 |
-
if ( key.indexOf( '_' + hash ) !== -1 && url_data[ key ] !== '' ) {
|
27 |
-
data[ key.replace( '_' + hash, '' ) ] = url_data[ key ];
|
28 |
-
}
|
29 |
-
});
|
30 |
-
|
31 |
-
if ( ! search_key ) {
|
32 |
-
return data;
|
33 |
-
} else {
|
34 |
-
if ( typeof data[ search_key ] !== 'undefined' ) {
|
35 |
-
try {
|
36 |
-
//data[ search_key ] = decodeURI( data[ search_key ] );
|
37 |
-
data[ search_key ] = decodeURIComponent( data[ search_key ] );
|
38 |
-
} catch(e) { // catches a malformed URI
|
39 |
-
console.error(e);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return data[ search_key ];
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
|
48 |
-
function um_set_url_from_data( directory, key, value ) {
|
49 |
-
var hash = um_members_get_hash( directory );
|
50 |
-
var data = um_get_data_for_directory( directory );
|
51 |
-
|
52 |
-
var other_directories = um_member_directories;
|
53 |
-
|
54 |
-
var new_data = {};
|
55 |
-
|
56 |
-
if ( Array.isArray( value ) ) {
|
57 |
-
jQuery.each( value, function( i ) {
|
58 |
-
value[ i ] = encodeURIComponent( value[ i ] );
|
59 |
-
});
|
60 |
-
value = value.join( '||' );
|
61 |
-
} else if ( ! jQuery.isNumeric( value ) ) {
|
62 |
-
value = value.split( '||' );
|
63 |
-
jQuery.each( value, function( i ) {
|
64 |
-
value[ i ] = encodeURIComponent( value[ i ] );
|
65 |
-
});
|
66 |
-
value = value.join( '||' );
|
67 |
-
}
|
68 |
-
|
69 |
-
if ( value !== '' ) {
|
70 |
-
new_data[ key + '_' + hash ] = value;
|
71 |
-
}
|
72 |
-
jQuery.each( data, function( data_key ) {
|
73 |
-
if ( key === data_key ) {
|
74 |
-
if ( value !== '' ) {
|
75 |
-
new_data[ data_key + '_' + hash ] = value;
|
76 |
-
}
|
77 |
-
} else {
|
78 |
-
new_data[ data_key + '_' + hash ] = data[ data_key ];
|
79 |
-
}
|
80 |
-
});
|
81 |
-
|
82 |
-
// added data of other directories to the url
|
83 |
-
jQuery.each( um_member_directories, function( k ) {
|
84 |
-
var dir_hash = um_member_directories[ k ];
|
85 |
-
if ( dir_hash !== hash ) {
|
86 |
-
var other_directory = jQuery( '.um-directory[data-hash="' + dir_hash + '"]' );
|
87 |
-
var dir_data = um_get_data_for_directory( other_directory );
|
88 |
-
|
89 |
-
jQuery.each( dir_data, function( data_key ) {
|
90 |
-
new_data[ data_key + '_' + dir_hash ] = dir_data[ data_key ];
|
91 |
-
});
|
92 |
-
}
|
93 |
-
});
|
94 |
-
|
95 |
-
var query_strings = [];
|
96 |
-
jQuery.each( new_data, function( data_key ) {
|
97 |
-
query_strings.push( data_key + '=' + new_data[ data_key ] );
|
98 |
-
});
|
99 |
-
|
100 |
-
query_strings = wp.hooks.applyFilters( 'um_member_directory_url_attrs', query_strings );
|
101 |
-
|
102 |
-
var query_string = '?' + query_strings.join( '&' );
|
103 |
-
if ( query_string === '?' ) {
|
104 |
-
query_string = '';
|
105 |
-
}
|
106 |
-
|
107 |
-
window.history.pushState("string", "UM Member Directory", window.location.origin + window.location.pathname + query_string );
|
108 |
-
}
|
109 |
-
|
110 |
-
|
111 |
-
function um_members_get_hash( directory ) {
|
112 |
-
return directory.data( 'hash' );
|
113 |
-
}
|
114 |
-
|
115 |
-
function um_is_directory_busy( directory ) {
|
116 |
-
var hash = um_members_get_hash( directory );
|
117 |
-
return typeof um_members_directory_busy[ hash ] != 'undefined' && um_members_directory_busy[ hash ];
|
118 |
-
}
|
119 |
-
|
120 |
-
|
121 |
-
function um_members_show_preloader( directory ) {
|
122 |
-
um_members_directory_busy[ um_members_get_hash( directory ) ] = true;
|
123 |
-
directory.find('.um-members-overlay').show();
|
124 |
-
}
|
125 |
-
|
126 |
-
|
127 |
-
function um_members_hide_preloader( directory ) {
|
128 |
-
um_members_directory_busy[ um_members_get_hash( directory ) ] = false;
|
129 |
-
directory.find('.um-members-overlay').hide();
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
function um_set_range_label( slider, ui ) {
|
134 |
-
var placeholder = '';
|
135 |
-
var placeholder_s = slider.siblings( '.um-slider-range' ).data( 'placeholder-s' );
|
136 |
-
var placeholder_p = slider.siblings( '.um-slider-range' ).data( 'placeholder-p' );
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
.replace( '\{
|
142 |
-
.
|
143 |
-
|
144 |
-
|
145 |
-
.replace( '\{
|
146 |
-
.replace( '\{
|
147 |
-
.
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
.
|
157 |
-
|
158 |
-
.
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
}
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
}
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
*
|
217 |
-
*
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
var
|
234 |
-
|
235 |
-
var
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
directory.
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
var
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
var
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
var
|
277 |
-
if (
|
278 |
-
|
279 |
-
}
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
um_members_hide_preloader( directory );
|
357 |
-
}
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
var
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
var
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
var
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
var
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
var
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
}
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
if ( filter_value_from === filter_value_to ) {
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
}
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
}
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
var
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
/**
|
725 |
-
*
|
726 |
-
*/
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
directory.
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
if (
|
800 |
-
return;
|
801 |
-
}
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
}
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
/**
|
875 |
-
*
|
876 |
-
*/
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
search_bar.
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
current_value = current_value.
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
}
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
current_value =
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
select
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
jQuery( '.um-search-filter #' + filter_name + '_min' ).
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
um_set_url_from_data( directory, 'filter_' + filter_name + '
|
1177 |
-
|
1178 |
-
|
1179 |
-
jQuery( '.um-search-filter #' + filter_name + '
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
jQuery( '.um-search-filter #' + filter_name + '_min' ).
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
um_set_url_from_data( directory, 'filter_' + filter_name + '
|
1302 |
-
|
1303 |
-
|
1304 |
-
jQuery( '.um-search-filter #' + filter_name + '
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
//
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
var
|
1383 |
-
var
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
um_set_url_from_data( directory, '
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
var
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
um_set_url_from_data( directory, '
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
var
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
var
|
1524 |
-
var
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
var
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
um_set_url_from_data( directory, '
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
var
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
directory
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
}
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
directory.
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
min_default_value =
|
1731 |
-
|
1732 |
-
if ( typeof
|
1733 |
-
|
1734 |
-
}
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
var um_members_directory_busy = [];
|
2 |
+
|
3 |
+
var um_member_directories = [];
|
4 |
+
|
5 |
+
var um_member_directory_last_data = [];
|
6 |
+
|
7 |
+
function um_parse_current_url() {
|
8 |
+
var data = {};
|
9 |
+
|
10 |
+
var query = window.location.search.substring(1);
|
11 |
+
var attrs = query.split( '&' );
|
12 |
+
jQuery.each( attrs, function( i ) {
|
13 |
+
var attr = attrs[ i ].split( '=' );
|
14 |
+
data[ attr[0] ] = attr[1];
|
15 |
+
});
|
16 |
+
return data;
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
function um_get_data_for_directory( directory, search_key ) {
|
21 |
+
var hash = um_members_get_hash( directory );
|
22 |
+
var data = {};
|
23 |
+
|
24 |
+
var url_data = um_parse_current_url();
|
25 |
+
jQuery.each( url_data, function( key ) {
|
26 |
+
if ( key.indexOf( '_' + hash ) !== -1 && url_data[ key ] !== '' ) {
|
27 |
+
data[ key.replace( '_' + hash, '' ) ] = url_data[ key ];
|
28 |
+
}
|
29 |
+
});
|
30 |
+
|
31 |
+
if ( ! search_key ) {
|
32 |
+
return data;
|
33 |
+
} else {
|
34 |
+
if ( typeof data[ search_key ] !== 'undefined' ) {
|
35 |
+
try {
|
36 |
+
//data[ search_key ] = decodeURI( data[ search_key ] );
|
37 |
+
data[ search_key ] = decodeURIComponent( data[ search_key ] );
|
38 |
+
} catch(e) { // catches a malformed URI
|
39 |
+
console.error(e);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return data[ search_key ];
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
function um_set_url_from_data( directory, key, value ) {
|
49 |
+
var hash = um_members_get_hash( directory );
|
50 |
+
var data = um_get_data_for_directory( directory );
|
51 |
+
|
52 |
+
var other_directories = um_member_directories;
|
53 |
+
|
54 |
+
var new_data = {};
|
55 |
+
|
56 |
+
if ( Array.isArray( value ) ) {
|
57 |
+
jQuery.each( value, function( i ) {
|
58 |
+
value[ i ] = encodeURIComponent( value[ i ] );
|
59 |
+
});
|
60 |
+
value = value.join( '||' );
|
61 |
+
} else if ( ! jQuery.isNumeric( value ) ) {
|
62 |
+
value = value.split( '||' );
|
63 |
+
jQuery.each( value, function( i ) {
|
64 |
+
value[ i ] = encodeURIComponent( value[ i ] );
|
65 |
+
});
|
66 |
+
value = value.join( '||' );
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( value !== '' ) {
|
70 |
+
new_data[ key + '_' + hash ] = value;
|
71 |
+
}
|
72 |
+
jQuery.each( data, function( data_key ) {
|
73 |
+
if ( key === data_key ) {
|
74 |
+
if ( value !== '' ) {
|
75 |
+
new_data[ data_key + '_' + hash ] = value;
|
76 |
+
}
|
77 |
+
} else {
|
78 |
+
new_data[ data_key + '_' + hash ] = data[ data_key ];
|
79 |
+
}
|
80 |
+
});
|
81 |
+
|
82 |
+
// added data of other directories to the url
|
83 |
+
jQuery.each( um_member_directories, function( k ) {
|
84 |
+
var dir_hash = um_member_directories[ k ];
|
85 |
+
if ( dir_hash !== hash ) {
|
86 |
+
var other_directory = jQuery( '.um-directory[data-hash="' + dir_hash + '"]' );
|
87 |
+
var dir_data = um_get_data_for_directory( other_directory );
|
88 |
+
|
89 |
+
jQuery.each( dir_data, function( data_key ) {
|
90 |
+
new_data[ data_key + '_' + dir_hash ] = dir_data[ data_key ];
|
91 |
+
});
|
92 |
+
}
|
93 |
+
});
|
94 |
+
|
95 |
+
var query_strings = [];
|
96 |
+
jQuery.each( new_data, function( data_key ) {
|
97 |
+
query_strings.push( data_key + '=' + new_data[ data_key ] );
|
98 |
+
});
|
99 |
+
|
100 |
+
query_strings = wp.hooks.applyFilters( 'um_member_directory_url_attrs', query_strings );
|
101 |
+
|
102 |
+
var query_string = '?' + query_strings.join( '&' );
|
103 |
+
if ( query_string === '?' ) {
|
104 |
+
query_string = '';
|
105 |
+
}
|
106 |
+
|
107 |
+
window.history.pushState("string", "UM Member Directory", window.location.origin + window.location.pathname + query_string );
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
function um_members_get_hash( directory ) {
|
112 |
+
return directory.data( 'hash' );
|
113 |
+
}
|
114 |
+
|
115 |
+
function um_is_directory_busy( directory ) {
|
116 |
+
var hash = um_members_get_hash( directory );
|
117 |
+
return typeof um_members_directory_busy[ hash ] != 'undefined' && um_members_directory_busy[ hash ];
|
118 |
+
}
|
119 |
+
|
120 |
+
|
121 |
+
function um_members_show_preloader( directory ) {
|
122 |
+
um_members_directory_busy[ um_members_get_hash( directory ) ] = true;
|
123 |
+
directory.find('.um-members-overlay').show();
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
function um_members_hide_preloader( directory ) {
|
128 |
+
um_members_directory_busy[ um_members_get_hash( directory ) ] = false;
|
129 |
+
directory.find('.um-members-overlay').hide();
|
130 |
+
}
|
131 |
+
|
132 |
+
|
133 |
+
function um_set_range_label( slider, ui ) {
|
134 |
+
var placeholder = '';
|
135 |
+
var placeholder_s = slider.siblings( '.um-slider-range' ).data( 'placeholder-s' );
|
136 |
+
var placeholder_p = slider.siblings( '.um-slider-range' ).data( 'placeholder-p' );
|
137 |
+
var um_range_min, um_range_max;
|
138 |
+
|
139 |
+
if ( ui ) {
|
140 |
+
if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
|
141 |
+
placeholder = placeholder_s.replace( '\{value\}', ui.values[ 0 ] )
|
142 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
143 |
+
.data('label') );
|
144 |
+
} else {
|
145 |
+
placeholder = placeholder_p.replace( '\{min_range\}', ui.values[ 0 ] )
|
146 |
+
.replace( '\{max_range\}', ui.values[ 1 ] )
|
147 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
148 |
+
.data('label') );
|
149 |
+
}
|
150 |
+
um_range_min = ui.values[0];
|
151 |
+
um_range_max = ui.values[1];
|
152 |
+
} else {
|
153 |
+
if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
|
154 |
+
placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
|
155 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
156 |
+
.data('label') );
|
157 |
+
} else {
|
158 |
+
placeholder = placeholder_p.replace( '\{min_range\}', slider.slider( "values", 0 ) )
|
159 |
+
.replace( '\{max_range\}', slider.slider( "values", 1 ) )
|
160 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
161 |
+
.data('label') );
|
162 |
+
}
|
163 |
+
um_range_min = slider.slider( "values", 0 );
|
164 |
+
um_range_max = slider.slider( "values", 1 );
|
165 |
+
}
|
166 |
+
slider.siblings( '.um-slider-range' ).html( placeholder );
|
167 |
+
|
168 |
+
slider.siblings( ".um_range_min" ).val( um_range_min );
|
169 |
+
slider.siblings( ".um_range_max" ).val( um_range_max );
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
function um_get_search( directory ) {
|
174 |
+
if ( directory.find('.um-search-line').length ) {
|
175 |
+
return directory.find( '.um-search-line' ).val();
|
176 |
+
} else {
|
177 |
+
return '';
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
function um_get_sort( directory ) {
|
182 |
+
return directory.data( 'sorting' );
|
183 |
+
}
|
184 |
+
|
185 |
+
function um_get_current_page( directory ) {
|
186 |
+
var page = directory.data( 'page' );
|
187 |
+
if ( ! page || typeof page == 'undefined' ) {
|
188 |
+
page = 1;
|
189 |
+
}
|
190 |
+
return page;
|
191 |
+
}
|
192 |
+
|
193 |
+
function um_time_convert( time, range ) {
|
194 |
+
var hours = Math.floor( time / 60 );
|
195 |
+
var minutes = time % 60;
|
196 |
+
|
197 |
+
if ( minutes >= 60 ) {
|
198 |
+
minutes = 0;
|
199 |
+
hours = hours + 1;
|
200 |
+
|
201 |
+
if ( hours >= 24 ) {
|
202 |
+
hours = 0;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( minutes < 10 ) {
|
207 |
+
minutes = '0' + minutes;
|
208 |
+
}
|
209 |
+
|
210 |
+
return hours + ":" + minutes;
|
211 |
+
}
|
212 |
+
|
213 |
+
function um_ajax_get_members( directory, args ) {
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Operates with the next data:
|
217 |
+
*
|
218 |
+
* 1) Page - getting from directory data 'page'
|
219 |
+
* 2) Sort - getting from 'um-member-directory-sorting-options' field value
|
220 |
+
* 3) Search - getting from 'um-search-line' field value
|
221 |
+
* 4) Filters - getting from URL data by 'um_get_data_for_directory' function
|
222 |
+
*
|
223 |
+
*/
|
224 |
+
|
225 |
+
var hash = um_members_get_hash( directory );
|
226 |
+
|
227 |
+
var allow = wp.hooks.applyFilters( 'um_member_directory_get_members_allow', true, hash, directory );
|
228 |
+
if ( ! allow ) {
|
229 |
+
setTimeout( um_ajax_get_members, 600, directory, args );
|
230 |
+
return;
|
231 |
+
}
|
232 |
+
|
233 |
+
var page = um_get_current_page( directory );
|
234 |
+
var search = um_get_search( directory );
|
235 |
+
var sorting = um_get_sort( directory );
|
236 |
+
|
237 |
+
var local_date = new Date();
|
238 |
+
var gmt_hours = -local_date.getTimezoneOffset() / 60;
|
239 |
+
|
240 |
+
var request = {
|
241 |
+
directory_id: hash,
|
242 |
+
page: page,
|
243 |
+
search: search,
|
244 |
+
sorting: sorting,
|
245 |
+
gmt_offset: gmt_hours,
|
246 |
+
post_refferer: directory.data('base-post'),
|
247 |
+
nonce: um_scripts.nonce
|
248 |
+
};
|
249 |
+
|
250 |
+
if ( directory.find('.um-search-filter').length ) {
|
251 |
+
directory.find('.um-search-filter').each( function() {
|
252 |
+
var filter = jQuery(this);
|
253 |
+
|
254 |
+
if ( filter.find( '.um-slider' ).length ) {
|
255 |
+
var filter_name = filter.find( '.um-slider' ).data('field_name');
|
256 |
+
|
257 |
+
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
258 |
+
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
259 |
+
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined' ) {
|
260 |
+
request[ filter_name ] = [ value_from, value_to ];
|
261 |
+
}
|
262 |
+
} else if ( filter.find( '.um-datepicker-filter' ).length ) {
|
263 |
+
var filter_name = filter.find( '.um-datepicker-filter' ).data('filter_name');
|
264 |
+
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
265 |
+
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
266 |
+
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined') {
|
267 |
+
request[ filter_name ] = [ value_from, value_to ];
|
268 |
+
}
|
269 |
+
} else if ( filter.find( '.um-timepicker-filter' ).length ) {
|
270 |
+
var filter_name = filter.find( '.um-timepicker-filter' ).data('filter_name');
|
271 |
+
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
272 |
+
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
273 |
+
|
274 |
+
if ( typeof value_from != 'undefined' ) {
|
275 |
+
var value_from = value_from.split(':');
|
276 |
+
var hours = value_from[0]*1;
|
277 |
+
if ( hours < 10 ) {
|
278 |
+
hours = '0' + hours;
|
279 |
+
}
|
280 |
+
|
281 |
+
var minutes = value_from[1]*1;
|
282 |
+
if ( minutes < 10 ) {
|
283 |
+
minutes = '0' + minutes;
|
284 |
+
}
|
285 |
+
|
286 |
+
value_from = hours + ':' + minutes + ':00';
|
287 |
+
}
|
288 |
+
if ( typeof value_to != 'undefined' ) {
|
289 |
+
var val_to = value_to.split(':');
|
290 |
+
var minutes = val_to[1]*1;
|
291 |
+
|
292 |
+
var hours = val_to[0]*1;
|
293 |
+
if ( hours < 10 ) {
|
294 |
+
hours = '0' + hours;
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( minutes < 10 ) {
|
298 |
+
minutes = '0' + minutes;
|
299 |
+
}
|
300 |
+
|
301 |
+
value_to = hours + ':' + minutes + ':59';
|
302 |
+
}
|
303 |
+
|
304 |
+
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined' ) {
|
305 |
+
request[ filter_name ] = [ value_from, value_to ];
|
306 |
+
}
|
307 |
+
} else if ( filter.find( 'select' ).length ) {
|
308 |
+
var filter_name = filter.find('select').attr('name');
|
309 |
+
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
310 |
+
if ( typeof value != 'undefined' ) {
|
311 |
+
value = um_unsanitize_value( value );
|
312 |
+
request[ filter_name ] = value.split( '||' );
|
313 |
+
}
|
314 |
+
} else if ( filter.hasClass( 'um-text-filter-type' ) && filter.find('input[type="text"]').length ) {
|
315 |
+
var filter_name = filter.find('input[type="text"]').attr('name');
|
316 |
+
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
317 |
+
if ( typeof value != 'undefined' ) {
|
318 |
+
value = um_unsanitize_value( value );
|
319 |
+
request[ filter_name ] = value;
|
320 |
+
}
|
321 |
+
} else {
|
322 |
+
request = wp.hooks.applyFilters( 'um_member_directory_custom_filter_handler', request, filter, directory );
|
323 |
+
}
|
324 |
+
});
|
325 |
+
}
|
326 |
+
|
327 |
+
request = wp.hooks.applyFilters( 'um_member_directory_filter_request', request );
|
328 |
+
|
329 |
+
wp.ajax.send( 'um_get_members', {
|
330 |
+
data: request,
|
331 |
+
success: function( answer ) {
|
332 |
+
//set last data hard for using on layouts reloading
|
333 |
+
um_member_directory_last_data[ hash ] = answer;
|
334 |
+
|
335 |
+
um_build_template( directory, answer );
|
336 |
+
|
337 |
+
var pagination_template = wp.template( 'um-members-pagination' );
|
338 |
+
directory.find('.um-members-pagination-box').html( pagination_template( answer ) );
|
339 |
+
|
340 |
+
directory.data( 'total_pages', answer.pagination.total_pages );
|
341 |
+
|
342 |
+
if ( answer.pagination.total_pages ) {
|
343 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
344 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
345 |
+
} else {
|
346 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
347 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
348 |
+
}
|
349 |
+
|
350 |
+
//args.directory = directory;
|
351 |
+
wp.hooks.doAction( 'um_member_directory_loaded', directory, answer );
|
352 |
+
//jQuery( document ).trigger('um_members_rendered', [ directory, answer ] );
|
353 |
+
|
354 |
+
um_init_new_dropdown();
|
355 |
+
|
356 |
+
um_members_hide_preloader( directory );
|
357 |
+
},
|
358 |
+
error: function( data ) {
|
359 |
+
console.log( data );
|
360 |
+
|
361 |
+
um_members_hide_preloader( directory );
|
362 |
+
}
|
363 |
+
});
|
364 |
+
}
|
365 |
+
|
366 |
+
|
367 |
+
function um_build_template( directory, data ) {
|
368 |
+
var layout = directory.data('view_type');
|
369 |
+
var template = wp.template( 'um-member-' + layout + '-' + um_members_get_hash( directory ) );
|
370 |
+
|
371 |
+
directory.find('.um-members-grid, .um-members-list').remove();
|
372 |
+
directory.find('.um-members-wrapper').prepend( template( data.users ) );
|
373 |
+
|
374 |
+
var header_template = wp.template( 'um-members-header' );
|
375 |
+
directory.find('.um-members-intro').remove();
|
376 |
+
|
377 |
+
var generate_header = wp.hooks.applyFilters( 'um_member_directory_generate_header', false, directory );
|
378 |
+
|
379 |
+
if ( ( typeof data.is_search != 'undefined' && data.is_search ) || generate_header ) {
|
380 |
+
directory.find('.um-members-wrapper').prepend( header_template( data ) );
|
381 |
+
}
|
382 |
+
|
383 |
+
directory.addClass('um-loaded');
|
384 |
+
|
385 |
+
if ( directory.find('.um-members.um-members-grid').length ) {
|
386 |
+
UM_Member_Grid( directory.find('.um-members.um-members-grid') );
|
387 |
+
}
|
388 |
+
|
389 |
+
jQuery( document ).trigger( 'um_build_template', [ directory, data ] );
|
390 |
+
jQuery( window ).trigger( 'resize' );
|
391 |
+
|
392 |
+
init_tipsy();
|
393 |
+
}
|
394 |
+
|
395 |
+
|
396 |
+
|
397 |
+
function UM_Member_Grid( container ) {
|
398 |
+
if ( container.find( '.um-member' ).length ) {
|
399 |
+
container.imagesLoaded( function() {
|
400 |
+
|
401 |
+
var masonry_args = wp.hooks.applyFilters( 'um_member_directory_grid_masonry_attrs', {
|
402 |
+
itemSelector: '.um-member',
|
403 |
+
columnWidth: '.um-member',
|
404 |
+
gutter: '.um-gutter-sizer'
|
405 |
+
}, container );
|
406 |
+
|
407 |
+
var $grid = container.masonry( masonry_args );
|
408 |
+
|
409 |
+
$grid.on( 'layoutComplete', function( event, laidOutItems ) {
|
410 |
+
jQuery( document ).trigger( "um_grid_initialized", [ event, laidOutItems ] );
|
411 |
+
});
|
412 |
+
});
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
|
417 |
+
function um_get_filters_data( directory ) {
|
418 |
+
var filters_data = [];
|
419 |
+
|
420 |
+
directory.find('.um-search-filter').each( function() {
|
421 |
+
|
422 |
+
var filter = jQuery(this);
|
423 |
+
var filter_name,
|
424 |
+
filter_title;
|
425 |
+
|
426 |
+
var filter_type;
|
427 |
+
if ( filter.find('input.um-datepicker-filter').length ) {
|
428 |
+
filter_type = 'datepicker';
|
429 |
+
|
430 |
+
filter.find('input.um-datepicker-filter').each( function() {
|
431 |
+
var range = jQuery(this).data('range');
|
432 |
+
if ( range === 'to' ) {
|
433 |
+
return;
|
434 |
+
}
|
435 |
+
|
436 |
+
var filter_name = jQuery(this).data('filter_name');
|
437 |
+
|
438 |
+
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
439 |
+
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
440 |
+
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
441 |
+
return;
|
442 |
+
}
|
443 |
+
|
444 |
+
var from_val = jQuery(this).val();
|
445 |
+
var to_val = directory.find('input.um-datepicker-filter[data-range="to"][data-filter_name="' + filter_name + '"]').val();
|
446 |
+
|
447 |
+
var value;
|
448 |
+
if ( from_val === to_val ) {
|
449 |
+
value = to_val;
|
450 |
+
} else if ( from_val !== '' && to_val !== '' ) {
|
451 |
+
value = from_val + ' - ' + to_val;
|
452 |
+
} else if ( from_val === '' ) {
|
453 |
+
value = 'before ' + to_val;
|
454 |
+
} else if ( to_val === '' ) {
|
455 |
+
value = 'since ' + from_val;
|
456 |
+
}
|
457 |
+
|
458 |
+
filters_data.push( {'name':filter_name, 'label':jQuery(this).data('filter-label'), 'value_label': value, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
|
459 |
+
});
|
460 |
+
|
461 |
+
} else if( filter.find('input.um-timepicker-filter').length ) {
|
462 |
+
filter_type = 'timepicker';
|
463 |
+
|
464 |
+
filter.find('input.um-timepicker-filter').each( function() {
|
465 |
+
var range = jQuery(this).data('range');
|
466 |
+
if ( range === 'to' ) {
|
467 |
+
return;
|
468 |
+
}
|
469 |
+
|
470 |
+
var filter_name = jQuery(this).data('filter_name');
|
471 |
+
|
472 |
+
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
473 |
+
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
474 |
+
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
475 |
+
return;
|
476 |
+
}
|
477 |
+
|
478 |
+
var from_val = jQuery(this).val();
|
479 |
+
var to_val = directory.find('input.um-timepicker-filter[data-range="to"][data-filter_name="' + filter_name + '"]').val();
|
480 |
+
|
481 |
+
var value;
|
482 |
+
if ( from_val === to_val ) {
|
483 |
+
value = to_val;
|
484 |
+
} else if ( from_val !== '' && to_val !== '' ) {
|
485 |
+
value = from_val + ' - ' + to_val;
|
486 |
+
} else if ( from_val === '' ) {
|
487 |
+
value = 'before ' + to_val;
|
488 |
+
} else if ( to_val === '' ) {
|
489 |
+
value = 'since ' + from_val;
|
490 |
+
}
|
491 |
+
|
492 |
+
filters_data.push( {'name':filter_name, 'label':jQuery(this).data('filter-label'), 'value_label': value, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
|
493 |
+
});
|
494 |
+
} else if( filter.find('select').length ) {
|
495 |
+
|
496 |
+
filter_type = 'select';
|
497 |
+
filter_name = filter.find('select').attr('name');
|
498 |
+
filter_title = filter.find('select').data('placeholder');
|
499 |
+
|
500 |
+
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
501 |
+
|
502 |
+
if ( typeof filter_value == 'undefined' ) {
|
503 |
+
filter_value = [];
|
504 |
+
} else {
|
505 |
+
filter_value = um_unsanitize_value( filter_value );
|
506 |
+
filter_value = filter_value.split( '||' );
|
507 |
+
}
|
508 |
+
|
509 |
+
jQuery.each( filter_value, function(i) {
|
510 |
+
var filter_value_title = filter.find('select option[value="' + filter_value[ i ] + '"]').data('value_label');
|
511 |
+
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':filter_value[ i ], 'type':filter_type} );
|
512 |
+
});
|
513 |
+
|
514 |
+
} else if( filter.hasClass('um-text-filter-type') && filter.find('input[type="text"]').length ) {
|
515 |
+
|
516 |
+
filter_type = 'text';
|
517 |
+
filter_name = filter.find('input[type="text"]').attr('name');
|
518 |
+
filter_title = filter.find('input[type="text"]').attr('placeholder');
|
519 |
+
|
520 |
+
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
521 |
+
if ( typeof filter_value == 'undefined' ) {
|
522 |
+
filter_value = '';
|
523 |
+
}
|
524 |
+
|
525 |
+
if ( filter_value != '' ) {
|
526 |
+
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value, 'value':filter_value, 'type':filter_type} );
|
527 |
+
}
|
528 |
+
|
529 |
+
} else if( filter.find('div.ui-slider').length ) {
|
530 |
+
filter_type = 'slider';
|
531 |
+
|
532 |
+
filter_name = filter.find('div.ui-slider').data( 'field_name' );
|
533 |
+
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
534 |
+
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
535 |
+
|
536 |
+
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
537 |
+
return;
|
538 |
+
}
|
539 |
+
|
540 |
+
var filter_value_title;
|
541 |
+
if ( filter_value_from === filter_value_to ) {
|
542 |
+
filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-s' ).replace( '\{value\}', filter_value_from )
|
543 |
+
.replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
|
544 |
+
} else {
|
545 |
+
filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-p' ).replace( '\{min_range\}', filter_value_from )
|
546 |
+
.replace( '\{max_range\}', filter_value_to )
|
547 |
+
.replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
|
548 |
+
}
|
549 |
+
|
550 |
+
filter_title = filter.find('div.um-slider-range').data('label');
|
551 |
+
|
552 |
+
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
|
553 |
+
} else {
|
554 |
+
|
555 |
+
filters_data = wp.hooks.applyFilters( 'um_member_directory_get_filter_data', filters_data, directory, filter );
|
556 |
+
|
557 |
+
}
|
558 |
+
});
|
559 |
+
|
560 |
+
return filters_data;
|
561 |
+
}
|
562 |
+
|
563 |
+
|
564 |
+
function um_change_tag( directory ) {
|
565 |
+
var filters_data = um_get_filters_data( directory );
|
566 |
+
|
567 |
+
directory.find('.um-members-filter-tag').remove();
|
568 |
+
|
569 |
+
var filtered_line = directory.find('.um-filtered-line');
|
570 |
+
if ( filtered_line.length ) {
|
571 |
+
var filters_template = wp.template( 'um-members-filtered-line' );
|
572 |
+
filtered_line.prepend( filters_template( {'filters': filters_data} ) );
|
573 |
+
|
574 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
575 |
+
directory.find('.um-clear-filters').hide();
|
576 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').addClass( 'um-header-row-invisible' );
|
577 |
+
} else {
|
578 |
+
directory.find('.um-clear-filters').show();
|
579 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
|
580 |
+
}
|
581 |
+
}
|
582 |
+
|
583 |
+
|
584 |
+
}
|
585 |
+
|
586 |
+
|
587 |
+
|
588 |
+
function um_run_search( directory ) {
|
589 |
+
if ( um_is_directory_busy( directory ) ) {
|
590 |
+
return;
|
591 |
+
}
|
592 |
+
um_members_show_preloader( directory );
|
593 |
+
|
594 |
+
var pre_search = um_get_data_for_directory( directory, 'search' );
|
595 |
+
|
596 |
+
var search = um_sanitize_value( directory.find('.um-search-line').val() );
|
597 |
+
if ( search === pre_search || ( search === '' && typeof pre_search == 'undefined' ) ) {
|
598 |
+
um_members_hide_preloader( directory );
|
599 |
+
return;
|
600 |
+
}
|
601 |
+
|
602 |
+
directory.data( 'general_search', search );
|
603 |
+
um_set_url_from_data( directory, 'search', search );
|
604 |
+
|
605 |
+
//set 1st page after search
|
606 |
+
directory.data( 'page', 1 );
|
607 |
+
um_set_url_from_data( directory, 'page', '' );
|
608 |
+
|
609 |
+
|
610 |
+
var ignore_after_search = false;
|
611 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
612 |
+
|
613 |
+
if ( ! ignore_after_search ) {
|
614 |
+
var show_after_search = directory.data('must-search');
|
615 |
+
if ( show_after_search === 1 ) {
|
616 |
+
search = um_get_search( directory );
|
617 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
|
618 |
+
directory.data( 'searched', 0 );
|
619 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
620 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
621 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
622 |
+
|
623 |
+
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
624 |
+
|
625 |
+
um_members_hide_preloader( directory );
|
626 |
+
return;
|
627 |
+
}
|
628 |
+
}
|
629 |
+
}
|
630 |
+
|
631 |
+
directory.data( 'searched', 1 );
|
632 |
+
|
633 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
634 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
635 |
+
|
636 |
+
um_ajax_get_members( directory );
|
637 |
+
}
|
638 |
+
|
639 |
+
|
640 |
+
jQuery(document.body).ready( function() {
|
641 |
+
|
642 |
+
|
643 |
+
jQuery( '.um-directory .um-search-filter select' ).each( function() {
|
644 |
+
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
645 |
+
jQuery(this).prop('disabled', true);
|
646 |
+
}
|
647 |
+
|
648 |
+
var obj = jQuery(this);
|
649 |
+
obj.select2('destroy').select2({
|
650 |
+
dropdownParent: obj.parent()
|
651 |
+
});
|
652 |
+
});
|
653 |
+
|
654 |
+
/**
|
655 |
+
* Change View Type Handlers
|
656 |
+
*/
|
657 |
+
|
658 |
+
|
659 |
+
//UI for change view type button
|
660 |
+
jQuery( document.body ).on( 'mouseover', '.um-directory .um-member-directory-view-type', function() {
|
661 |
+
if ( jQuery(this).hasClass('um-disabled') ) {
|
662 |
+
return;
|
663 |
+
}
|
664 |
+
|
665 |
+
var $obj = jQuery(this).find('.um-member-directory-view-type-a:visible');
|
666 |
+
|
667 |
+
$obj.hide();
|
668 |
+
|
669 |
+
if ( $obj.next().length ) {
|
670 |
+
$obj.next().show().tipsy('show');
|
671 |
+
} else {
|
672 |
+
jQuery(this).find( '.um-member-directory-view-type-a:first' ).show().tipsy('show');
|
673 |
+
}
|
674 |
+
}).on( 'mouseout', '.um-directory .um-member-directory-view-type', function() {
|
675 |
+
if ( jQuery(this).hasClass('um-disabled') ) {
|
676 |
+
return;
|
677 |
+
}
|
678 |
+
|
679 |
+
jQuery(this).find('.um-member-directory-view-type-a').hide().tipsy('hide');
|
680 |
+
jQuery(this).find('.um-member-directory-view-type-a[data-type="' + jQuery(this).parents( '.um-directory' ).data('view_type') + '"]').show();
|
681 |
+
});
|
682 |
+
|
683 |
+
//change layout handler
|
684 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-member-directory-view-type-a', function() {
|
685 |
+
var directory = jQuery(this).parents('.um-directory');
|
686 |
+
if ( um_is_directory_busy( directory ) ) {
|
687 |
+
return false;
|
688 |
+
}
|
689 |
+
|
690 |
+
var $this = jQuery(this);
|
691 |
+
var views = $this.parents('.um-member-directory-view-type');
|
692 |
+
|
693 |
+
if ( views.hasClass('um-disabled') ) {
|
694 |
+
return;
|
695 |
+
}
|
696 |
+
|
697 |
+
um_members_show_preloader( directory );
|
698 |
+
|
699 |
+
var $obj = views.find('.um-member-directory-view-type-a:visible');
|
700 |
+
|
701 |
+
$obj.hide();
|
702 |
+
|
703 |
+
if ( $obj.next().length ) {
|
704 |
+
$obj.next().show().tipsy('show');
|
705 |
+
} else {
|
706 |
+
views.find( '.um-member-directory-view-type-a:first' ).show().tipsy('show');
|
707 |
+
}
|
708 |
+
|
709 |
+
var data = um_member_directory_last_data[ um_members_get_hash( directory ) ];
|
710 |
+
if ( data !== null ) {
|
711 |
+
var layout = $this.data('type');
|
712 |
+
|
713 |
+
um_set_url_from_data( directory, 'view_type', layout );
|
714 |
+
directory.data( 'view_type', layout );
|
715 |
+
|
716 |
+
um_build_template( directory, data );
|
717 |
+
|
718 |
+
um_init_new_dropdown();
|
719 |
+
}
|
720 |
+
um_members_hide_preloader( directory );
|
721 |
+
});
|
722 |
+
|
723 |
+
|
724 |
+
/**
|
725 |
+
* END: Change View Type Handlers
|
726 |
+
*/
|
727 |
+
|
728 |
+
|
729 |
+
/**
|
730 |
+
* General Search
|
731 |
+
*/
|
732 |
+
|
733 |
+
|
734 |
+
//searching
|
735 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-do-search', function() {
|
736 |
+
var directory = jQuery(this).parents('.um-directory');
|
737 |
+
um_run_search( directory );
|
738 |
+
});
|
739 |
+
|
740 |
+
|
741 |
+
//make search on Enter click
|
742 |
+
jQuery( document.body ).on( 'keypress', '.um-directory .um-search-line', function(e) {
|
743 |
+
if ( e.which === 13 ) {
|
744 |
+
var directory = jQuery(this).parents('.um-directory');
|
745 |
+
um_run_search( directory );
|
746 |
+
}
|
747 |
+
});
|
748 |
+
|
749 |
+
|
750 |
+
/**
|
751 |
+
* END: General Search
|
752 |
+
*/
|
753 |
+
|
754 |
+
|
755 |
+
|
756 |
+
/**
|
757 |
+
* Sorting
|
758 |
+
*/
|
759 |
+
|
760 |
+
jQuery( document.body ).on( 'click', '.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a', function() {
|
761 |
+
if ( jQuery( this ).data('selected') === 1 ) {
|
762 |
+
return;
|
763 |
+
}
|
764 |
+
|
765 |
+
var directory_hash = jQuery(this).data('directory-hash');
|
766 |
+
var directory = jQuery('.um-directory[data-hash="' + directory_hash + '"]');
|
767 |
+
|
768 |
+
if ( um_is_directory_busy( directory ) ) {
|
769 |
+
return;
|
770 |
+
}
|
771 |
+
|
772 |
+
um_members_show_preloader( directory );
|
773 |
+
|
774 |
+
var sorting_label = jQuery( this ).html();
|
775 |
+
var sort = jQuery(this).data('value');
|
776 |
+
|
777 |
+
directory.data( 'sorting', sort );
|
778 |
+
um_set_url_from_data( directory, 'sort', sort );
|
779 |
+
|
780 |
+
um_ajax_get_members( directory );
|
781 |
+
|
782 |
+
directory.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a').data('selected', 0).prop('data-selected', 0).attr('data-selected', 0);
|
783 |
+
directory.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="' + sort + '"]').data('selected', 1).prop('data-selected', 1).attr('data-selected', 1);
|
784 |
+
directory.find('.um-member-directory-sorting-a').find('> a').html( sorting_label );
|
785 |
+
});
|
786 |
+
|
787 |
+
/**
|
788 |
+
* END: Sorting
|
789 |
+
*/
|
790 |
+
|
791 |
+
|
792 |
+
|
793 |
+
/**
|
794 |
+
* Pagination
|
795 |
+
*/
|
796 |
+
|
797 |
+
|
798 |
+
jQuery( document.body ).on( 'click', '.um-directory .pagi:not(.current)', function() {
|
799 |
+
if ( jQuery(this).hasClass('disabled') ) {
|
800 |
+
return;
|
801 |
+
}
|
802 |
+
|
803 |
+
var directory = jQuery(this).parents('.um-directory');
|
804 |
+
if ( um_is_directory_busy( directory ) ) {
|
805 |
+
return;
|
806 |
+
}
|
807 |
+
|
808 |
+
um_members_show_preloader( directory );
|
809 |
+
|
810 |
+
var page;
|
811 |
+
if ( 'first' === jQuery(this).data('page') ) {
|
812 |
+
page = 1;
|
813 |
+
} else if ( 'prev' === jQuery(this).data('page') ) {
|
814 |
+
page = directory.data( 'page' )*1 - 1;
|
815 |
+
} else if ( 'next' === jQuery(this).data('page') ) {
|
816 |
+
page = directory.data( 'page' )*1 + 1;
|
817 |
+
} else if ( 'last' === jQuery(this).data('page') ) {
|
818 |
+
page = parseInt( directory.data( 'total_pages' ) );
|
819 |
+
} else {
|
820 |
+
page = parseInt( jQuery(this).data('page') );
|
821 |
+
}
|
822 |
+
|
823 |
+
if ( page === 1 ) {
|
824 |
+
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass('disabled');
|
825 |
+
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
826 |
+
} else if ( page === parseInt( directory.data( 'total_pages' ) ) ) {
|
827 |
+
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass('disabled');
|
828 |
+
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass('disabled');
|
829 |
+
} else {
|
830 |
+
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
831 |
+
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass('disabled');
|
832 |
+
}
|
833 |
+
|
834 |
+
directory.find('.pagi').removeClass('current');
|
835 |
+
directory.find('.pagi[data-page="' + page + '"]').addClass('current');
|
836 |
+
|
837 |
+
directory.data( 'page', page );
|
838 |
+
if ( page === 1 ) {
|
839 |
+
um_set_url_from_data( directory, 'page', '' );
|
840 |
+
} else {
|
841 |
+
um_set_url_from_data( directory, 'page', page );
|
842 |
+
}
|
843 |
+
|
844 |
+
um_ajax_get_members( directory );
|
845 |
+
});
|
846 |
+
|
847 |
+
|
848 |
+
//mobile pagination
|
849 |
+
jQuery( document.body ).on( 'change', '.um-directory .um-members-pagi-dropdown', function() {
|
850 |
+
var directory = jQuery(this).parents('.um-directory');
|
851 |
+
|
852 |
+
if ( um_is_directory_busy( directory ) ) {
|
853 |
+
return;
|
854 |
+
}
|
855 |
+
|
856 |
+
um_members_show_preloader( directory );
|
857 |
+
|
858 |
+
var page = jQuery(this).val();
|
859 |
+
|
860 |
+
directory.find('.pagi').removeClass('current');
|
861 |
+
directory.find('.pagi[data-page="' + page + '"]').addClass('current');
|
862 |
+
|
863 |
+
directory.data( 'page', page );
|
864 |
+
if ( page === 1 ) {
|
865 |
+
um_set_url_from_data( directory, 'page', '' );
|
866 |
+
} else {
|
867 |
+
um_set_url_from_data( directory, 'page', page );
|
868 |
+
}
|
869 |
+
|
870 |
+
um_ajax_get_members( directory );
|
871 |
+
});
|
872 |
+
|
873 |
+
|
874 |
+
/**
|
875 |
+
* END: Pagination
|
876 |
+
*/
|
877 |
+
|
878 |
+
|
879 |
+
/**
|
880 |
+
* Profile Cards actions
|
881 |
+
*/
|
882 |
+
|
883 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-list .um-member-more a', function(e){
|
884 |
+
e.preventDefault();
|
885 |
+
|
886 |
+
var block = jQuery(this).parents('.um-member');
|
887 |
+
|
888 |
+
block.find('.um-member-more').hide();
|
889 |
+
block.find('.um-member-meta-main').slideDown();
|
890 |
+
block.find('.um-member-less').fadeIn();
|
891 |
+
|
892 |
+
return false;
|
893 |
+
});
|
894 |
+
|
895 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-list .um-member-less a', function(e){
|
896 |
+
e.preventDefault();
|
897 |
+
|
898 |
+
var block = jQuery(this).parents('.um-member');
|
899 |
+
|
900 |
+
block.find('.um-member-less').hide();
|
901 |
+
block.find('.um-member-meta-main').slideUp();
|
902 |
+
block.find('.um-member-more').fadeIn();
|
903 |
+
|
904 |
+
return false;
|
905 |
+
});
|
906 |
+
|
907 |
+
|
908 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-grid .um-member-more a', function(e){
|
909 |
+
e.preventDefault();
|
910 |
+
|
911 |
+
var block = jQuery(this).parents('.um-member');
|
912 |
+
var container = jQuery(this).parents('.um-members');
|
913 |
+
block.find('.um-member-more').hide();
|
914 |
+
block.find('.um-member-meta').slideDown( function(){ UM_Member_Grid( container ) } );
|
915 |
+
block.find('.um-member-less').fadeIn( );
|
916 |
+
|
917 |
+
setTimeout(function(){ UM_Member_Grid( container ) }, 100);
|
918 |
+
|
919 |
+
return false;
|
920 |
+
});
|
921 |
+
|
922 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-grid .um-member-less a', function(e){
|
923 |
+
e.preventDefault();
|
924 |
+
|
925 |
+
var block = jQuery(this).parents('.um-member');
|
926 |
+
var container = jQuery(this).parents('.um-members');
|
927 |
+
block.find('.um-member-less').hide();
|
928 |
+
block.find('.um-member-meta').slideUp( function() {
|
929 |
+
block.find('.um-member-more').fadeIn();
|
930 |
+
UM_Member_Grid( container );
|
931 |
+
});
|
932 |
+
|
933 |
+
return false;
|
934 |
+
});
|
935 |
+
|
936 |
+
/**
|
937 |
+
* END: Profile Cards actions
|
938 |
+
*/
|
939 |
+
|
940 |
+
|
941 |
+
//filters controls
|
942 |
+
jQuery('.um-member-directory-filters-a').on( 'click', function() {
|
943 |
+
var obj = jQuery(this);
|
944 |
+
var search_bar = obj.parents('.um-directory').find('.um-search');
|
945 |
+
|
946 |
+
if ( search_bar.is( ':visible' ) ) {
|
947 |
+
search_bar.slideUp( 250, function(){
|
948 |
+
obj.toggleClass('um-member-directory-filters-visible');
|
949 |
+
search_bar.parents('.um-member-directory-header-row').toggleClass('um-header-row-invisible');
|
950 |
+
});
|
951 |
+
} else {
|
952 |
+
search_bar.slideDown({
|
953 |
+
duration: 250,
|
954 |
+
start: function() {
|
955 |
+
jQuery(this).css({
|
956 |
+
display: "grid"
|
957 |
+
});
|
958 |
+
obj.toggleClass('um-member-directory-filters-visible');
|
959 |
+
search_bar.parents('.um-member-directory-header-row').toggleClass('um-header-row-invisible');
|
960 |
+
}
|
961 |
+
} );
|
962 |
+
}
|
963 |
+
});
|
964 |
+
|
965 |
+
|
966 |
+
//filtration process
|
967 |
+
jQuery( document.body ).on( 'change', '.um-directory .um-search-filter select', function() {
|
968 |
+
var selected_val_raw = jQuery(this).val();
|
969 |
+
var selected_val = um_sanitize_value( selected_val_raw );
|
970 |
+
|
971 |
+
if ( selected_val === '' ) {
|
972 |
+
return;
|
973 |
+
}
|
974 |
+
|
975 |
+
var directory = jQuery(this).parents('.um-directory');
|
976 |
+
|
977 |
+
if ( um_is_directory_busy( directory ) ) {
|
978 |
+
return;
|
979 |
+
}
|
980 |
+
|
981 |
+
um_members_show_preloader( directory );
|
982 |
+
|
983 |
+
var filter_name = jQuery(this).prop('name');
|
984 |
+
|
985 |
+
var current_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
986 |
+
if ( typeof current_value == 'undefined' ) {
|
987 |
+
current_value = [];
|
988 |
+
} else {
|
989 |
+
current_value = current_value.split( '||' );
|
990 |
+
}
|
991 |
+
|
992 |
+
if ( -1 === jQuery.inArray( selected_val, current_value ) ) {
|
993 |
+
current_value.push( selected_val );
|
994 |
+
current_value = current_value.join( '||' );
|
995 |
+
|
996 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
997 |
+
|
998 |
+
//set 1st page after filtration
|
999 |
+
directory.data( 'page', 1 );
|
1000 |
+
um_set_url_from_data( directory, 'page', '' );
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
//disable options and disable select if all options are disabled
|
1004 |
+
jQuery(this).find('option[value="' + selected_val_raw + '"]').prop('disabled', true).hide();
|
1005 |
+
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
1006 |
+
jQuery(this).prop('disabled', true);
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
var obj = jQuery(this);
|
1010 |
+
obj.select2('destroy').select2({
|
1011 |
+
dropdownParent: obj.parent()
|
1012 |
+
});
|
1013 |
+
obj.val('').trigger( 'change' );
|
1014 |
+
|
1015 |
+
um_ajax_get_members( directory );
|
1016 |
+
|
1017 |
+
um_change_tag( directory );
|
1018 |
+
|
1019 |
+
directory.data( 'searched', 1 );
|
1020 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1021 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1022 |
+
// if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
1023 |
+
// jQuery(this).trigger('change');
|
1024 |
+
// }
|
1025 |
+
});
|
1026 |
+
|
1027 |
+
|
1028 |
+
jQuery( document.body ).on( 'blur', '.um-directory .um-search-filter.um-text-filter-type input[type="text"]', function() {
|
1029 |
+
var directory = jQuery(this).parents('.um-directory');
|
1030 |
+
|
1031 |
+
if ( um_is_directory_busy( directory ) ) {
|
1032 |
+
return;
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
var current_value = um_sanitize_value( jQuery(this).val() );
|
1036 |
+
var filter_name = jQuery(this).prop('name');
|
1037 |
+
var url_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1038 |
+
|
1039 |
+
if ( typeof url_value == 'undefined' ) {
|
1040 |
+
url_value = '';
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
if ( current_value === url_value ) {
|
1044 |
+
return;
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
um_members_show_preloader( directory );
|
1048 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1049 |
+
|
1050 |
+
//set 1st page after filtration
|
1051 |
+
directory.data( 'page', 1 );
|
1052 |
+
um_set_url_from_data( directory, 'page', '' );
|
1053 |
+
|
1054 |
+
um_ajax_get_members( directory );
|
1055 |
+
|
1056 |
+
um_change_tag( directory );
|
1057 |
+
|
1058 |
+
directory.data( 'searched', 1 );
|
1059 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1060 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1061 |
+
});
|
1062 |
+
|
1063 |
+
|
1064 |
+
//make search on Enter click
|
1065 |
+
jQuery( document.body ).on( 'keypress', '.um-directory .um-search-filter.um-text-filter-type input[type="text"]', function(e) {
|
1066 |
+
if ( e.which === 13 ) {
|
1067 |
+
var directory = jQuery(this).parents('.um-directory');
|
1068 |
+
|
1069 |
+
if ( um_is_directory_busy( directory ) ) {
|
1070 |
+
return;
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
var current_value = um_sanitize_value( jQuery(this).val() );
|
1074 |
+
var filter_name = jQuery(this).prop('name');
|
1075 |
+
var url_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1076 |
+
|
1077 |
+
if ( typeof url_value == 'undefined' ) {
|
1078 |
+
url_value = '';
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
if ( current_value === url_value ) {
|
1082 |
+
return;
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
um_members_show_preloader( directory );
|
1086 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1087 |
+
|
1088 |
+
//set 1st page after filtration
|
1089 |
+
directory.data( 'page', 1 );
|
1090 |
+
um_set_url_from_data( directory, 'page', '' );
|
1091 |
+
|
1092 |
+
um_ajax_get_members( directory );
|
1093 |
+
|
1094 |
+
um_change_tag( directory );
|
1095 |
+
|
1096 |
+
directory.data( 'searched', 1 );
|
1097 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1098 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1099 |
+
}
|
1100 |
+
});
|
1101 |
+
|
1102 |
+
|
1103 |
+
|
1104 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-members-filter-remove', function() {
|
1105 |
+
var directory = jQuery(this).parents('.um-directory');
|
1106 |
+
|
1107 |
+
if ( um_is_directory_busy(directory) || ! directory ) {
|
1108 |
+
return;
|
1109 |
+
}
|
1110 |
+
|
1111 |
+
um_members_show_preloader( directory );
|
1112 |
+
|
1113 |
+
var removeItem = jQuery(this).data('value');
|
1114 |
+
var filter_name = jQuery(this).data('name');
|
1115 |
+
|
1116 |
+
var type = jQuery(this).data('type');
|
1117 |
+
if ( type === 'text' ) {
|
1118 |
+
um_set_url_from_data( directory, 'filter_' + filter_name,'' );
|
1119 |
+
|
1120 |
+
jQuery( '.um-search-filter input[name="' + filter_name + '"]' ).val('');
|
1121 |
+
|
1122 |
+
} else if ( type === 'select' ) {
|
1123 |
+
|
1124 |
+
var current_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1125 |
+
if ( typeof current_value == 'undefined' ) {
|
1126 |
+
current_value = [];
|
1127 |
+
} else {
|
1128 |
+
current_value = um_unsanitize_value( current_value );
|
1129 |
+
current_value = current_value.split( '||' );
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
if ( -1 !== jQuery.inArray( removeItem.toString(), current_value ) ) {
|
1133 |
+
current_value = jQuery.grep( current_value, function( value ) {
|
1134 |
+
return value !== removeItem.toString();
|
1135 |
+
});
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
if ( ! current_value.length ) {
|
1139 |
+
current_value = '';
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1143 |
+
|
1144 |
+
var select = jQuery( '.um-search-filter select[name="' + filter_name + '"]' );
|
1145 |
+
select.find('option[value="' + removeItem + '"]').prop('disabled', false).show();
|
1146 |
+
|
1147 |
+
//disable options and disable select if all options are disabled
|
1148 |
+
if ( select.find('option:not(:disabled)').length > 1 ) {
|
1149 |
+
select.prop('disabled', false);
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
select.select2('destroy').select2({
|
1153 |
+
dropdownParent: select.parent()
|
1154 |
+
});
|
1155 |
+
|
1156 |
+
if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
1157 |
+
select.trigger('change');
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
} else if ( type === 'slider' ) {
|
1161 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1162 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1163 |
+
|
1164 |
+
|
1165 |
+
var $slider = jQuery( '.um-search-filter #' + filter_name + '_min' ).siblings('.um-slider');
|
1166 |
+
var options = $slider.slider( 'option' );
|
1167 |
+
|
1168 |
+
$slider.slider( 'values', [ options.min, options.max ] );
|
1169 |
+
|
1170 |
+
jQuery( '.um-search-filter #' + filter_name + '_min' ).val('');
|
1171 |
+
jQuery( '.um-search-filter #' + filter_name + '_max' ).val('');
|
1172 |
+
|
1173 |
+
um_set_range_label( $slider );
|
1174 |
+
} else if ( type === 'datepicker' ) {
|
1175 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1176 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1177 |
+
|
1178 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1179 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1180 |
+
} else if ( type === 'timepicker' ) {
|
1181 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1182 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1183 |
+
|
1184 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1185 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1186 |
+
} else {
|
1187 |
+
wp.hooks.doAction( 'um_member_directory_filter_remove', type, directory, filter_name, removeItem );
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
|
1191 |
+
//set 1st page after filtration
|
1192 |
+
directory.data( 'page', 1 );
|
1193 |
+
um_set_url_from_data( directory, 'page', '' );
|
1194 |
+
|
1195 |
+
jQuery(this).tipsy('hide');
|
1196 |
+
jQuery(this).parents('.um-members-filter-tag').remove();
|
1197 |
+
|
1198 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
1199 |
+
directory.find('.um-clear-filters').hide();
|
1200 |
+
} else {
|
1201 |
+
directory.find('.um-clear-filters').show();
|
1202 |
+
}
|
1203 |
+
|
1204 |
+
var ignore_after_search = false;
|
1205 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1206 |
+
|
1207 |
+
if ( ! ignore_after_search ) {
|
1208 |
+
var show_after_search = directory.data('must-search');
|
1209 |
+
if ( show_after_search === 1 ) {
|
1210 |
+
var search = um_get_search( directory );
|
1211 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
|
1212 |
+
directory.data( 'searched', 0 );
|
1213 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
1214 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
1215 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
1216 |
+
|
1217 |
+
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
1218 |
+
|
1219 |
+
um_members_hide_preloader( directory );
|
1220 |
+
return;
|
1221 |
+
}
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1226 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1227 |
+
|
1228 |
+
um_ajax_get_members( directory );
|
1229 |
+
});
|
1230 |
+
|
1231 |
+
|
1232 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-clear-filters-a', function() {
|
1233 |
+
var directory = jQuery(this).parents('.um-directory');
|
1234 |
+
if ( um_is_directory_busy( directory ) ) {
|
1235 |
+
return;
|
1236 |
+
}
|
1237 |
+
|
1238 |
+
um_members_show_preloader( directory );
|
1239 |
+
|
1240 |
+
directory.find( '.um-members-filter-remove' ).each( function() {
|
1241 |
+
var removeItem = jQuery(this).data('value');
|
1242 |
+
var filter_name = jQuery(this).data('name');
|
1243 |
+
|
1244 |
+
var type = jQuery(this).data('type');
|
1245 |
+
if ( type === 'text' ) {
|
1246 |
+
um_set_url_from_data( directory, 'filter_' + filter_name,'' );
|
1247 |
+
|
1248 |
+
jQuery( '.um-search-filter input[name="' + filter_name + '"]' ).val('');
|
1249 |
+
|
1250 |
+
} else if ( type === 'select' ) {
|
1251 |
+
|
1252 |
+
var current_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1253 |
+
if ( typeof current_value == 'undefined' ) {
|
1254 |
+
current_value = [];
|
1255 |
+
} else {
|
1256 |
+
current_value = current_value.split( '||' );
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
if ( -1 !== jQuery.inArray( removeItem.toString(), current_value ) ) {
|
1260 |
+
current_value = jQuery.grep( current_value, function( value ) {
|
1261 |
+
return value !== removeItem.toString();
|
1262 |
+
});
|
1263 |
+
}
|
1264 |
+
|
1265 |
+
if ( ! current_value.length ) {
|
1266 |
+
current_value = '';
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1270 |
+
|
1271 |
+
var select = jQuery( '.um-search-filter select[name="' + filter_name + '"]' );
|
1272 |
+
select.find('option[value="' + removeItem + '"]').prop('disabled', false).show();
|
1273 |
+
|
1274 |
+
//disable options and disable select if all options are disabled
|
1275 |
+
if ( select.find('option:not(:disabled)').length > 1 ) {
|
1276 |
+
select.prop('disabled', false);
|
1277 |
+
}
|
1278 |
+
select.select2('destroy').select2({
|
1279 |
+
dropdownParent: select.parent()
|
1280 |
+
});
|
1281 |
+
|
1282 |
+
if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
1283 |
+
select.trigger('change');
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
} else if ( type === 'slider' ) {
|
1287 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1288 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1289 |
+
|
1290 |
+
var $slider = jQuery( '.um-search-filter #' + filter_name + '_min' ).siblings('.um-slider');
|
1291 |
+
var options = $slider.slider( 'option' );
|
1292 |
+
|
1293 |
+
$slider.slider( 'values', [ options.min, options.max ] );
|
1294 |
+
|
1295 |
+
jQuery( '.um-search-filter #' + filter_name + '_min' ).val('');
|
1296 |
+
jQuery( '.um-search-filter #' + filter_name + '_max' ).val('');
|
1297 |
+
|
1298 |
+
um_set_range_label( $slider );
|
1299 |
+
} else if ( type === 'datepicker' ) {
|
1300 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1301 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1302 |
+
|
1303 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1304 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1305 |
+
} else if ( type === 'timepicker' ) {
|
1306 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1307 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1308 |
+
|
1309 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1310 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1311 |
+
} else {
|
1312 |
+
wp.hooks.doAction( 'um_member_directory_clear_filters', type, directory, filter_name, removeItem );
|
1313 |
+
}
|
1314 |
+
});
|
1315 |
+
|
1316 |
+
//set 1st page after filtration
|
1317 |
+
directory.data( 'page', 1 );
|
1318 |
+
um_set_url_from_data( directory, 'page', '' );
|
1319 |
+
directory.find('.um-members-filter-tag').remove();
|
1320 |
+
|
1321 |
+
//jQuery(this).hide();
|
1322 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
1323 |
+
directory.find('.um-clear-filters').hide();
|
1324 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').addClass( 'um-header-row-invisible' );
|
1325 |
+
} else {
|
1326 |
+
directory.find('.um-clear-filters').show();
|
1327 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
|
1328 |
+
}
|
1329 |
+
|
1330 |
+
var ignore_after_search = false;
|
1331 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1332 |
+
|
1333 |
+
if ( ! ignore_after_search ) {
|
1334 |
+
var show_after_search = directory.data('must-search');
|
1335 |
+
if ( show_after_search === 1 ) {
|
1336 |
+
var search = um_get_search( directory );
|
1337 |
+
if ( ! search ) {
|
1338 |
+
directory.data( 'searched', 0 );
|
1339 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
1340 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
1341 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
1342 |
+
|
1343 |
+
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
1344 |
+
|
1345 |
+
um_members_hide_preloader( directory );
|
1346 |
+
return;
|
1347 |
+
}
|
1348 |
+
}
|
1349 |
+
}
|
1350 |
+
|
1351 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1352 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1353 |
+
|
1354 |
+
um_ajax_get_members( directory );
|
1355 |
+
});
|
1356 |
+
|
1357 |
+
|
1358 |
+
/**
|
1359 |
+
* First Page Loading
|
1360 |
+
*/
|
1361 |
+
|
1362 |
+
wp.hooks.doAction( 'um_member_directory_on_first_pages_loading' );
|
1363 |
+
|
1364 |
+
//Init Directories
|
1365 |
+
jQuery( '.um-directory' ).each( function() {
|
1366 |
+
var directory = jQuery(this);
|
1367 |
+
var hash = um_members_get_hash( directory );
|
1368 |
+
|
1369 |
+
um_member_directories.push( hash );
|
1370 |
+
|
1371 |
+
// slideup/slidedown animation fix for grid filters bar
|
1372 |
+
if ( directory.find('.um-search').length ) {
|
1373 |
+
if ( ! directory.find('.um-search').is(':visible') ) {
|
1374 |
+
directory.find('.um-search').css({
|
1375 |
+
display: "grid"
|
1376 |
+
}).slideUp( 1 );
|
1377 |
+
}
|
1378 |
+
}
|
1379 |
+
|
1380 |
+
//slider filter
|
1381 |
+
directory.find('.um-slider').each( function() {
|
1382 |
+
var slider = jQuery( this );
|
1383 |
+
var directory = slider.parents('.um-directory');
|
1384 |
+
|
1385 |
+
var filter_name = slider.data('field_name');
|
1386 |
+
|
1387 |
+
var min_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1388 |
+
var max_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1389 |
+
if ( typeof min_default_value == 'undefined' ) {
|
1390 |
+
min_default_value = parseInt( slider.data('min') );
|
1391 |
+
}
|
1392 |
+
|
1393 |
+
if ( typeof max_default_value == 'undefined' ) {
|
1394 |
+
max_default_value = parseInt( slider.data('max') );
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
var default_value = [ min_default_value, max_default_value ];
|
1398 |
+
|
1399 |
+
slider.slider({
|
1400 |
+
range: true,
|
1401 |
+
min: parseInt( slider.data('min') ),
|
1402 |
+
max: parseInt( slider.data('max') ),
|
1403 |
+
values: default_value,
|
1404 |
+
create: function( event, ui ) {
|
1405 |
+
//console.log( ui );
|
1406 |
+
},
|
1407 |
+
step: 1,
|
1408 |
+
slide: function( event, ui ) {
|
1409 |
+
um_set_range_label( jQuery( this ), ui );
|
1410 |
+
},
|
1411 |
+
stop: function( event, ui ) {
|
1412 |
+
if ( ! um_is_directory_busy( directory ) ) {
|
1413 |
+
|
1414 |
+
um_members_show_preloader( directory );
|
1415 |
+
|
1416 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', ui.values[0] );
|
1417 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', ui.values[1] );
|
1418 |
+
|
1419 |
+
//set 1st page after filtration
|
1420 |
+
directory.data( 'page', 1 );
|
1421 |
+
um_set_url_from_data( directory, 'page', '' );
|
1422 |
+
um_ajax_get_members( directory );
|
1423 |
+
|
1424 |
+
um_change_tag( directory );
|
1425 |
+
|
1426 |
+
directory.data( 'searched', 1 );
|
1427 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1428 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1429 |
+
}
|
1430 |
+
}
|
1431 |
+
});
|
1432 |
+
|
1433 |
+
um_set_range_label( slider );
|
1434 |
+
});
|
1435 |
+
|
1436 |
+
|
1437 |
+
//datepicker filter
|
1438 |
+
directory.find('.um-datepicker-filter').each( function() {
|
1439 |
+
var elem = jQuery(this);
|
1440 |
+
|
1441 |
+
var min = new Date( elem.data('date_min')*1000 );
|
1442 |
+
var max = new Date( elem.data('date_max')*1000 );
|
1443 |
+
|
1444 |
+
var $input = elem.pickadate({
|
1445 |
+
selectYears: true,
|
1446 |
+
min: min,
|
1447 |
+
max: max,
|
1448 |
+
formatSubmit: 'yyyy/mm/dd',
|
1449 |
+
hiddenName: true,
|
1450 |
+
onOpen: function() {
|
1451 |
+
elem.blur();
|
1452 |
+
},
|
1453 |
+
onClose: function() {
|
1454 |
+
elem.blur();
|
1455 |
+
},
|
1456 |
+
onSet: function( context ) {
|
1457 |
+
|
1458 |
+
if ( ! context.select ) {
|
1459 |
+
return;
|
1460 |
+
}
|
1461 |
+
|
1462 |
+
var directory = elem.parents('.um-directory');
|
1463 |
+
|
1464 |
+
if ( um_is_directory_busy( directory ) ) {
|
1465 |
+
return;
|
1466 |
+
}
|
1467 |
+
|
1468 |
+
um_members_show_preloader( directory );
|
1469 |
+
|
1470 |
+
var filter_name = elem.data( 'filter_name' );
|
1471 |
+
var range = elem.data( 'range' );
|
1472 |
+
|
1473 |
+
var current_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1474 |
+
var current_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1475 |
+
if ( typeof current_value_from === "undefined" ) {
|
1476 |
+
current_value_from = min / 1000;
|
1477 |
+
}
|
1478 |
+
if ( typeof current_value_to === "undefined" ) {
|
1479 |
+
current_value_to = max / 1000;
|
1480 |
+
}
|
1481 |
+
|
1482 |
+
var select_val = context.select / 1000;
|
1483 |
+
var change_val = elem.val();
|
1484 |
+
|
1485 |
+
if ( range === 'from' ) {
|
1486 |
+
current_value_from = select_val;
|
1487 |
+
} else if ( range === 'to' ) {
|
1488 |
+
current_value_to = select_val;
|
1489 |
+
}
|
1490 |
+
|
1491 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', current_value_from );
|
1492 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', current_value_to );
|
1493 |
+
|
1494 |
+
//set 1st page after filtration
|
1495 |
+
directory.data( 'page', 1 );
|
1496 |
+
um_set_url_from_data( directory, 'page', '' );
|
1497 |
+
|
1498 |
+
um_ajax_get_members( directory );
|
1499 |
+
|
1500 |
+
um_change_tag( directory );
|
1501 |
+
|
1502 |
+
directory.data( 'searched', 1 );
|
1503 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1504 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1505 |
+
}
|
1506 |
+
});
|
1507 |
+
|
1508 |
+
var $picker = $input.pickadate('picker');
|
1509 |
+
var $fname = elem.data('filter_name');
|
1510 |
+
var $frange = elem.data('range');
|
1511 |
+
var $directory = elem.parents('.um-directory');
|
1512 |
+
|
1513 |
+
var query_value = um_get_data_for_directory( $directory, 'filter_' + $fname + '_' + $frange );
|
1514 |
+
if ( typeof query_value !== 'undefined' ) {
|
1515 |
+
$picker.set( 'select', query_value*1000 );
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
});
|
1519 |
+
|
1520 |
+
|
1521 |
+
//timepicker filter
|
1522 |
+
directory.find('.um-timepicker-filter').each( function() {
|
1523 |
+
var elem = jQuery(this);
|
1524 |
+
var elemID = elem.attr('id');
|
1525 |
+
var elem_filter_name = elem.data('filter_name');
|
1526 |
+
|
1527 |
+
//using arrays formatted as [HOUR,MINUTE]
|
1528 |
+
var min = elem.attr('data-min');
|
1529 |
+
var max = elem.attr('data-max');
|
1530 |
+
|
1531 |
+
var picker_min = min.split(':');
|
1532 |
+
var picker_max = max.split(':');
|
1533 |
+
|
1534 |
+
var $input = elem.pickatime({
|
1535 |
+
format: elem.data('format'),
|
1536 |
+
interval: parseInt( elem.data('intervals') ),
|
1537 |
+
min: [picker_min[0],picker_min[1]],
|
1538 |
+
max: [picker_max[0],picker_max[1]],
|
1539 |
+
formatSubmit: 'HH:i',
|
1540 |
+
hiddenName: true,
|
1541 |
+
onOpen: function() { elem.blur(); },
|
1542 |
+
onClose: function() { elem.blur(); },
|
1543 |
+
onSet: function( context ) {
|
1544 |
+
|
1545 |
+
if ( ! context.select ) {
|
1546 |
+
return;
|
1547 |
+
}
|
1548 |
+
|
1549 |
+
var directory = elem.parents('.um-directory');
|
1550 |
+
|
1551 |
+
if ( um_is_directory_busy( directory ) ) {
|
1552 |
+
return;
|
1553 |
+
}
|
1554 |
+
|
1555 |
+
um_members_show_preloader( directory );
|
1556 |
+
|
1557 |
+
var filter_name = elem.data( 'filter_name' );
|
1558 |
+
var range = elem.data( 'range' );
|
1559 |
+
|
1560 |
+
var current_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1561 |
+
var current_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1562 |
+
if ( typeof current_value_from === "undefined" ) {
|
1563 |
+
current_value_from = min;
|
1564 |
+
}
|
1565 |
+
if ( typeof current_value_to === "undefined" ) {
|
1566 |
+
current_value_to = max;
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
if ( typeof context.select !== 'undefined' ) {
|
1570 |
+
var select_val = um_time_convert( context.select, range );
|
1571 |
+
|
1572 |
+
//var select_val = context.select / 60;
|
1573 |
+
|
1574 |
+
if ( range === 'from' ) {
|
1575 |
+
current_value_from = select_val;
|
1576 |
+
} else if ( range === 'to' ) {
|
1577 |
+
current_value_to = select_val;
|
1578 |
+
}
|
1579 |
+
} else {
|
1580 |
+
if ( range === 'from' ) {
|
1581 |
+
current_value_from = min;
|
1582 |
+
} else if ( range === 'to' ) {
|
1583 |
+
current_value_to = max;
|
1584 |
+
}
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
var time = jQuery( '#' + elemID ).val();
|
1588 |
+
|
1589 |
+
if ( elem.data('range') === 'from' ) {
|
1590 |
+
jQuery( '#' + elem_filter_name + '_to' ).pickatime('picker').set('min', time);
|
1591 |
+
} else {
|
1592 |
+
jQuery( '#' + elem_filter_name + '_from').pickatime('picker').set('max', time);
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', current_value_from );
|
1596 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', current_value_to );
|
1597 |
+
|
1598 |
+
//set 1st page after filtration
|
1599 |
+
directory.data( 'page', 1 );
|
1600 |
+
um_set_url_from_data( directory, 'page', '' );
|
1601 |
+
|
1602 |
+
um_ajax_get_members( directory );
|
1603 |
+
|
1604 |
+
um_change_tag( directory );
|
1605 |
+
|
1606 |
+
directory.data( 'searched', 1 );
|
1607 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1608 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1609 |
+
|
1610 |
+
}
|
1611 |
+
});
|
1612 |
+
|
1613 |
+
// first loading timepicker select
|
1614 |
+
var $picker = $input.pickatime('picker');
|
1615 |
+
var $fname = elem.data('filter_name');
|
1616 |
+
var $frange = elem.data('range');
|
1617 |
+
var $directory = elem.parents('.um-directory');
|
1618 |
+
|
1619 |
+
var query_value = um_get_data_for_directory( $directory, 'filter_' + $fname + '_' + $frange );
|
1620 |
+
if ( typeof query_value !== 'undefined' ) {
|
1621 |
+
var arr = query_value.split(':');
|
1622 |
+
$picker.set( 'select', arr[0]*60 + arr[1]*1 );
|
1623 |
+
}
|
1624 |
+
|
1625 |
+
});
|
1626 |
+
|
1627 |
+
wp.hooks.doAction( 'um_member_directory_on_init', directory, hash );
|
1628 |
+
|
1629 |
+
var ignore_after_search = false;
|
1630 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1631 |
+
|
1632 |
+
if ( ! ignore_after_search ) {
|
1633 |
+
var show_after_search = directory.data('must-search');
|
1634 |
+
if ( show_after_search === 1 ) {
|
1635 |
+
var search = um_get_search( directory );
|
1636 |
+
var filters_data = um_get_filters_data( directory );
|
1637 |
+
if ( ! filters_data.length && ! search ) {
|
1638 |
+
return;
|
1639 |
+
}
|
1640 |
+
}
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
var prevent_default = wp.hooks.applyFilters( 'um_member_directory_prevent_default_first_loading', false, directory, hash );
|
1644 |
+
|
1645 |
+
if ( ! prevent_default ) {
|
1646 |
+
um_members_show_preloader( directory );
|
1647 |
+
um_ajax_get_members( directory, {first_load:true} );
|
1648 |
+
um_change_tag( directory );
|
1649 |
+
}
|
1650 |
+
});
|
1651 |
+
|
1652 |
+
|
1653 |
+
//history events when back/forward and change window.location.hash
|
1654 |
+
window.addEventListener( "popstate", function(e) {
|
1655 |
+
jQuery( '.um-directory' ).each( function() {
|
1656 |
+
var directory = jQuery(this);
|
1657 |
+
var hash = um_members_get_hash( directory );
|
1658 |
+
um_member_directories.push( hash );
|
1659 |
+
|
1660 |
+
um_members_show_preloader( directory );
|
1661 |
+
|
1662 |
+
// clear layout and header
|
1663 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
1664 |
+
|
1665 |
+
// set search from history
|
1666 |
+
if ( directory.find( '.um-member-directory-search-line' ).length ) {
|
1667 |
+
var search = um_get_data_for_directory( directory, 'search' );
|
1668 |
+
if ( typeof search == 'undefined' ) {
|
1669 |
+
search = '';
|
1670 |
+
}
|
1671 |
+
directory.data( 'general_search', search );
|
1672 |
+
directory.find('.um-search-line').val( search );
|
1673 |
+
}
|
1674 |
+
|
1675 |
+
var page = um_get_data_for_directory( directory, 'page' );
|
1676 |
+
if ( typeof page == 'undefined' ) {
|
1677 |
+
page = 1;
|
1678 |
+
} else if ( page > directory.data( 'total_pages' ) ) {
|
1679 |
+
page = directory.data( 'total_pages' );
|
1680 |
+
}
|
1681 |
+
|
1682 |
+
directory.data( 'page', page ).attr( 'data-page', page );
|
1683 |
+
|
1684 |
+
//sorting from history
|
1685 |
+
if ( directory.find( '.um-member-directory-sorting' ).length ) {
|
1686 |
+
var sort = um_get_data_for_directory( directory, 'sort' );
|
1687 |
+
if ( typeof sort == 'undefined' ) {
|
1688 |
+
sort = directory.find( '.um-new-dropdown[data-element=".um-member-directory-sorting-a"]' ).find('a[data-default="1"]').data('value');
|
1689 |
+
}
|
1690 |
+
directory.data( 'sorting', sort );
|
1691 |
+
|
1692 |
+
var sort_dropdown = directory.find( '.um-new-dropdown[data-element=".um-member-directory-sorting-a"]' );
|
1693 |
+
sort_dropdown.find('a').data('selected', 0).prop('data-selected', 0).attr('data-selected', 0);
|
1694 |
+
sort_dropdown.find('a[data-value="' + sort + '"]').data('selected', 1).prop('data-selected', 1).attr('data-selected', 1);
|
1695 |
+
directory.find('.um-member-directory-sorting-a').find('> a').html( sort_dropdown.find('a[data-value="' + sort + '"]').html() );
|
1696 |
+
}
|
1697 |
+
|
1698 |
+
//view type from history
|
1699 |
+
if ( directory.find( '.um-member-directory-view-type' ).length ) {
|
1700 |
+
var layout = um_get_data_for_directory( directory, 'view_type' );
|
1701 |
+
if ( typeof layout == 'undefined' ) {
|
1702 |
+
layout = directory.find( '.um-member-directory-view-type-a[data-default="1"]' ).data('type');
|
1703 |
+
}
|
1704 |
+
directory.data( 'view_type', layout );
|
1705 |
+
|
1706 |
+
directory.find('.um-member-directory-view-type .um-member-directory-view-type-a').hide();
|
1707 |
+
directory.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="' + layout + '"]').show();
|
1708 |
+
}
|
1709 |
+
|
1710 |
+
//datepicker filter
|
1711 |
+
directory.find('.um-datepicker-filter').each( function() {
|
1712 |
+
var elem = jQuery(this);
|
1713 |
+
|
1714 |
+
var $picker = elem.pickadate('picker');
|
1715 |
+
var $fname = elem.data('filter_name');
|
1716 |
+
var $frange = elem.data('range');
|
1717 |
+
|
1718 |
+
var query_value = um_get_data_for_directory( directory, 'filter_' + $fname + '_' + $frange );
|
1719 |
+
if ( typeof query_value !== 'undefined' ) {
|
1720 |
+
$picker.set( 'select', query_value*1000 );
|
1721 |
+
} else {
|
1722 |
+
$picker.clear();
|
1723 |
+
}
|
1724 |
+
});
|
1725 |
+
|
1726 |
+
directory.find('.um-slider').each( function() {
|
1727 |
+
var slider = jQuery( this );
|
1728 |
+
var filter_name = slider.data('field_name');
|
1729 |
+
|
1730 |
+
var min_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1731 |
+
var max_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1732 |
+
if ( typeof min_default_value == 'undefined' ) {
|
1733 |
+
min_default_value = slider.data('min');
|
1734 |
+
}
|
1735 |
+
min_default_value = parseInt( min_default_value );
|
1736 |
+
|
1737 |
+
if ( typeof max_default_value == 'undefined' ) {
|
1738 |
+
max_default_value = slider.data('max');
|
1739 |
+
}
|
1740 |
+
max_default_value = parseInt( max_default_value );
|
1741 |
+
|
1742 |
+
slider.slider( 'values', [min_default_value, max_default_value] );
|
1743 |
+
um_set_range_label( slider );
|
1744 |
+
});
|
1745 |
+
|
1746 |
+
//timepicker filter
|
1747 |
+
directory.find('.um-timepicker-filter').each( function() {
|
1748 |
+
var elem = jQuery(this);
|
1749 |
+
|
1750 |
+
var $picker = elem.pickatime('picker');
|
1751 |
+
var $fname = elem.data('filter_name');
|
1752 |
+
var $frange = elem.data('range');
|
1753 |
+
|
1754 |
+
var query_value = um_get_data_for_directory( directory, 'filter_' + $fname + '_' + $frange );
|
1755 |
+
if ( typeof query_value !== 'undefined' ) {
|
1756 |
+
var arr = query_value.split(':');
|
1757 |
+
$picker.set( 'select', arr[0]*60 );
|
1758 |
+
} else {
|
1759 |
+
$picker.clear();
|
1760 |
+
}
|
1761 |
+
});
|
1762 |
+
|
1763 |
+
var ignore_after_search = false;
|
1764 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1765 |
+
|
1766 |
+
if ( ! ignore_after_search ) {
|
1767 |
+
var show_after_search = directory.data('must-search');
|
1768 |
+
if ( show_after_search === 1 ) {
|
1769 |
+
var search = um_get_search( directory );
|
1770 |
+
var filters_data = um_get_filters_data( directory );
|
1771 |
+
if ( ! filters_data.length && ! search ) {
|
1772 |
+
directory.data( 'searched', 0 );
|
1773 |
+
um_members_hide_preloader( directory );
|
1774 |
+
return;
|
1775 |
+
} else {
|
1776 |
+
directory.data( 'searched', 1 );
|
1777 |
+
}
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
|
1781 |
+
var prevent_default = wp.hooks.applyFilters( 'um_member_directory_prevent_default_first_loading', false, directory, hash );
|
1782 |
+
|
1783 |
+
if ( ! prevent_default ) {
|
1784 |
+
um_ajax_get_members( directory );
|
1785 |
+
um_change_tag( directory );
|
1786 |
+
}
|
1787 |
+
});
|
1788 |
+
});
|
1789 |
+
|
1790 |
+
});
|
assets/js/um-members.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var t={},a=window.location.search.substring(1).split("&");return jQuery.each(a,function(e){var r=a[e].split("=");t[r[0]]=r[1]}),t}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={};Array.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r=um_member_directories[e];if(r!==a){var t=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+r+'"]'));jQuery.each(t,function(e){m[e+"_"+r]=t[e]})}});var d=[];jQuery.each(m,function(e){d.push(e+"="+m[e])});var s="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===s&&(s=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+s)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){var r=um_members_get_hash(e);return void 0!==um_members_directory_busy[r]&&um_members_directory_busy[r]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t="",a=e.siblings(".um-slider-range").data("placeholder-s"),i=e.siblings(".um-slider-range").data("placeholder-p");t=r?r.values[0]===r.values[1]?a.replace("{value}",r.values[0]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):i.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):e.slider("values",0)===e.slider("values",1)?a.replace("{value}",e.slider("values",0)).replace("{field_label}",e.siblings(".um-slider-range").data("label")):i.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1)).replace("{field_label}",e.siblings(".um-slider-range").data("label")),e.siblings(".um-slider-range").html(t),e.siblings(".um_range_min").val(e.slider("values",0)),e.siblings(".um_range_max").val(e.slider("values",1))}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){var r=e.data("page");return r&&void 0!==r||(r=1),r}function um_time_convert(e,r){var t=Math.floor(e/60),a=e%60;return 60<=a&&(a=0,24<=(t+=1)&&(t=0)),a<10&&(a="0"+a),t+":"+a}function um_ajax_get_members(u,e){var t=um_members_get_hash(u);if(wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,t,u)){var r=um_get_current_page(u),a=um_get_search(u),i=um_get_sort(u),m=-(new Date).getTimezoneOffset()/60,_={directory_id:t,page:r,search:a,sorting:i,gmt_offset:m,post_refferer:u.data("base-post"),nonce:um_scripts.nonce};u.find(".um-search-filter").length&&u.find(".um-search-filter").each(function(){var e=jQuery(this);if(e.find(".um-slider").length){var r=e.find(".um-slider").data("field_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-datepicker-filter").length){r=e.find(".um-datepicker-filter").data("filter_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-timepicker-filter").length){r=e.find(".um-timepicker-filter").data("filter_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");if(void 0!==t)(i=1*(t=t.split(":"))[0])<10&&(i="0"+i),(d=1*t[1])<10&&(d="0"+d),t=i+":"+d+":00";if(void 0!==a){var i,m=a.split(":"),d=1*m[1];(i=1*m[0])<10&&(i="0"+i),d<10&&(d="0"+d),a=i+":"+d+":59"}void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find("select").length){r=e.find("select").attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s.split("||"))}else if(e.hasClass("um-text-filter-type")&&e.find('input[type="text"]').length){var s;r=e.find('input[type="text"]').attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s)}else _=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",_,e,u)}),_=wp.hooks.applyFilters("um_member_directory_filter_request",_),wp.ajax.send("um_get_members",{data:_,success:function(e){um_member_directory_last_data[t]=e,um_build_template(u,e);var r=wp.template("um-members-pagination");u.find(".um-members-pagination-box").html(r(e)),u.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(u.find(".um-member-directory-sorting-options").prop("disabled",!1),u.find(".um-member-directory-view-type").removeClass("um-disabled")):(u.find(".um-member-directory-sorting-options").prop("disabled",!0),u.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",u,e),um_init_new_dropdown(),um_members_hide_preloader(u)},error:function(e){console.log(e),um_members_hide_preloader(u)}})}else setTimeout(um_ajax_get_members,600,u,e)}function um_build_template(e,r){var t=e.data("view_type"),a=wp.template("um-member-"+t+"-"+um_members_get_hash(e));e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(a(r.users));var i=wp.template("um-members-header");e.find(".um-members-intro").remove();var m=wp.hooks.applyFilters("um_member_directory_generate_header",!1,e);(void 0!==r.is_search&&r.is_search||m)&&e.find(".um-members-wrapper").prepend(i(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(u){var _=[];return u.find(".um-search-filter").each(function(){var t,a,d,i=jQuery(this);if(i.find("input.um-datepicker-filter").length)d="datepicker",i.find("input.um-datepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("input.um-timepicker-filter").length)d="timepicker",i.find("input.um-timepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("select").length){d="select",t=i.find("select").attr("name"),a=i.find("select").data("placeholder"),m=void 0===(m=um_get_data_for_directory(u,"filter_"+t))?[]:(m=um_unsanitize_value(m)).split("||"),jQuery.each(m,function(e){var r=i.find('select option[value="'+m[e]+'"]').data("value_label");_.push({name:t,label:a,value_label:r,value:m[e],type:d})})}else if(i.hasClass("um-text-filter-type")&&i.find('input[type="text"]').length){var m;d="text",t=i.find('input[type="text"]').attr("name"),a=i.find('input[type="text"]').attr("placeholder"),void 0===(m=um_get_data_for_directory(u,"filter_"+t))&&(m=""),""!=m&&_.push({name:t,label:a,value_label:m,value:m,type:d})}else if(i.find("div.ui-slider").length){d="slider",t=i.find("div.ui-slider").data("field_name");var e,r=um_get_data_for_directory(u,"filter_"+t+"_from"),s=um_get_data_for_directory(u,"filter_"+t+"_to");if(void 0===r&&void 0===s)return;e=r===s?i.find("div.um-slider-range").data("placeholder-s").replace("{value}",r).replace("{field_label}",i.find("div.um-slider-range").data("label")):i.find("div.um-slider-range").data("placeholder-p").replace("{min_range}",r).replace("{max_range}",s).replace("{field_label}",i.find("div.um-slider-range").data("label")),a=i.find("div.um-slider-range").data("label"),_.push({name:t,label:a,value_label:e,value:[r,s],type:d})}else _=wp.hooks.applyFilters("um_member_directory_get_filter_data",_,u,i)}),_}function um_change_tag(e){var r=um_get_filters_data(e);e.find(".um-members-filter-tag").remove();var t=e.find(".um-filtered-line");if(t.length){var a=wp.template("um-members-filtered-line");t.prepend(a({filters:r})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"))}}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");var a=!1;if(!(a=wp.hooks.applyFilters("um_member_directory_ignore_after_search",a,e)))if(1===e.data("must-search")&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length&&!t))return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e);e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){if(!jQuery(this).hasClass("um-disabled")){var e=jQuery(this).find(".um-member-directory-view-type-a:visible");e.hide(),e.next().length?e.next().show().tipsy("show"):jQuery(this).find(".um-member-directory-view-type-a:first").show().tipsy("show")}}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r=jQuery(this),t=r.parents(".um-member-directory-view-type");if(!t.hasClass("um-disabled")){um_members_show_preloader(e);var a=t.find(".um-member-directory-view-type-a:visible");a.hide(),a.next().length?a.next().show().tipsy("show"):t.find(".um-member-directory-view-type-a:first").show().tipsy("show");var i=um_member_directory_last_data[um_members_get_hash(e)];if(null!==i){var m=r.data("type");um_set_url_from_data(e,"view_type",m),e.data("view_type",m),um_build_template(e,i),um_init_new_dropdown()}um_members_hide_preloader(e)}}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",'.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){if(1!==jQuery(this).data("selected")){var e=jQuery(this).data("directory-hash"),r=jQuery('.um-directory[data-hash="'+e+'"]');if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).html(),a=jQuery(this).data("value");r.data("sorting",a),um_set_url_from_data(r,"sort",a),um_ajax_get_members(r),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+a+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),r.find(".um-member-directory-sorting-a").find("> a").html(t)}}}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){if(!jQuery(this).hasClass("disabled")){var e,r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r))um_members_show_preloader(r),1===(e="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?1*r.data("page")-1:"next"===jQuery(this).data("page")?1*r.data("page")+1:"last"===jQuery(this).data("page")?parseInt(r.data("total_pages")):parseInt(jQuery(this).data("page")))?(r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(e===parseInt(r.data("total_pages"))?r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r)}}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).val();e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-more").hide(),r.find(".um-member-meta-main").slideDown(),r.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-less").hide(),r.find(".um-member-meta-main").slideUp(),r.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(t)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(t)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").on("click",function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){var e=jQuery(this).val(),r=um_sanitize_value(e);if(""!==r){var t=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(t)){um_members_show_preloader(t);var a=jQuery(this).prop("name"),i=um_get_data_for_directory(t,"filter_"+a);i=void 0===i?[]:i.split("||"),-1===jQuery.inArray(r,i)&&(i.push(r),um_set_url_from_data(t,"filter_"+a,i=i.join("||")),t.data("page",1),um_set_url_from_data(t,"page","")),jQuery(this).find('option[value="'+e+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var m=jQuery(this);m.select2("destroy").select2({dropdownParent:m.parent()}),m.val("").trigger("change"),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled")}}}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){var r=um_sanitize_value(jQuery(this).val()),t=jQuery(this).prop("name"),a=um_get_data_for_directory(e,"filter_"+t);void 0===a&&(a=""),r!==a&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){if(13===e.which){var r=jQuery(this).parents(".um-directory");if(um_is_directory_busy(r))return;var t=um_sanitize_value(jQuery(this).val()),a=jQuery(this).prop("name"),i=um_get_data_for_directory(r,"filter_"+a);if(void 0===i&&(i=""),t===i)return;um_members_show_preloader(r),um_set_url_from_data(r,"filter_"+a,t),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type");if("text"===a)um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("");else if("select"===a){var i=um_get_data_for_directory(e,"filter_"+t);i=void 0===i?[]:(i=um_unsanitize_value(i)).split("||"),-1!==jQuery.inArray(r.toString(),i)&&(i=jQuery.grep(i,function(e){return e!==r.toString()})),i.length||(i=""),um_set_url_from_data(e,"filter_"+t,i);var m=jQuery('.um-search-filter select[name="'+t+'"]');m.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<m.find("option:not(:disabled)").length&&m.prop("disabled",!1),m.select2("destroy").select2({dropdownParent:m.parent()}),0<e.find('.um-search-filter select[data-um-parent="'+t+'"]').length&&m.trigger("change")}else if("slider"===a){um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to","");var d=jQuery(".um-search-filter #"+t+"_min").siblings(".um-slider"),s=d.slider("option");d.slider("values",[s.min,s.max]),jQuery(".um-search-filter #"+t+"_min").val(""),jQuery(".um-search-filter #"+t+"_max").val(""),um_set_range_label(d)}else"datepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):"timepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):wp.hooks.doAction("um_member_directory_filter_remove",a,e,t,r);e.data("page",1),um_set_url_from_data(e,"page",""),jQuery(this).tipsy("hide"),jQuery(this).parents(".um-members-filter-tag").remove(),0===e.find(".um-members-filter-remove").length?e.find(".um-clear-filters").hide():e.find(".um-clear-filters").show();var u=!1;if(!(u=wp.hooks.applyFilters("um_member_directory_ignore_after_search",u,e)))if(1===e.data("must-search")){var _=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!_)return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e)}e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-clear-filters-a",function(){var s=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(s)){um_members_show_preloader(s),s.find(".um-members-filter-remove").each(function(){var r=jQuery(this).data("value"),e=jQuery(this).data("name"),t=jQuery(this).data("type");if("text"===t)um_set_url_from_data(s,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(s,"filter_"+e);a=void 0===a?[]:a.split("||"),-1!==jQuery.inArray(r.toString(),a)&&(a=jQuery.grep(a,function(e){return e!==r.toString()})),a.length||(a=""),um_set_url_from_data(s,"filter_"+e,a);var i=jQuery('.um-search-filter select[name="'+e+'"]');i.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<i.find("option:not(:disabled)").length&&i.prop("disabled",!1),i.select2("destroy").select2({dropdownParent:i.parent()}),0<s.find('.um-search-filter select[data-um-parent="'+e+'"]').length&&i.trigger("change")}else if("slider"===t){um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to","");var m=jQuery(".um-search-filter #"+e+"_min").siblings(".um-slider"),d=m.slider("option");m.slider("values",[d.min,d.max]),jQuery(".um-search-filter #"+e+"_min").val(""),jQuery(".um-search-filter #"+e+"_max").val(""),um_set_range_label(m)}else"datepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):"timepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):wp.hooks.doAction("um_member_directory_clear_filters",t,s,e,r)}),s.data("page",1),um_set_url_from_data(s,"page",""),s.find(".um-members-filter-tag").remove(),0===s.find(".um-members-filter-remove").length?(s.find(".um-clear-filters").hide(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(s.find(".um-clear-filters").show(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"));var e=!1;if(!(e=wp.hooks.applyFilters("um_member_directory_ignore_after_search",e,s)))if(1===s.data("must-search"))if(!um_get_search(s))return s.data("searched",0),s.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",s),void um_members_hide_preloader(s);s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(s)}}),wp.hooks.doAction("um_member_directory_on_first_pages_loading"),jQuery(".um-directory").each(function(){var e=jQuery(this),r=um_members_get_hash(e);um_member_directories.push(r),e.find(".um-search").length&&(e.find(".um-search").is(":visible")||e.find(".um-search").css({display:"grid"}).slideUp(1)),e.find(".um-slider").each(function(){var e=jQuery(this),t=e.parents(".um-directory"),a=e.data("field_name"),r=um_get_data_for_directory(t,"filter_"+a+"_from"),i=um_get_data_for_directory(t,"filter_"+a+"_to");void 0===r&&(r=parseInt(e.data("min"))),void 0===i&&(i=parseInt(e.data("max")));var m=[r,i];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:m,create:function(e,r){},step:1,slide:function(e,r){um_set_range_label(jQuery(this),r)},stop:function(e,r){um_is_directory_busy(t)||(um_members_show_preloader(t),um_set_url_from_data(t,"filter_"+a+"_from",r.values[0]),um_set_url_from_data(t,"filter_"+a+"_to",r.values[1]),t.data("page",1),um_set_url_from_data(t,"page",""),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),um_set_range_label(e)}),e.find(".um-datepicker-filter").each(function(){var s=jQuery(this),u=new Date(1e3*s.data("date_min")),_=new Date(1e3*s.data("date_max")),e=s.pickadate({selectYears:!0,min:u,max:_,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){s.blur()},onClose:function(){s.blur()},onSet:function(e){if(e.select){var r=s.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=s.data("filter_name"),a=s.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");void 0===i&&(i=u/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;s.val();"from"===a?i=d:"to"===a&&(m=d),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickadate("picker"),r=s.data("filter_name"),t=s.data("range"),a=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var u=jQuery(this),_=u.attr("id"),o=u.data("filter_name"),n=u.attr("data-min"),l=u.attr("data-max"),e=n.split(":"),r=l.split(":"),t=u.pickatime({format:u.data("format"),interval:parseInt(u.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){u.blur()},onClose:function(){u.blur()},onSet:function(e){if(e.select){var r=u.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=u.data("filter_name"),a=u.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");if(void 0===i&&(i=n),void 0===m&&(m=l),void 0!==e.select){var d=um_time_convert(e.select,a);"from"===a?i=d:"to"===a&&(m=d)}else"from"===a?i=n:"to"===a&&(m=l);var s=jQuery("#"+_).val();"from"===u.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",s):jQuery("#"+o+"_from").pickatime("picker").set("max",s),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickatime("picker"),a=u.data("filter_name"),i=u.data("range"),m=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}}),wp.hooks.doAction("um_member_directory_on_init",e,r);var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t,e))&&1===e.data("must-search")){var a=um_get_search(e);if(!um_get_filters_data(e).length&&!a)return}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,e,r)||(um_members_show_preloader(e),um_ajax_get_members(e,{first_load:!0}),um_change_tag(e))}),window.addEventListener("popstate",function(e){jQuery(".um-directory").each(function(){var d=jQuery(this),e=um_members_get_hash(d);(um_member_directories.push(e),um_members_show_preloader(d),d.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),d.find(".um-member-directory-search-line").length)&&(void 0===(s=um_get_data_for_directory(d,"search"))&&(s=""),d.data("general_search",s),d.find(".um-search-line").val(s));var r=um_get_data_for_directory(d,"page");if(void 0===r?r=1:r>d.data("total_pages")&&(r=d.data("total_pages")),d.data("page",r).attr("data-page",r),d.find(".um-member-directory-sorting").length){var t=um_get_data_for_directory(d,"sort");void 0===t&&(t=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),d.data("sorting",t);var a=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]');a.find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),a.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),d.find(".um-member-directory-sorting-a").find("> a").html(a.find('a[data-value="'+t+'"]').html())}if(d.find(".um-member-directory-view-type").length){var i=um_get_data_for_directory(d,"view_type");void 0===i&&(i=d.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),d.data("view_type",i),d.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),d.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+i+'"]').show()}d.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);void 0!==i?r.set("select",1e3*i):r.clear()}),d.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(d,"filter_"+r+"_from"),a=um_get_data_for_directory(d,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===a&&(a=e.data("max")),a=parseInt(a),e.slider("values",[t,a]),um_set_range_label(e)}),d.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);if(void 0!==i){var m=i.split(":");r.set("select",60*m[0])}else r.clear()});var m=!1;if(!(m=wp.hooks.applyFilters("um_member_directory_ignore_after_search",m,d))&&1===d.data("must-search")){var s=um_get_search(d);if(!um_get_filters_data(d).length&&!s)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,d,e)||(um_ajax_get_members(d),um_change_tag(d))})})});
|
1 |
+
var um_members_directory_busy=[],um_member_directories=[],um_member_directory_last_data=[];function um_parse_current_url(){var t={},a=window.location.search.substring(1).split("&");return jQuery.each(a,function(e){var r=a[e].split("=");t[r[0]]=r[1]}),t}function um_get_data_for_directory(e,r){var t=um_members_get_hash(e),a={},i=um_parse_current_url();if(jQuery.each(i,function(e){-1!==e.indexOf("_"+t)&&""!==i[e]&&(a[e.replace("_"+t,"")]=i[e])}),r){if(void 0!==a[r])try{a[r]=decodeURIComponent(a[r])}catch(e){console.error(e)}return a[r]}return a}function um_set_url_from_data(e,r,t){var a=um_members_get_hash(e),i=um_get_data_for_directory(e),m={};Array.isArray(t)?(jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")):jQuery.isNumeric(t)||(t=t.split("||"),jQuery.each(t,function(e){t[e]=encodeURIComponent(t[e])}),t=t.join("||")),""!==t&&(m[r+"_"+a]=t),jQuery.each(i,function(e){r===e?""!==t&&(m[e+"_"+a]=t):m[e+"_"+a]=i[e]}),jQuery.each(um_member_directories,function(e){var r=um_member_directories[e];if(r!==a){var t=um_get_data_for_directory(jQuery('.um-directory[data-hash="'+r+'"]'));jQuery.each(t,function(e){m[e+"_"+r]=t[e]})}});var d=[];jQuery.each(m,function(e){d.push(e+"="+m[e])});var s="?"+(d=wp.hooks.applyFilters("um_member_directory_url_attrs",d)).join("&");"?"===s&&(s=""),window.history.pushState("string","UM Member Directory",window.location.origin+window.location.pathname+s)}function um_members_get_hash(e){return e.data("hash")}function um_is_directory_busy(e){var r=um_members_get_hash(e);return void 0!==um_members_directory_busy[r]&&um_members_directory_busy[r]}function um_members_show_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!0,e.find(".um-members-overlay").show()}function um_members_hide_preloader(e){um_members_directory_busy[um_members_get_hash(e)]=!1,e.find(".um-members-overlay").hide()}function um_set_range_label(e,r){var t,a,i="",m=e.siblings(".um-slider-range").data("placeholder-s"),d=e.siblings(".um-slider-range").data("placeholder-p");a=r?(i=r.values[0]===r.values[1]?m.replace("{value}",r.values[0]).replace("{field_label}",e.siblings(".um-slider-range").data("label")):d.replace("{min_range}",r.values[0]).replace("{max_range}",r.values[1]).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=r.values[0],r.values[1]):(i=e.slider("values",0)===e.slider("values",1)?m.replace("{value}",e.slider("values",0)).replace("{field_label}",e.siblings(".um-slider-range").data("label")):d.replace("{min_range}",e.slider("values",0)).replace("{max_range}",e.slider("values",1)).replace("{field_label}",e.siblings(".um-slider-range").data("label")),t=e.slider("values",0),e.slider("values",1)),e.siblings(".um-slider-range").html(i),e.siblings(".um_range_min").val(t),e.siblings(".um_range_max").val(a)}function um_get_search(e){return e.find(".um-search-line").length?e.find(".um-search-line").val():""}function um_get_sort(e){return e.data("sorting")}function um_get_current_page(e){var r=e.data("page");return r&&void 0!==r||(r=1),r}function um_time_convert(e,r){var t=Math.floor(e/60),a=e%60;return 60<=a&&(a=0,24<=(t+=1)&&(t=0)),a<10&&(a="0"+a),t+":"+a}function um_ajax_get_members(u,e){var t=um_members_get_hash(u);if(wp.hooks.applyFilters("um_member_directory_get_members_allow",!0,t,u)){var r=um_get_current_page(u),a=um_get_search(u),i=um_get_sort(u),m=-(new Date).getTimezoneOffset()/60,_={directory_id:t,page:r,search:a,sorting:i,gmt_offset:m,post_refferer:u.data("base-post"),nonce:um_scripts.nonce};u.find(".um-search-filter").length&&u.find(".um-search-filter").each(function(){var e=jQuery(this);if(e.find(".um-slider").length){var r=e.find(".um-slider").data("field_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-datepicker-filter").length){r=e.find(".um-datepicker-filter").data("filter_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find(".um-timepicker-filter").length){r=e.find(".um-timepicker-filter").data("filter_name"),t=um_get_data_for_directory(u,"filter_"+r+"_from"),a=um_get_data_for_directory(u,"filter_"+r+"_to");if(void 0!==t)(i=1*(t=t.split(":"))[0])<10&&(i="0"+i),(d=1*t[1])<10&&(d="0"+d),t=i+":"+d+":00";if(void 0!==a){var i,m=a.split(":"),d=1*m[1];(i=1*m[0])<10&&(i="0"+i),d<10&&(d="0"+d),a=i+":"+d+":59"}void 0===t&&void 0===a||(_[r]=[t,a])}else if(e.find("select").length){r=e.find("select").attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s.split("||"))}else if(e.hasClass("um-text-filter-type")&&e.find('input[type="text"]').length){var s;r=e.find('input[type="text"]').attr("name");void 0!==(s=um_get_data_for_directory(u,"filter_"+r))&&(s=um_unsanitize_value(s),_[r]=s)}else _=wp.hooks.applyFilters("um_member_directory_custom_filter_handler",_,e,u)}),_=wp.hooks.applyFilters("um_member_directory_filter_request",_),wp.ajax.send("um_get_members",{data:_,success:function(e){um_member_directory_last_data[t]=e,um_build_template(u,e);var r=wp.template("um-members-pagination");u.find(".um-members-pagination-box").html(r(e)),u.data("total_pages",e.pagination.total_pages),e.pagination.total_pages?(u.find(".um-member-directory-sorting-options").prop("disabled",!1),u.find(".um-member-directory-view-type").removeClass("um-disabled")):(u.find(".um-member-directory-sorting-options").prop("disabled",!0),u.find(".um-member-directory-view-type").addClass("um-disabled")),wp.hooks.doAction("um_member_directory_loaded",u,e),um_init_new_dropdown(),um_members_hide_preloader(u)},error:function(e){console.log(e),um_members_hide_preloader(u)}})}else setTimeout(um_ajax_get_members,600,u,e)}function um_build_template(e,r){var t=e.data("view_type"),a=wp.template("um-member-"+t+"-"+um_members_get_hash(e));e.find(".um-members-grid, .um-members-list").remove(),e.find(".um-members-wrapper").prepend(a(r.users));var i=wp.template("um-members-header");e.find(".um-members-intro").remove();var m=wp.hooks.applyFilters("um_member_directory_generate_header",!1,e);(void 0!==r.is_search&&r.is_search||m)&&e.find(".um-members-wrapper").prepend(i(r)),e.addClass("um-loaded"),e.find(".um-members.um-members-grid").length&&UM_Member_Grid(e.find(".um-members.um-members-grid")),jQuery(document).trigger("um_build_template",[e,r]),jQuery(window).trigger("resize"),init_tipsy()}function UM_Member_Grid(r){r.find(".um-member").length&&r.imagesLoaded(function(){var e=wp.hooks.applyFilters("um_member_directory_grid_masonry_attrs",{itemSelector:".um-member",columnWidth:".um-member",gutter:".um-gutter-sizer"},r);r.masonry(e).on("layoutComplete",function(e,r){jQuery(document).trigger("um_grid_initialized",[e,r])})})}function um_get_filters_data(u){var _=[];return u.find(".um-search-filter").each(function(){var t,a,d,i=jQuery(this);if(i.find("input.um-datepicker-filter").length)d="datepicker",i.find("input.um-datepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.find('input.um-datepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("input.um-timepicker-filter").length)d="timepicker",i.find("input.um-timepicker-filter").each(function(){if("to"!==jQuery(this).data("range")){var e=jQuery(this).data("filter_name"),r=um_get_data_for_directory(u,"filter_"+e+"_from"),t=um_get_data_for_directory(u,"filter_"+e+"_to");if(void 0!==r||void 0!==t){var a,i=jQuery(this).val(),m=u.find('input.um-timepicker-filter[data-range="to"][data-filter_name="'+e+'"]').val();i===m?a=m:""!==i&&""!==m?a=i+" - "+m:""===i?a="before "+m:""===m&&(a="since "+i),_.push({name:e,label:jQuery(this).data("filter-label"),value_label:a,value:[r,t],type:d})}}});else if(i.find("select").length){d="select",t=i.find("select").attr("name"),a=i.find("select").data("placeholder"),m=void 0===(m=um_get_data_for_directory(u,"filter_"+t))?[]:(m=um_unsanitize_value(m)).split("||"),jQuery.each(m,function(e){var r=i.find('select option[value="'+m[e]+'"]').data("value_label");_.push({name:t,label:a,value_label:r,value:m[e],type:d})})}else if(i.hasClass("um-text-filter-type")&&i.find('input[type="text"]').length){var m;d="text",t=i.find('input[type="text"]').attr("name"),a=i.find('input[type="text"]').attr("placeholder"),void 0===(m=um_get_data_for_directory(u,"filter_"+t))&&(m=""),""!=m&&_.push({name:t,label:a,value_label:m,value:m,type:d})}else if(i.find("div.ui-slider").length){d="slider",t=i.find("div.ui-slider").data("field_name");var e,r=um_get_data_for_directory(u,"filter_"+t+"_from"),s=um_get_data_for_directory(u,"filter_"+t+"_to");if(void 0===r&&void 0===s)return;e=r===s?i.find("div.um-slider-range").data("placeholder-s").replace("{value}",r).replace("{field_label}",i.find("div.um-slider-range").data("label")):i.find("div.um-slider-range").data("placeholder-p").replace("{min_range}",r).replace("{max_range}",s).replace("{field_label}",i.find("div.um-slider-range").data("label")),a=i.find("div.um-slider-range").data("label"),_.push({name:t,label:a,value_label:e,value:[r,s],type:d})}else _=wp.hooks.applyFilters("um_member_directory_get_filter_data",_,u,i)}),_}function um_change_tag(e){var r=um_get_filters_data(e);e.find(".um-members-filter-tag").remove();var t=e.find(".um-filtered-line");if(t.length){var a=wp.template("um-members-filtered-line");t.prepend(a({filters:r})),0===e.find(".um-members-filter-remove").length?(e.find(".um-clear-filters").hide(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(e.find(".um-clear-filters").show(),e.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"))}}function um_run_search(e){if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=um_get_data_for_directory(e,"search"),t=um_sanitize_value(e.find(".um-search-line").val());if(t===r||""===t&&void 0===r)um_members_hide_preloader(e);else{e.data("general_search",t),um_set_url_from_data(e,"search",t),e.data("page",1),um_set_url_from_data(e,"page","");var a=!1;if(!(a=wp.hooks.applyFilters("um_member_directory_ignore_after_search",a,e)))if(1===e.data("must-search")&&(t=um_get_search(e),0===e.find(".um-members-filter-remove").length&&!t))return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e);e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}}jQuery(document.body).ready(function(){jQuery(".um-directory .um-search-filter select").each(function(){1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var e=jQuery(this);e.select2("destroy").select2({dropdownParent:e.parent()})}),jQuery(document.body).on("mouseover",".um-directory .um-member-directory-view-type",function(){if(!jQuery(this).hasClass("um-disabled")){var e=jQuery(this).find(".um-member-directory-view-type-a:visible");e.hide(),e.next().length?e.next().show().tipsy("show"):jQuery(this).find(".um-member-directory-view-type-a:first").show().tipsy("show")}}).on("mouseout",".um-directory .um-member-directory-view-type",function(){jQuery(this).hasClass("um-disabled")||(jQuery(this).find(".um-member-directory-view-type-a").hide().tipsy("hide"),jQuery(this).find('.um-member-directory-view-type-a[data-type="'+jQuery(this).parents(".um-directory").data("view_type")+'"]').show())}),jQuery(document.body).on("click",".um-directory .um-member-directory-view-type-a",function(){var e=jQuery(this).parents(".um-directory");if(um_is_directory_busy(e))return!1;var r=jQuery(this),t=r.parents(".um-member-directory-view-type");if(!t.hasClass("um-disabled")){um_members_show_preloader(e);var a=t.find(".um-member-directory-view-type-a:visible");a.hide(),a.next().length?a.next().show().tipsy("show"):t.find(".um-member-directory-view-type-a:first").show().tipsy("show");var i=um_member_directory_last_data[um_members_get_hash(e)];if(null!==i){var m=r.data("type");um_set_url_from_data(e,"view_type",m),e.data("view_type",m),um_build_template(e,i),um_init_new_dropdown()}um_members_hide_preloader(e)}}),jQuery(document.body).on("click",".um-directory .um-do-search",function(){um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("keypress",".um-directory .um-search-line",function(e){13===e.which&&um_run_search(jQuery(this).parents(".um-directory"))}),jQuery(document.body).on("click",'.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a',function(){if(1!==jQuery(this).data("selected")){var e=jQuery(this).data("directory-hash"),r=jQuery('.um-directory[data-hash="'+e+'"]');if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).html(),a=jQuery(this).data("value");r.data("sorting",a),um_set_url_from_data(r,"sort",a),um_ajax_get_members(r),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),r.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"] a[data-value="'+a+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),r.find(".um-member-directory-sorting-a").find("> a").html(t)}}}),jQuery(document.body).on("click",".um-directory .pagi:not(.current)",function(){if(!jQuery(this).hasClass("disabled")){var e,r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r))um_members_show_preloader(r),1===(e="first"===jQuery(this).data("page")?1:"prev"===jQuery(this).data("page")?1*r.data("page")-1:"next"===jQuery(this).data("page")?1*r.data("page")+1:"last"===jQuery(this).data("page")?parseInt(r.data("total_pages")):parseInt(jQuery(this).data("page")))?(r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass("disabled"),r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled")):(e===parseInt(r.data("total_pages"))?r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass("disabled"):r.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass("disabled"),r.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass("disabled")),r.find(".pagi").removeClass("current"),r.find('.pagi[data-page="'+e+'"]').addClass("current"),r.data("page",e),um_set_url_from_data(r,"page",1===e?"":e),um_ajax_get_members(r)}}),jQuery(document.body).on("change",".um-directory .um-members-pagi-dropdown",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).val();e.find(".pagi").removeClass("current"),e.find('.pagi[data-page="'+r+'"]').addClass("current"),e.data("page",r),um_set_url_from_data(e,"page",1===r?"":r),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-more").hide(),r.find(".um-member-meta-main").slideDown(),r.find(".um-member-less").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-list .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member");return r.find(".um-member-less").hide(),r.find(".um-member-meta-main").slideUp(),r.find(".um-member-more").fadeIn(),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-more a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-more").hide(),r.find(".um-member-meta").slideDown(function(){UM_Member_Grid(t)}),r.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(t)},100),!1}),jQuery(document.body).on("click",".um-directory .um-members.um-members-grid .um-member-less a",function(e){e.preventDefault();var r=jQuery(this).parents(".um-member"),t=jQuery(this).parents(".um-members");return r.find(".um-member-less").hide(),r.find(".um-member-meta").slideUp(function(){r.find(".um-member-more").fadeIn(),UM_Member_Grid(t)}),!1}),jQuery(".um-member-directory-filters-a").on("click",function(){var e=jQuery(this),r=e.parents(".um-directory").find(".um-search");r.is(":visible")?r.slideUp(250,function(){e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}):r.slideDown({duration:250,start:function(){jQuery(this).css({display:"grid"}),e.toggleClass("um-member-directory-filters-visible"),r.parents(".um-member-directory-header-row").toggleClass("um-header-row-invisible")}})}),jQuery(document.body).on("change",".um-directory .um-search-filter select",function(){var e=jQuery(this).val(),r=um_sanitize_value(e);if(""!==r){var t=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(t)){um_members_show_preloader(t);var a=jQuery(this).prop("name"),i=um_get_data_for_directory(t,"filter_"+a);i=void 0===i?[]:i.split("||"),-1===jQuery.inArray(r,i)&&(i.push(r),um_set_url_from_data(t,"filter_"+a,i=i.join("||")),t.data("page",1),um_set_url_from_data(t,"page","")),jQuery(this).find('option[value="'+e+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var m=jQuery(this);m.select2("destroy").select2({dropdownParent:m.parent()}),m.val("").trigger("change"),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled")}}}),jQuery(document.body).on("blur",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){var r=um_sanitize_value(jQuery(this).val()),t=jQuery(this).prop("name"),a=um_get_data_for_directory(e,"filter_"+t);void 0===a&&(a=""),r!==a&&(um_members_show_preloader(e),um_set_url_from_data(e,"filter_"+t,r),e.data("page",1),um_set_url_from_data(e,"page",""),um_ajax_get_members(e),um_change_tag(e),e.data("searched",1),e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),jQuery(document.body).on("keypress",'.um-directory .um-search-filter.um-text-filter-type input[type="text"]',function(e){if(13===e.which){var r=jQuery(this).parents(".um-directory");if(um_is_directory_busy(r))return;var t=um_sanitize_value(jQuery(this).val()),a=jQuery(this).prop("name"),i=um_get_data_for_directory(r,"filter_"+a);if(void 0===i&&(i=""),t===i)return;um_members_show_preloader(r),um_set_url_from_data(r,"filter_"+a,t),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}),jQuery(document.body).on("click",".um-directory .um-members-filter-remove",function(){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)&&e){um_members_show_preloader(e);var r=jQuery(this).data("value"),t=jQuery(this).data("name"),a=jQuery(this).data("type");if("text"===a)um_set_url_from_data(e,"filter_"+t,""),jQuery('.um-search-filter input[name="'+t+'"]').val("");else if("select"===a){var i=um_get_data_for_directory(e,"filter_"+t);i=void 0===i?[]:(i=um_unsanitize_value(i)).split("||"),-1!==jQuery.inArray(r.toString(),i)&&(i=jQuery.grep(i,function(e){return e!==r.toString()})),i.length||(i=""),um_set_url_from_data(e,"filter_"+t,i);var m=jQuery('.um-search-filter select[name="'+t+'"]');m.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<m.find("option:not(:disabled)").length&&m.prop("disabled",!1),m.select2("destroy").select2({dropdownParent:m.parent()}),0<e.find('.um-search-filter select[data-um-parent="'+t+'"]').length&&m.trigger("change")}else if("slider"===a){um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to","");var d=jQuery(".um-search-filter #"+t+"_min").siblings(".um-slider"),s=d.slider("option");d.slider("values",[s.min,s.max]),jQuery(".um-search-filter #"+t+"_min").val(""),jQuery(".um-search-filter #"+t+"_max").val(""),um_set_range_label(d)}else"datepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):"timepicker"===a?(um_set_url_from_data(e,"filter_"+t+"_from",""),um_set_url_from_data(e,"filter_"+t+"_to",""),jQuery(".um-search-filter #"+t+"_from").val(""),jQuery(".um-search-filter #"+t+"_to").val("")):wp.hooks.doAction("um_member_directory_filter_remove",a,e,t,r);e.data("page",1),um_set_url_from_data(e,"page",""),jQuery(this).tipsy("hide"),jQuery(this).parents(".um-members-filter-tag").remove(),0===e.find(".um-members-filter-remove").length?e.find(".um-clear-filters").hide():e.find(".um-clear-filters").show();var u=!1;if(!(u=wp.hooks.applyFilters("um_member_directory_ignore_after_search",u,e)))if(1===e.data("must-search")){var _=um_get_search(e);if(0===e.find(".um-members-filter-remove").length&&!_)return e.data("searched",0),e.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),e.find(".um-member-directory-sorting-options").prop("disabled",!0),e.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",e),void um_members_hide_preloader(e)}e.find(".um-member-directory-sorting-options").prop("disabled",!1),e.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(e)}}),jQuery(document.body).on("click",".um-directory .um-clear-filters-a",function(){var s=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(s)){um_members_show_preloader(s),s.find(".um-members-filter-remove").each(function(){var r=jQuery(this).data("value"),e=jQuery(this).data("name"),t=jQuery(this).data("type");if("text"===t)um_set_url_from_data(s,"filter_"+e,""),jQuery('.um-search-filter input[name="'+e+'"]').val("");else if("select"===t){var a=um_get_data_for_directory(s,"filter_"+e);a=void 0===a?[]:a.split("||"),-1!==jQuery.inArray(r.toString(),a)&&(a=jQuery.grep(a,function(e){return e!==r.toString()})),a.length||(a=""),um_set_url_from_data(s,"filter_"+e,a);var i=jQuery('.um-search-filter select[name="'+e+'"]');i.find('option[value="'+r+'"]').prop("disabled",!1).show(),1<i.find("option:not(:disabled)").length&&i.prop("disabled",!1),i.select2("destroy").select2({dropdownParent:i.parent()}),0<s.find('.um-search-filter select[data-um-parent="'+e+'"]').length&&i.trigger("change")}else if("slider"===t){um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to","");var m=jQuery(".um-search-filter #"+e+"_min").siblings(".um-slider"),d=m.slider("option");m.slider("values",[d.min,d.max]),jQuery(".um-search-filter #"+e+"_min").val(""),jQuery(".um-search-filter #"+e+"_max").val(""),um_set_range_label(m)}else"datepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):"timepicker"===t?(um_set_url_from_data(s,"filter_"+e+"_from",""),um_set_url_from_data(s,"filter_"+e+"_to",""),jQuery(".um-search-filter #"+e+"_from").val(""),jQuery(".um-search-filter #"+e+"_to").val("")):wp.hooks.doAction("um_member_directory_clear_filters",t,s,e,r)}),s.data("page",1),um_set_url_from_data(s,"page",""),s.find(".um-members-filter-tag").remove(),0===s.find(".um-members-filter-remove").length?(s.find(".um-clear-filters").hide(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").addClass("um-header-row-invisible")):(s.find(".um-clear-filters").show(),s.find(".um-clear-filters").parents(".um-member-directory-header-row").removeClass("um-header-row-invisible"));var e=!1;if(!(e=wp.hooks.applyFilters("um_member_directory_ignore_after_search",e,s)))if(1===s.data("must-search"))if(!um_get_search(s))return s.data("searched",0),s.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),s.find(".um-member-directory-sorting-options").prop("disabled",!0),s.find(".um-member-directory-view-type").addClass("um-disabled"),wp.hooks.doAction("um_member_directory_clear_not_searched",s),void um_members_hide_preloader(s);s.find(".um-member-directory-sorting-options").prop("disabled",!1),s.find(".um-member-directory-view-type").removeClass("um-disabled"),um_ajax_get_members(s)}}),wp.hooks.doAction("um_member_directory_on_first_pages_loading"),jQuery(".um-directory").each(function(){var e=jQuery(this),r=um_members_get_hash(e);um_member_directories.push(r),e.find(".um-search").length&&(e.find(".um-search").is(":visible")||e.find(".um-search").css({display:"grid"}).slideUp(1)),e.find(".um-slider").each(function(){var e=jQuery(this),t=e.parents(".um-directory"),a=e.data("field_name"),r=um_get_data_for_directory(t,"filter_"+a+"_from"),i=um_get_data_for_directory(t,"filter_"+a+"_to");void 0===r&&(r=parseInt(e.data("min"))),void 0===i&&(i=parseInt(e.data("max")));var m=[r,i];e.slider({range:!0,min:parseInt(e.data("min")),max:parseInt(e.data("max")),values:m,create:function(e,r){},step:1,slide:function(e,r){um_set_range_label(jQuery(this),r)},stop:function(e,r){um_is_directory_busy(t)||(um_members_show_preloader(t),um_set_url_from_data(t,"filter_"+a+"_from",r.values[0]),um_set_url_from_data(t,"filter_"+a+"_to",r.values[1]),t.data("page",1),um_set_url_from_data(t,"page",""),um_ajax_get_members(t),um_change_tag(t),t.data("searched",1),t.find(".um-member-directory-sorting-options").prop("disabled",!1),t.find(".um-member-directory-view-type").removeClass("um-disabled"))}}),um_set_range_label(e)}),e.find(".um-datepicker-filter").each(function(){var s=jQuery(this),u=new Date(1e3*s.data("date_min")),_=new Date(1e3*s.data("date_max")),e=s.pickadate({selectYears:!0,min:u,max:_,formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){s.blur()},onClose:function(){s.blur()},onSet:function(e){if(e.select){var r=s.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=s.data("filter_name"),a=s.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");void 0===i&&(i=u/1e3),void 0===m&&(m=_/1e3);var d=e.select/1e3;s.val();"from"===a?i=d:"to"===a&&(m=d),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickadate("picker"),r=s.data("filter_name"),t=s.data("range"),a=um_get_data_for_directory(s.parents(".um-directory"),"filter_"+r+"_"+t);void 0!==a&&e.set("select",1e3*a)}),e.find(".um-timepicker-filter").each(function(){var u=jQuery(this),_=u.attr("id"),o=u.data("filter_name"),n=u.attr("data-min"),l=u.attr("data-max"),e=n.split(":"),r=l.split(":"),t=u.pickatime({format:u.data("format"),interval:parseInt(u.data("intervals")),min:[e[0],e[1]],max:[r[0],r[1]],formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){u.blur()},onClose:function(){u.blur()},onSet:function(e){if(e.select){var r=u.parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=u.data("filter_name"),a=u.data("range"),i=um_get_data_for_directory(r,"filter_"+t+"_from"),m=um_get_data_for_directory(r,"filter_"+t+"_to");if(void 0===i&&(i=n),void 0===m&&(m=l),void 0!==e.select){var d=um_time_convert(e.select,a);"from"===a?i=d:"to"===a&&(m=d)}else"from"===a?i=n:"to"===a&&(m=l);var s=jQuery("#"+_).val();"from"===u.data("range")?jQuery("#"+o+"_to").pickatime("picker").set("min",s):jQuery("#"+o+"_from").pickatime("picker").set("max",s),um_set_url_from_data(r,"filter_"+t+"_from",i),um_set_url_from_data(r,"filter_"+t+"_to",m),r.data("page",1),um_set_url_from_data(r,"page",""),um_ajax_get_members(r),um_change_tag(r),r.data("searched",1),r.find(".um-member-directory-sorting-options").prop("disabled",!1),r.find(".um-member-directory-view-type").removeClass("um-disabled")}}}}).pickatime("picker"),a=u.data("filter_name"),i=u.data("range"),m=um_get_data_for_directory(u.parents(".um-directory"),"filter_"+a+"_"+i);if(void 0!==m){var d=m.split(":");t.set("select",60*d[0]+1*d[1])}}),wp.hooks.doAction("um_member_directory_on_init",e,r);var t=!1;if(!(t=wp.hooks.applyFilters("um_member_directory_ignore_after_search",t,e))&&1===e.data("must-search")){var a=um_get_search(e);if(!um_get_filters_data(e).length&&!a)return}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,e,r)||(um_members_show_preloader(e),um_ajax_get_members(e,{first_load:!0}),um_change_tag(e))}),window.addEventListener("popstate",function(e){jQuery(".um-directory").each(function(){var d=jQuery(this),e=um_members_get_hash(d);(um_member_directories.push(e),um_members_show_preloader(d),d.find(".um-members-grid, .um-members-list, .um-members-intro").remove(),d.find(".um-member-directory-search-line").length)&&(void 0===(s=um_get_data_for_directory(d,"search"))&&(s=""),d.data("general_search",s),d.find(".um-search-line").val(s));var r=um_get_data_for_directory(d,"page");if(void 0===r?r=1:r>d.data("total_pages")&&(r=d.data("total_pages")),d.data("page",r).attr("data-page",r),d.find(".um-member-directory-sorting").length){var t=um_get_data_for_directory(d,"sort");void 0===t&&(t=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]').find('a[data-default="1"]').data("value")),d.data("sorting",t);var a=d.find('.um-new-dropdown[data-element=".um-member-directory-sorting-a"]');a.find("a").data("selected",0).prop("data-selected",0).attr("data-selected",0),a.find('a[data-value="'+t+'"]').data("selected",1).prop("data-selected",1).attr("data-selected",1),d.find(".um-member-directory-sorting-a").find("> a").html(a.find('a[data-value="'+t+'"]').html())}if(d.find(".um-member-directory-view-type").length){var i=um_get_data_for_directory(d,"view_type");void 0===i&&(i=d.find('.um-member-directory-view-type-a[data-default="1"]').data("type")),d.data("view_type",i),d.find(".um-member-directory-view-type .um-member-directory-view-type-a").hide(),d.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="'+i+'"]').show()}d.find(".um-datepicker-filter").each(function(){var e=jQuery(this),r=e.pickadate("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);void 0!==i?r.set("select",1e3*i):r.clear()}),d.find(".um-slider").each(function(){var e=jQuery(this),r=e.data("field_name"),t=um_get_data_for_directory(d,"filter_"+r+"_from"),a=um_get_data_for_directory(d,"filter_"+r+"_to");void 0===t&&(t=e.data("min")),t=parseInt(t),void 0===a&&(a=e.data("max")),a=parseInt(a),e.slider("values",[t,a]),um_set_range_label(e)}),d.find(".um-timepicker-filter").each(function(){var e=jQuery(this),r=e.pickatime("picker"),t=e.data("filter_name"),a=e.data("range"),i=um_get_data_for_directory(d,"filter_"+t+"_"+a);if(void 0!==i){var m=i.split(":");r.set("select",60*m[0])}else r.clear()});var m=!1;if(!(m=wp.hooks.applyFilters("um_member_directory_ignore_after_search",m,d))&&1===d.data("must-search")){var s=um_get_search(d);if(!um_get_filters_data(d).length&&!s)return d.data("searched",0),void um_members_hide_preloader(d);d.data("searched",1)}wp.hooks.applyFilters("um_member_directory_prevent_default_first_loading",!1,d,e)||(um_ajax_get_members(d),um_change_tag(d))})})});
|
includes/admin/assets/js/um-admin-forms.js
CHANGED
@@ -483,10 +483,10 @@ jQuery(document).ready( function() {
|
|
483 |
});
|
484 |
|
485 |
function um_set_range_label( slider, ui ) {
|
486 |
-
console.log( slider );
|
487 |
var placeholder = '';
|
488 |
var placeholder_s = slider.siblings( '.um-slider-range' ).data( 'placeholder-s' );
|
489 |
var placeholder_p = slider.siblings( '.um-slider-range' ).data( 'placeholder-p' );
|
|
|
490 |
|
491 |
if ( ui ) {
|
492 |
if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
|
@@ -499,6 +499,8 @@ jQuery(document).ready( function() {
|
|
499 |
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
500 |
.data('label') );
|
501 |
}
|
|
|
|
|
502 |
} else {
|
503 |
if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
|
504 |
placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
|
@@ -510,11 +512,13 @@ jQuery(document).ready( function() {
|
|
510 |
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
511 |
.data('label') );
|
512 |
}
|
|
|
|
|
513 |
}
|
514 |
slider.siblings( '.um-slider-range' ).html( placeholder );
|
515 |
|
516 |
-
slider.siblings( ".um_range_min" ).val(
|
517 |
-
slider.siblings( ".um_range_max" ).val(
|
518 |
}
|
519 |
|
520 |
|
483 |
});
|
484 |
|
485 |
function um_set_range_label( slider, ui ) {
|
|
|
486 |
var placeholder = '';
|
487 |
var placeholder_s = slider.siblings( '.um-slider-range' ).data( 'placeholder-s' );
|
488 |
var placeholder_p = slider.siblings( '.um-slider-range' ).data( 'placeholder-p' );
|
489 |
+
var um_range_min, um_range_max;
|
490 |
|
491 |
if ( ui ) {
|
492 |
if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
|
499 |
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
500 |
.data('label') );
|
501 |
}
|
502 |
+
um_range_min = ui.values[0];
|
503 |
+
um_range_max = ui.values[1];
|
504 |
} else {
|
505 |
if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
|
506 |
placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
|
512 |
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
513 |
.data('label') );
|
514 |
}
|
515 |
+
um_range_min = slider.slider( "values", 0 );
|
516 |
+
um_range_max = slider.slider( "values", 1 );
|
517 |
}
|
518 |
slider.siblings( '.um-slider-range' ).html( placeholder );
|
519 |
|
520 |
+
slider.siblings( ".um_range_min" ).val( um_range_min );
|
521 |
+
slider.siblings( ".um_range_max" ).val( um_range_max );
|
522 |
}
|
523 |
|
524 |
|
includes/admin/class-admin.php
CHANGED
@@ -767,10 +767,10 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
|
767 |
'sanitize' => 'absint',
|
768 |
),
|
769 |
'_min' => array(
|
770 |
-
'sanitize' => '
|
771 |
),
|
772 |
'_max' => array(
|
773 |
-
'sanitize' => '
|
774 |
),
|
775 |
'_min_chars' => array(
|
776 |
'sanitize' => 'absint',
|
@@ -1360,6 +1360,9 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
|
1360 |
case 'int':
|
1361 |
$sanitized[ $k ] = (int) $v;
|
1362 |
break;
|
|
|
|
|
|
|
1363 |
case 'bool':
|
1364 |
$sanitized[ $k ] = (bool) $v;
|
1365 |
break;
|
@@ -1393,6 +1396,13 @@ if ( ! class_exists( 'um\admin\Admin' ) ) {
|
|
1393 |
$sanitized[ $k ] = absint( $v );
|
1394 |
}
|
1395 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1396 |
}
|
1397 |
}
|
1398 |
|
767 |
'sanitize' => 'absint',
|
768 |
),
|
769 |
'_min' => array(
|
770 |
+
'sanitize' => 'empty_int',
|
771 |
),
|
772 |
'_max' => array(
|
773 |
+
'sanitize' => 'empty_int',
|
774 |
),
|
775 |
'_min_chars' => array(
|
776 |
'sanitize' => 'absint',
|
1360 |
case 'int':
|
1361 |
$sanitized[ $k ] = (int) $v;
|
1362 |
break;
|
1363 |
+
case 'empty_int':
|
1364 |
+
$sanitized[ $k ] = ( '' !== $v ) ? (int) $v : '';
|
1365 |
+
break;
|
1366 |
case 'bool':
|
1367 |
$sanitized[ $k ] = (bool) $v;
|
1368 |
break;
|
1396 |
$sanitized[ $k ] = absint( $v );
|
1397 |
}
|
1398 |
break;
|
1399 |
+
case 'empty_absint':
|
1400 |
+
if ( is_array( $v ) ) {
|
1401 |
+
$sanitized[ $k ] = array_map( 'absint', $v );
|
1402 |
+
} else {
|
1403 |
+
$sanitized[ $k ] = ( '' !== $v ) ? absint( $v ) : '';
|
1404 |
+
}
|
1405 |
+
break;
|
1406 |
}
|
1407 |
}
|
1408 |
|
includes/admin/core/class-admin-metabox.php
CHANGED
@@ -431,7 +431,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
|
431 |
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
432 |
'1' => __( 'Redirect user', 'ultimate-member' ),
|
433 |
),
|
434 |
-
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? '' : array( '_um_access_hide_from_queries', '=', '0' ),
|
435 |
),
|
436 |
array(
|
437 |
'id' => '_um_restrict_by_custom_message',
|
@@ -583,7 +583,7 @@ if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
|
583 |
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
584 |
'1' => __( 'Redirect user', 'ultimate-member' ),
|
585 |
),
|
586 |
-
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? '' : array( '_um_access_hide_from_queries', '=', '0' ),
|
587 |
),
|
588 |
array(
|
589 |
'id' => '_um_restrict_by_custom_message',
|
431 |
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
432 |
'1' => __( 'Redirect user', 'ultimate-member' ),
|
433 |
),
|
434 |
+
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? array( '_um_accessible', '!=', '0' ) : array( '_um_access_hide_from_queries', '=', '0' ),
|
435 |
),
|
436 |
array(
|
437 |
'id' => '_um_restrict_by_custom_message',
|
583 |
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
584 |
'1' => __( 'Redirect user', 'ultimate-member' ),
|
585 |
),
|
586 |
+
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? array( '_um_accessible', '!=', '0' ) : array( '_um_access_hide_from_queries', '=', '0' ),
|
587 |
),
|
588 |
array(
|
589 |
'id' => '_um_restrict_by_custom_message',
|
includes/admin/core/class-admin-settings.php
CHANGED
@@ -1,3455 +1,3475 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
-
exit;
|
6 |
-
}
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_Settings
|
13 |
-
* @package um\admin\core
|
14 |
-
*/
|
15 |
-
class Admin_Settings {
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @var array
|
20 |
-
*/
|
21 |
-
public $settings_map;
|
22 |
-
|
23 |
-
|
24 |
-
/**
|
25 |
-
* @var array
|
26 |
-
*/
|
27 |
-
public $settings_structure;
|
28 |
-
|
29 |
-
|
30 |
-
/**
|
31 |
-
* @var
|
32 |
-
*/
|
33 |
-
private $previous_licenses;
|
34 |
-
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var
|
38 |
-
*/
|
39 |
-
private $need_change_permalinks;
|
40 |
-
|
41 |
-
|
42 |
-
private $gravatar_changed = false;
|
43 |
-
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Admin_Settings constructor.
|
47 |
-
*/
|
48 |
-
public function __construct() {
|
49 |
-
//init settings structure
|
50 |
-
add_action( 'admin_init', array( &$this, 'init_variables' ), 9 );
|
51 |
-
|
52 |
-
//admin menu
|
53 |
-
add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 );
|
54 |
-
|
55 |
-
//settings structure handlers
|
56 |
-
add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) );
|
57 |
-
add_filter( 'um_settings_section_email__content', array( $this, 'settings_email_tab' ), 10, 1 );
|
58 |
-
|
59 |
-
//enqueue wp_media for profiles tab
|
60 |
-
add_action( 'um_settings_page_appearance__before_section', array( $this, 'settings_appearance_profile_tab' ) );
|
61 |
-
|
62 |
-
//custom content for licenses tab
|
63 |
-
add_filter( 'um_settings_section_licenses__content', array( $this, 'settings_licenses_tab' ), 10, 2 );
|
64 |
-
|
65 |
-
add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 );
|
66 |
-
|
67 |
-
|
68 |
-
add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 );
|
69 |
-
|
70 |
-
|
71 |
-
//save handlers
|
72 |
-
add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 );
|
73 |
-
|
74 |
-
//save pages options
|
75 |
-
add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) );
|
76 |
-
add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
|
77 |
-
|
78 |
-
|
79 |
-
add_filter( 'um_change_settings_before_save', array( $this, 'save_email_templates' ) );
|
80 |
-
|
81 |
-
|
82 |
-
//save licenses options
|
83 |
-
add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) );
|
84 |
-
add_action( 'um_settings_save', array( $this, 'licenses_save' ) );
|
85 |
-
|
86 |
-
add_filter( 'um_change_settings_before_save', array( $this, 'set_default_if_empty' ), 9, 1 );
|
87 |
-
add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 );
|
88 |
-
|
89 |
-
add_action( 'admin_init', array( &$this, 'um_download_install_info' ) );
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
public function same_page_update_ajax() {
|
95 |
-
UM()->admin()->check_ajax_nonce();
|
96 |
-
|
97 |
-
if ( empty( $_POST['cb_func'] ) ) {
|
98 |
-
wp_send_json_error( __( 'Wrong callback', 'ultimate-member' ) );
|
99 |
-
}
|
100 |
-
|
101 |
-
$cb_func = sanitize_key( $_POST['cb_func'] );
|
102 |
-
|
103 |
-
if ( 'um_usermeta_fields' === $cb_func ) {
|
104 |
-
//first install metatable
|
105 |
-
global $wpdb;
|
106 |
-
|
107 |
-
$metakeys = array();
|
108 |
-
foreach ( UM()->builtin()->all_user_fields as $all_user_field ) {
|
109 |
-
$metakeys[] = $all_user_field['metakey'];
|
110 |
-
}
|
111 |
-
|
112 |
-
$metakeys = apply_filters( 'um_metadata_same_page_update_ajax', $metakeys, UM()->builtin()->all_user_fields );
|
113 |
-
|
114 |
-
if ( is_multisite() ) {
|
115 |
-
|
116 |
-
$sites = get_sites( array( 'fields' => 'ids' ) );
|
117 |
-
foreach ( $sites as $blog_id ) {
|
118 |
-
$metakeys[] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
|
119 |
-
}
|
120 |
-
} else {
|
121 |
-
$blog_id = get_current_blog_id();
|
122 |
-
$metakeys[] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
|
123 |
-
}
|
124 |
-
|
125 |
-
//member directory data
|
126 |
-
$metakeys[] = 'um_member_directory_data';
|
127 |
-
$metakeys[] = '_um_verified';
|
128 |
-
$metakeys[] = '_money_spent';
|
129 |
-
$metakeys[] = '_completed';
|
130 |
-
$metakeys[] = '_reviews_avg';
|
131 |
-
|
132 |
-
//myCred meta
|
133 |
-
if ( function_exists( 'mycred_get_types' ) ) {
|
134 |
-
$mycred_types = mycred_get_types();
|
135 |
-
if ( ! empty( $mycred_types ) ) {
|
136 |
-
foreach ( array_keys( $mycred_types ) as $point_type ) {
|
137 |
-
$metakeys[] = $point_type;
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
$sortby_custom_keys = $wpdb->get_col( "SELECT DISTINCT meta_value FROM {$wpdb->postmeta} WHERE meta_key='_um_sortby_custom'" );
|
143 |
-
if ( empty( $sortby_custom_keys ) ) {
|
144 |
-
$sortby_custom_keys = array();
|
145 |
-
}
|
146 |
-
|
147 |
-
$sortby_custom_keys2 = $wpdb->get_col( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key='_um_sorting_fields'" );
|
148 |
-
if ( ! empty( $sortby_custom_keys2 ) ) {
|
149 |
-
foreach ( $sortby_custom_keys2 as $custom_val ) {
|
150 |
-
$custom_val = maybe_unserialize( $custom_val );
|
151 |
-
|
152 |
-
foreach ( $custom_val as $sort_value ) {
|
153 |
-
if ( is_array( $sort_value ) ) {
|
154 |
-
$field_keys = array_keys( $sort_value );
|
155 |
-
$sortby_custom_keys[] = $field_keys[0];
|
156 |
-
}
|
157 |
-
}
|
158 |
-
}
|
159 |
-
}
|
160 |
-
|
161 |
-
if ( ! empty( $sortby_custom_keys ) ) {
|
162 |
-
$sortby_custom_keys = array_unique( $sortby_custom_keys );
|
163 |
-
$metakeys = array_merge( $metakeys, $sortby_custom_keys );
|
164 |
-
}
|
165 |
-
|
166 |
-
$skip_fields = UM()->builtin()->get_fields_without_metakey();
|
167 |
-
$skip_fields = array_merge( $skip_fields, UM()->member_directory()->core_search_fields );
|
168 |
-
|
169 |
-
$real_usermeta = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->usermeta}" );
|
170 |
-
$real_usermeta = ! empty( $real_usermeta ) ? $real_usermeta : array();
|
171 |
-
$real_usermeta = array_merge( $real_usermeta, array( 'um_member_directory_data' ) );
|
172 |
-
|
173 |
-
if ( ! empty( $sortby_custom_keys ) ) {
|
174 |
-
$real_usermeta = array_merge( $real_usermeta, $sortby_custom_keys );
|
175 |
-
}
|
176 |
-
|
177 |
-
$wp_usermeta_option = array_intersect( array_diff( $metakeys, $skip_fields ), $real_usermeta );
|
178 |
-
|
179 |
-
update_option( 'um_usermeta_fields', array_values( $wp_usermeta_option ) );
|
180 |
-
|
181 |
-
update_option( 'um_member_directory_update_meta', time() );
|
182 |
-
|
183 |
-
UM()->options()->update( 'member_directory_own_table', true );
|
184 |
-
|
185 |
-
wp_send_json_success();
|
186 |
-
} elseif ( 'um_get_metadata' === $cb_func ) {
|
187 |
-
global $wpdb;
|
188 |
-
|
189 |
-
$wp_usermeta_option = get_option( 'um_usermeta_fields', array() );
|
190 |
-
|
191 |
-
$count = $wpdb->get_var(
|
192 |
-
"SELECT COUNT(*)
|
193 |
-
FROM {$wpdb->usermeta}
|
194 |
-
WHERE meta_key IN ('" . implode( "','", $wp_usermeta_option ) . "')"
|
195 |
-
);
|
196 |
-
|
197 |
-
wp_send_json_success( array( 'count' => $count ) );
|
198 |
-
} elseif ( 'um_update_metadata_per_page' === $cb_func ) {
|
199 |
-
|
200 |
-
if ( empty( $_POST['page'] ) ) {
|
201 |
-
wp_send_json_error( __( 'Wrong data', 'ultimate-member' ) );
|
202 |
-
}
|
203 |
-
|
204 |
-
$per_page = 500;
|
205 |
-
$wp_usermeta_option = get_option( 'um_usermeta_fields', array() );
|
206 |
-
|
207 |
-
global $wpdb;
|
208 |
-
$metadata = $wpdb->get_results(
|
209 |
-
$wpdb->prepare(
|
210 |
-
"SELECT *
|
211 |
-
FROM {$wpdb->usermeta}
|
212 |
-
WHERE meta_key IN ('" . implode( "','", $wp_usermeta_option ) . "')
|
213 |
-
LIMIT %d, %d",
|
214 |
-
( absint( $_POST['page'] ) - 1 ) * $per_page,
|
215 |
-
$per_page
|
216 |
-
),
|
217 |
-
ARRAY_A
|
218 |
-
);
|
219 |
-
|
220 |
-
$values = array();
|
221 |
-
foreach ( $metadata as $metarow ) {
|
222 |
-
$values[] = $wpdb->prepare( '(%d, %s, %s)', $metarow['user_id'], $metarow['meta_key'], $metarow['meta_value'] );
|
223 |
-
}
|
224 |
-
|
225 |
-
if ( ! empty( $values ) ) {
|
226 |
-
$wpdb->query(
|
227 |
-
"INSERT INTO
|
228 |
-
{$wpdb->prefix}um_metadata(user_id, um_key, um_value)
|
229 |
-
VALUES " . implode( ',', $values )
|
230 |
-
);
|
231 |
-
}
|
232 |
-
|
233 |
-
$from = ( absint( $_POST['page'] ) * $per_page ) - $per_page + 1;
|
234 |
-
$to = absint( $_POST['page'] ) * $per_page;
|
235 |
-
|
236 |
-
wp_send_json_success( array( 'message' => sprintf( __( 'Metadata from %1$s to %2$s was upgraded successfully...', 'ultimate-member' ), $from, $to ) ) );
|
237 |
-
}
|
238 |
-
}
|
239 |
-
|
240 |
-
|
241 |
-
/**
|
242 |
-
*
|
243 |
-
*/
|
244 |
-
public function init_variables() {
|
245 |
-
|
246 |
-
$settings_map = array();
|
247 |
-
|
248 |
-
$general_pages_fields = array(
|
249 |
-
array(
|
250 |
-
'id' => 'pages_settings',
|
251 |
-
'type' => 'hidden',
|
252 |
-
'value' => true,
|
253 |
-
'is_option' => false,
|
254 |
-
),
|
255 |
-
);
|
256 |
-
|
257 |
-
$core_pages = UM()->config()->core_pages;
|
258 |
-
|
259 |
-
foreach ( $core_pages as $page_s => $page ) {
|
260 |
-
$have_pages = UM()->query()->wp_pages();
|
261 |
-
$page_id = UM()->options()->get_core_page_id( $page_s );
|
262 |
-
|
263 |
-
$page_title = ! empty( $page['title'] ) ? $page['title'] : '';
|
264 |
-
|
265 |
-
if ( 'reached_maximum_limit' === $have_pages ) {
|
266 |
-
$general_pages_fields[] = array(
|
267 |
-
'id' => $page_id,
|
268 |
-
'type' => 'text',
|
269 |
-
// translators: %s: Page title
|
270 |
-
'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
|
271 |
-
'placeholder' => __( 'Add page ID', 'ultimate-member' ),
|
272 |
-
'compiler' => true,
|
273 |
-
'size' => 'small',
|
274 |
-
);
|
275 |
-
} else {
|
276 |
-
$general_pages_fields[] = array(
|
277 |
-
'id' => $page_id,
|
278 |
-
'type' => 'select',
|
279 |
-
// translators: %s: Page title
|
280 |
-
'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
|
281 |
-
'options' => UM()->query()->wp_pages(),
|
282 |
-
'placeholder' => __( 'Choose a page...', 'ultimate-member' ),
|
283 |
-
'compiler' => true,
|
284 |
-
'size' => 'small',
|
285 |
-
);
|
286 |
-
}
|
287 |
-
|
288 |
-
|
289 |
-
$settings_map[ $page_id ] = array(
|
290 |
-
'sanitize' => 'absint',
|
291 |
-
);
|
292 |
-
}
|
293 |
-
|
294 |
-
$appearances_profile_menu_fields = array(
|
295 |
-
array(
|
296 |
-
'id' => 'profile_menu',
|
297 |
-
'type' => 'checkbox',
|
298 |
-
'label' => __( 'Enable profile menu', 'ultimate-member' ),
|
299 |
-
),
|
300 |
-
);
|
301 |
-
|
302 |
-
$settings_map['profile_menu'] = array(
|
303 |
-
'sanitize' => 'bool',
|
304 |
-
);
|
305 |
-
|
306 |
-
$tabs = UM()->profile()->tabs();
|
307 |
-
|
308 |
-
$tabs_options = array();
|
309 |
-
$tabs_condition = array();
|
310 |
-
foreach ( $tabs as $id => $tab ) {
|
311 |
-
|
312 |
-
if ( ! empty( $tab['hidden'] ) ) {
|
313 |
-
continue;
|
314 |
-
}
|
315 |
-
|
316 |
-
if ( isset( $tab['name'] ) ) {
|
317 |
-
$tabs_options[ $id ] = $tab['name'];
|
318 |
-
$tabs_condition[] = 'profile_tab_' . $id;
|
319 |
-
}
|
320 |
-
|
321 |
-
if ( isset( $tab['default_privacy'] ) ) {
|
322 |
-
$fields = array(
|
323 |
-
array(
|
324 |
-
'id' => 'profile_tab_' . $id,
|
325 |
-
'type' => 'checkbox',
|
326 |
-
// translators: %s: Tab title
|
327 |
-
'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ),
|
328 |
-
'conditional' => array( 'profile_menu', '=', 1 ),
|
329 |
-
'data' => array( 'fill_profile_menu_default_tab' => $id ),
|
330 |
-
),
|
331 |
-
);
|
332 |
-
|
333 |
-
$settings_map[ 'profile_tab_' . $id ] = array(
|
334 |
-
'sanitize' => 'bool',
|
335 |
-
);
|
336 |
-
} else {
|
337 |
-
|
338 |
-
$fields = array(
|
339 |
-
array(
|
340 |
-
'id' => 'profile_tab_' . $id,
|
341 |
-
'type' => 'checkbox',
|
342 |
-
// translators: %s: Tab title
|
343 |
-
'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ),
|
344 |
-
'conditional' => array( 'profile_menu', '=', 1 ),
|
345 |
-
'data' => array( 'fill_profile_menu_default_tab' => $id ),
|
346 |
-
),
|
347 |
-
array(
|
348 |
-
'id' => 'profile_tab_' . $id . '_privacy',
|
349 |
-
'type' => 'select',
|
350 |
-
// translators: %s: Tab title
|
351 |
-
'label' => sprintf( __( 'Who can see %s Tab?', 'ultimate-member' ), $tab['name'] ),
|
352 |
-
'tooltip' => __( 'Select which users can view this tab.', 'ultimate-member' ),
|
353 |
-
'options' => UM()->profile()->tabs_privacy(),
|
354 |
-
'conditional' => array( 'profile_tab_' . $id, '=', 1 ),
|
355 |
-
'size' => 'small',
|
356 |
-
),
|
357 |
-
array(
|
358 |
-
'id' => 'profile_tab_' . $id . '_roles',
|
359 |
-
'type' => 'select',
|
360 |
-
'multi' => true,
|
361 |
-
'label' => __( 'Allowed roles', 'ultimate-member' ),
|
362 |
-
'tooltip' => __( 'Select the the user roles allowed to view this tab.', 'ultimate-member' ),
|
363 |
-
'options' => UM()->roles()->get_roles(),
|
364 |
-
'placeholder' => __( 'Choose user roles...', 'ultimate-member' ),
|
365 |
-
'conditional' => array( 'profile_tab_' . $id . '_privacy', '=', array( '4', '5' ) ),
|
366 |
-
'size' => 'small',
|
367 |
-
),
|
368 |
-
);
|
369 |
-
|
370 |
-
$settings_map = array_merge(
|
371 |
-
$settings_map,
|
372 |
-
array(
|
373 |
-
"profile_tab_{$id}" => array(
|
374 |
-
'sanitize' => 'bool',
|
375 |
-
),
|
376 |
-
"profile_tab_{$id}_privacy" => array(
|
377 |
-
'sanitize' => array( UM()->admin(), 'sanitize_tabs_privacy' ),
|
378 |
-
),
|
379 |
-
"profile_tab_{$id}_roles" => array(
|
380 |
-
'sanitize' => array( UM()->admin(), 'sanitize_existed_role' ),
|
381 |
-
),
|
382 |
-
)
|
383 |
-
);
|
384 |
-
}
|
385 |
-
|
386 |
-
$appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, $fields );
|
387 |
-
}
|
388 |
-
|
389 |
-
$appearances_profile_menu_fields[] = array(
|
390 |
-
'id' => 'profile_menu_default_tab',
|
391 |
-
'type' => 'select',
|
392 |
-
'label' => __( 'Profile menu default tab', 'ultimate-member' ),
|
393 |
-
'tooltip' => __( 'This will be the default tab on user profile page', 'ultimate-member' ),
|
394 |
-
'options' => $tabs_options,
|
395 |
-
'conditional' => array( implode( '|', $tabs_condition ), '~', 1 ),
|
396 |
-
'size' => 'small',
|
397 |
-
);
|
398 |
-
|
399 |
-
$settings_map['profile_menu_default_tab'] = array(
|
400 |
-
'sanitize' => 'key',
|
401 |
-
);
|
402 |
-
|
403 |
-
$appearances_profile_menu_fields = array_merge(
|
404 |
-
$appearances_profile_menu_fields,
|
405 |
-
array(
|
406 |
-
array(
|
407 |
-
'id' => 'profile_menu_icons',
|
408 |
-
'type' => 'checkbox',
|
409 |
-
'label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ),
|
410 |
-
'conditional' => array( 'profile_menu', '=', 1 ),
|
411 |
-
),
|
412 |
-
)
|
413 |
-
);
|
414 |
-
|
415 |
-
$settings_map['profile_menu_icons'] = array(
|
416 |
-
'sanitize' => 'bool',
|
417 |
-
);
|
418 |
-
|
419 |
-
$post_types_options = array();
|
420 |
-
$all_post_types = get_post_types( array( 'public' => true ), 'objects' );
|
421 |
-
foreach ( $all_post_types as $key => $post_type_data ) {
|
422 |
-
$post_types_options[ $key ] = $post_type_data->labels->singular_name;
|
423 |
-
}
|
424 |
-
|
425 |
-
$duplicates = array();
|
426 |
-
$taxonomies_options = array();
|
427 |
-
$exclude_taxonomies = UM()->excluded_taxonomies();
|
428 |
-
$all_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
|
429 |
-
foreach ( $all_taxonomies as $key => $taxonomy ) {
|
430 |
-
if ( in_array( $key, $exclude_taxonomies, true ) ) {
|
431 |
-
continue;
|
432 |
-
}
|
433 |
-
|
434 |
-
if ( ! in_array( $taxonomy->labels->singular_name, $duplicates, true ) ) {
|
435 |
-
$duplicates[] = $taxonomy->labels->singular_name;
|
436 |
-
$label = $taxonomy->labels->singular_name;
|
437 |
-
} else {
|
438 |
-
$label = $taxonomy->labels->singular_name . ' (' . $key . ')';
|
439 |
-
}
|
440 |
-
|
441 |
-
$taxonomies_options[ $key ] = $label;
|
442 |
-
}
|
443 |
-
|
444 |
-
$restricted_access_post_metabox_value = array();
|
445 |
-
$restricted_access_post_metabox = UM()->options()->get( 'restricted_access_post_metabox' );
|
446 |
-
if ( ! empty( $restricted_access_post_metabox ) && is_array( $restricted_access_post_metabox ) ) {
|
447 |
-
foreach ( $restricted_access_post_metabox as $key => $value ) {
|
448 |
-
if ( $value ) {
|
449 |
-
$restricted_access_post_metabox_value[] = $key;
|
450 |
-
}
|
451 |
-
}
|
452 |
-
}
|
453 |
-
|
454 |
-
|
455 |
-
$restricted_access_taxonomy_metabox_value = array();
|
456 |
-
$restricted_access_taxonomy_metabox = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
457 |
-
if ( ! empty( $restricted_access_taxonomy_metabox ) && is_array( $restricted_access_taxonomy_metabox ) ) {
|
458 |
-
foreach ( $restricted_access_taxonomy_metabox as $key => $value ) {
|
459 |
-
if ( $value ) {
|
460 |
-
$restricted_access_taxonomy_metabox_value[] = $key;
|
461 |
-
}
|
462 |
-
}
|
463 |
-
}
|
464 |
-
|
465 |
-
$access_fields = array(
|
466 |
-
array(
|
467 |
-
'id' => 'accessible',
|
468 |
-
'type' => 'select',
|
469 |
-
'label' => __( 'Global Site Access', 'ultimate-member' ),
|
470 |
-
'tooltip' => __( 'Globally control the access of your site, you can have separate restrict options per post/page by editing the desired item.', 'ultimate-member' ),
|
471 |
-
'options' => array(
|
472 |
-
0 => __( 'Site accessible to Everyone', 'ultimate-member' ),
|
473 |
-
2 => __( 'Site accessible to Logged In Users', 'ultimate-member' ),
|
474 |
-
),
|
475 |
-
'size' => 'medium',
|
476 |
-
),
|
477 |
-
array(
|
478 |
-
'id' => 'access_redirect',
|
479 |
-
'type' => 'text',
|
480 |
-
'label' => __( 'Custom Redirect URL', 'ultimate-member' ),
|
481 |
-
'tooltip' => __( 'A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimate-member' ),
|
482 |
-
'conditional' => array( 'accessible', '=', 2 ),
|
483 |
-
),
|
484 |
-
array(
|
485 |
-
'id' => 'access_exclude_uris',
|
486 |
-
'type' => 'multi_text',
|
487 |
-
'label' => __( 'Exclude the following URLs', 'ultimate-member' ),
|
488 |
-
'tooltip' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimate-member' ),
|
489 |
-
'add_text' => __( 'Add New URL', 'ultimate-member' ),
|
490 |
-
'conditional' => array( 'accessible', '=', 2 ),
|
491 |
-
'show_default_number' => 0,
|
492 |
-
),
|
493 |
-
array(
|
494 |
-
'id' => 'home_page_accessible',
|
495 |
-
'type' => 'checkbox',
|
496 |
-
'label' => __( 'Allow Homepage to be accessible', 'ultimate-member' ),
|
497 |
-
'conditional' => array( 'accessible', '=', 2 ),
|
498 |
-
),
|
499 |
-
array(
|
500 |
-
'id' => 'category_page_accessible',
|
501 |
-
'type' => 'checkbox',
|
502 |
-
'label' => __( 'Allow Category pages to be accessible', 'ultimate-member' ),
|
503 |
-
'conditional' => array( 'accessible', '=', 2 ),
|
504 |
-
),
|
505 |
-
array(
|
506 |
-
'id' => 'restricted_post_title_replace',
|
507 |
-
'type' => 'checkbox',
|
508 |
-
'label' => __( 'Replace the restricted Post Title', 'ultimate-member' ),
|
509 |
-
'tooltip' => __( 'Allow to replace the restricted post title to users that do not have permission to view the content', 'ultimate-member' ),
|
510 |
-
),
|
511 |
-
array(
|
512 |
-
'id' => 'restricted_access_post_title',
|
513 |
-
'type' => 'text',
|
514 |
-
'label' => __( 'Restricted Access Post Title', 'ultimate-member' ),
|
515 |
-
'tooltip' => __( 'This is the post title shown to users that do not have permission to view the content', 'ultimate-member' ),
|
516 |
-
'conditional' => array( 'restricted_post_title_replace', '=', 1 ),
|
517 |
-
),
|
518 |
-
array(
|
519 |
-
'id' => 'restricted_access_message',
|
520 |
-
'type' => 'wp_editor',
|
521 |
-
'label' => __( 'Restricted Access Message', 'ultimate-member' ),
|
522 |
-
'tooltip' => __( 'This is the message shown to users that do not have permission to view the content', 'ultimate-member' ),
|
523 |
-
),
|
524 |
-
);
|
525 |
-
|
526 |
-
$settings_map = array_merge(
|
527 |
-
$settings_map,
|
528 |
-
array(
|
529 |
-
'accessible' => array(
|
530 |
-
'sanitize' => 'int',
|
531 |
-
),
|
532 |
-
'access_redirect' => array(
|
533 |
-
'sanitize' => 'url',
|
534 |
-
),
|
535 |
-
'access_exclude_uris' => array(
|
536 |
-
'sanitize' => 'url',
|
537 |
-
),
|
538 |
-
'home_page_accessible' => array(
|
539 |
-
'sanitize' => 'bool',
|
540 |
-
),
|
541 |
-
'category_page_accessible' => array(
|
542 |
-
'sanitize' => 'bool',
|
543 |
-
),
|
544 |
-
'restricted_post_title_replace' => array(
|
545 |
-
'sanitize' => 'bool',
|
546 |
-
),
|
547 |
-
'restricted_access_post_title' => array(
|
548 |
-
'sanitize' => 'text',
|
549 |
-
),
|
550 |
-
'restricted_access_message' => array(
|
551 |
-
'sanitize' => 'wp_kses',
|
552 |
-
),
|
553 |
-
)
|
554 |
-
);
|
555 |
-
|
556 |
-
global $wp_version;
|
557 |
-
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
|
558 |
-
$access_fields = array_merge(
|
559 |
-
$access_fields,
|
560 |
-
array(
|
561 |
-
array(
|
562 |
-
'id' => 'restricted_blocks',
|
563 |
-
'type' => 'checkbox',
|
564 |
-
'label' => __( 'Enable the "Content Restriction" settings for the Gutenberg Blocks', 'ultimate-member' ),
|
565 |
-
),
|
566 |
-
array(
|
567 |
-
'id' => 'restricted_block_message',
|
568 |
-
'type' => 'textarea',
|
569 |
-
'label' => __( 'Restricted Access Block Message', 'ultimate-member' ),
|
570 |
-
'tooltip' => __( 'This is the message shown to users that do not have permission to view the block\'s content', 'ultimate-member' ),
|
571 |
-
'conditional' => array( 'restricted_blocks', '=', 1 ),
|
572 |
-
),
|
573 |
-
)
|
574 |
-
);
|
575 |
-
|
576 |
-
$settings_map['restricted_blocks'] = array(
|
577 |
-
'sanitize' => 'bool',
|
578 |
-
);
|
579 |
-
$settings_map['restricted_block_message'] = array(
|
580 |
-
'sanitize' => 'textarea',
|
581 |
-
);
|
582 |
-
}
|
583 |
-
|
584 |
-
$access_fields = array_merge(
|
585 |
-
$access_fields,
|
586 |
-
array(
|
587 |
-
array(
|
588 |
-
'id' => 'restricted_access_post_metabox',
|
589 |
-
'type' => 'hidden',
|
590 |
-
'value' => '',
|
591 |
-
),
|
592 |
-
array(
|
593 |
-
'id' => 'restricted_access_taxonomy_metabox',
|
594 |
-
'type' => 'hidden',
|
595 |
-
'value' => '',
|
596 |
-
),
|
597 |
-
array(
|
598 |
-
'id' => 'restricted_access_post_metabox',
|
599 |
-
'type' => 'multi_checkbox',
|
600 |
-
'label' => __( 'Enable the "Content Restriction" settings for post types', 'ultimate-member' ),
|
601 |
-
'tooltip' => __( 'Check post types for which you plan to use the "Content Restriction" settings', 'ultimate-member' ),
|
602 |
-
'options' => $post_types_options,
|
603 |
-
'columns' => 3,
|
604 |
-
'value' => $restricted_access_post_metabox_value,
|
605 |
-
'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ),
|
606 |
-
),
|
607 |
-
array(
|
608 |
-
'id' => 'restricted_access_taxonomy_metabox',
|
609 |
-
'type' => 'multi_checkbox',
|
610 |
-
'label' => __( 'Enable the "Content Restriction" settings for taxonomies', 'ultimate-member' ),
|
611 |
-
'tooltip' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings', 'ultimate-member' ),
|
612 |
-
'options' => $taxonomies_options,
|
613 |
-
'columns' => 3,
|
614 |
-
'value' => $restricted_access_taxonomy_metabox_value,
|
615 |
-
'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ),
|
616 |
-
),
|
617 |
-
)
|
618 |
-
);
|
619 |
-
|
620 |
-
$settings_map = array_merge(
|
621 |
-
$settings_map,
|
622 |
-
array(
|
623 |
-
'restricted_access_post_metabox' => array(
|
624 |
-
'sanitize' => 'key',
|
625 |
-
),
|
626 |
-
'restricted_access_taxonomy_metabox' => array(
|
627 |
-
'sanitize' => 'key',
|
628 |
-
),
|
629 |
-
)
|
630 |
-
);
|
631 |
-
|
632 |
-
$latest_update = get_option( 'um_member_directory_update_meta', false );
|
633 |
-
$latest_truncate = get_option( 'um_member_directory_truncated', false );
|
634 |
-
|
635 |
-
$same_page_update = array(
|
636 |
-
'id' => 'member_directory_own_table',
|
637 |
-
'type' => 'same_page_update',
|
638 |
-
'label' => __( 'Enable custom table for usermeta', 'ultimate-member' ),
|
639 |
-
'tooltip' => __( 'Check this box if you would like to enable the use of a custom table for user metadata. Improved performance for member directory searches.', 'ultimate-member' ),
|
640 |
-
);
|
641 |
-
|
642 |
-
if ( empty( $latest_update ) || ( ! empty( $latest_truncate ) && $latest_truncate > $latest_update ) ) {
|
643 |
-
$same_page_update['upgrade_cb'] = 'sync_metatable';
|
644 |
-
$same_page_update['upgrade_description'] = '<p>' . __( 'We recommend creating a backup of your site before running the update process. Do not exit the page before the update process has complete.', 'ultimate-member' ) . '</p>
|
645 |
-
<p>' . __( 'After clicking the <strong>"Run"</strong> button, the update process will start. All information will be displayed in the field below.', 'ultimate-member' ) . '</p>
|
646 |
-
<p>' . __( 'If the update was successful, you will see a corresponding message. Otherwise, contact technical support if the update failed.', 'ultimate-member' ) . '</p>';
|
647 |
-
}
|
648 |
-
|
649 |
-
$settings_map = array_merge(
|
650 |
-
$settings_map,
|
651 |
-
array(
|
652 |
-
'permalink_base' => array(
|
653 |
-
'sanitize' => 'key',
|
654 |
-
),
|
655 |
-
'display_name' => array(
|
656 |
-
'sanitize' => 'key',
|
657 |
-
),
|
658 |
-
'display_name_field' => array(
|
659 |
-
'sanitize' => 'text',
|
660 |
-
),
|
661 |
-
'author_redirect' => array(
|
662 |
-
'sanitize' => 'bool',
|
663 |
-
),
|
664 |
-
'members_page' => array(
|
665 |
-
'sanitize' => 'bool',
|
666 |
-
),
|
667 |
-
'use_gravatars' => array(
|
668 |
-
'sanitize' => 'bool',
|
669 |
-
),
|
670 |
-
'use_um_gravatar_default_builtin_image' => array(
|
671 |
-
'sanitize' => 'key',
|
672 |
-
),
|
673 |
-
'use_um_gravatar_default_image' => array(
|
674 |
-
'sanitize' => 'bool',
|
675 |
-
),
|
676 |
-
'reset_require_strongpass' => array(
|
677 |
-
'sanitize' => 'bool',
|
678 |
-
),
|
679 |
-
'
|
680 |
-
'sanitize' => '
|
681 |
-
),
|
682 |
-
'
|
683 |
-
'sanitize' => 'absint',
|
684 |
-
),
|
685 |
-
'
|
686 |
-
'sanitize' => 'bool',
|
687 |
-
),
|
688 |
-
'
|
689 |
-
'sanitize' => '
|
690 |
-
),
|
691 |
-
'
|
692 |
-
'sanitize' => 'bool',
|
693 |
-
),
|
694 |
-
'
|
695 |
-
'sanitize' => 'bool',
|
696 |
-
),
|
697 |
-
'
|
698 |
-
'sanitize' => '
|
699 |
-
),
|
700 |
-
'
|
701 |
-
'sanitize' => '
|
702 |
-
),
|
703 |
-
'
|
704 |
-
'sanitize' => '
|
705 |
-
),
|
706 |
-
'
|
707 |
-
'sanitize' => '
|
708 |
-
),
|
709 |
-
'
|
710 |
-
'sanitize' => 'bool',
|
711 |
-
),
|
712 |
-
'
|
713 |
-
'sanitize' => 'bool',
|
714 |
-
),
|
715 |
-
'
|
716 |
-
'sanitize' => 'bool',
|
717 |
-
),
|
718 |
-
'
|
719 |
-
'sanitize' => 'bool',
|
720 |
-
),
|
721 |
-
'
|
722 |
-
'sanitize' => 'bool',
|
723 |
-
),
|
724 |
-
'
|
725 |
-
'sanitize' => '
|
726 |
-
),
|
727 |
-
'
|
728 |
-
'sanitize' => '
|
729 |
-
),
|
730 |
-
'
|
731 |
-
'sanitize' => '
|
732 |
-
),
|
733 |
-
'
|
734 |
-
'sanitize' => 'absint',
|
735 |
-
),
|
736 |
-
'
|
737 |
-
'sanitize' => 'absint',
|
738 |
-
),
|
739 |
-
'
|
740 |
-
'sanitize' => '
|
741 |
-
),
|
742 |
-
'
|
743 |
-
'sanitize' => 'absint',
|
744 |
-
),
|
745 |
-
'
|
746 |
-
'sanitize' => '
|
747 |
-
),
|
748 |
-
'
|
749 |
-
'sanitize' => 'absint',
|
750 |
-
),
|
751 |
-
'
|
752 |
-
'sanitize' => '
|
753 |
-
),
|
754 |
-
'
|
755 |
-
'sanitize' => 'absint',
|
756 |
-
),
|
757 |
-
'
|
758 |
-
'sanitize' => '
|
759 |
-
),
|
760 |
-
'
|
761 |
-
'sanitize' => '
|
762 |
-
),
|
763 |
-
'
|
764 |
-
'sanitize' => '
|
765 |
-
),
|
766 |
-
'
|
767 |
-
'sanitize' => '
|
768 |
-
),
|
769 |
-
'
|
770 |
-
'sanitize' => 'text',
|
771 |
-
),
|
772 |
-
'
|
773 |
-
'sanitize' => '
|
774 |
-
),
|
775 |
-
'
|
776 |
-
'sanitize' => 'text',
|
777 |
-
),
|
778 |
-
'
|
779 |
-
'sanitize' => '
|
780 |
-
),
|
781 |
-
'
|
782 |
-
'sanitize' => 'text',
|
783 |
-
),
|
784 |
-
'
|
785 |
-
'sanitize' => '
|
786 |
-
),
|
787 |
-
'
|
788 |
-
'sanitize' => 'text',
|
789 |
-
),
|
790 |
-
'
|
791 |
-
'sanitize' => '
|
792 |
-
),
|
793 |
-
'
|
794 |
-
'sanitize' => 'text',
|
795 |
-
),
|
796 |
-
'
|
797 |
-
'sanitize' => '
|
798 |
-
),
|
799 |
-
'
|
800 |
-
'sanitize' => '
|
801 |
-
),
|
802 |
-
'
|
803 |
-
'sanitize' => '
|
804 |
-
),
|
805 |
-
'
|
806 |
-
'sanitize' =>
|
807 |
-
),
|
808 |
-
'
|
809 |
-
'sanitize' => 'bool',
|
810 |
-
),
|
811 |
-
'
|
812 |
-
'sanitize' => array( UM()->admin(), '
|
813 |
-
),
|
814 |
-
'
|
815 |
-
'sanitize' => '
|
816 |
-
),
|
817 |
-
'
|
818 |
-
'sanitize' => '
|
819 |
-
),
|
820 |
-
'
|
821 |
-
'sanitize' => '
|
822 |
-
),
|
823 |
-
'
|
824 |
-
'sanitize' => 'bool',
|
825 |
-
),
|
826 |
-
'
|
827 |
-
'sanitize' => 'bool',
|
828 |
-
),
|
829 |
-
'
|
830 |
-
'sanitize' => 'bool',
|
831 |
-
),
|
832 |
-
'
|
833 |
-
'sanitize' => '
|
834 |
-
),
|
835 |
-
'
|
836 |
-
'sanitize' => '
|
837 |
-
),
|
838 |
-
'
|
839 |
-
'sanitize' => '
|
840 |
-
),
|
841 |
-
'
|
842 |
-
'sanitize' => '
|
843 |
-
),
|
844 |
-
'
|
845 |
-
'sanitize' => '
|
846 |
-
),
|
847 |
-
'
|
848 |
-
'sanitize' => '
|
849 |
-
),
|
850 |
-
'
|
851 |
-
'sanitize' => '
|
852 |
-
),
|
853 |
-
'
|
854 |
-
'sanitize' => '
|
855 |
-
),
|
856 |
-
'
|
857 |
-
'sanitize' => '
|
858 |
-
),
|
859 |
-
'
|
860 |
-
'sanitize' => '
|
861 |
-
),
|
862 |
-
'
|
863 |
-
'sanitize' => 'text',
|
864 |
-
),
|
865 |
-
'
|
866 |
-
'sanitize' => '
|
867 |
-
),
|
868 |
-
'
|
869 |
-
'sanitize' => '
|
870 |
-
),
|
871 |
-
'
|
872 |
-
'sanitize' => '
|
873 |
-
),
|
874 |
-
'
|
875 |
-
'sanitize' => '
|
876 |
-
),
|
877 |
-
'
|
878 |
-
'sanitize' => '
|
879 |
-
),
|
880 |
-
'
|
881 |
-
'sanitize' => '
|
882 |
-
),
|
883 |
-
'
|
884 |
-
'sanitize' => '
|
885 |
-
),
|
886 |
-
'
|
887 |
-
'sanitize' => '
|
888 |
-
),
|
889 |
-
'
|
890 |
-
'sanitize' => 'text',
|
891 |
-
),
|
892 |
-
'
|
893 |
-
'sanitize' => '
|
894 |
-
),
|
895 |
-
'
|
896 |
-
'sanitize' => '
|
897 |
-
),
|
898 |
-
'
|
899 |
-
'sanitize' => '
|
900 |
-
),
|
901 |
-
'
|
902 |
-
'sanitize' => 'bool',
|
903 |
-
),
|
904 |
-
'
|
905 |
-
'sanitize' => '
|
906 |
-
),
|
907 |
-
'
|
908 |
-
'sanitize' => '
|
909 |
-
),
|
910 |
-
'
|
911 |
-
'sanitize' => '
|
912 |
-
),
|
913 |
-
'
|
914 |
-
'sanitize' => '
|
915 |
-
),
|
916 |
-
'
|
917 |
-
'sanitize' => '
|
918 |
-
),
|
919 |
-
'
|
920 |
-
'sanitize' => 'bool',
|
921 |
-
),
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
*
|
935 |
-
*
|
936 |
-
*
|
937 |
-
* @
|
938 |
-
* @
|
939 |
-
*
|
940 |
-
*
|
941 |
-
*
|
942 |
-
*
|
943 |
-
*
|
944 |
-
*
|
945 |
-
*
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
'
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
'
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
'
|
990 |
-
'
|
991 |
-
'
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
'
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
'
|
1004 |
-
'
|
1005 |
-
'
|
1006 |
-
'
|
1007 |
-
),
|
1008 |
-
array(
|
1009 |
-
'id' => '
|
1010 |
-
'type' => 'checkbox',
|
1011 |
-
'label' => __( '
|
1012 |
-
'tooltip' => __( '
|
1013 |
-
),
|
1014 |
-
array(
|
1015 |
-
'id' => '
|
1016 |
-
'type' => 'checkbox',
|
1017 |
-
'label' => __( '
|
1018 |
-
'tooltip' => __( '
|
1019 |
-
),
|
1020 |
-
array(
|
1021 |
-
'id'
|
1022 |
-
'type'
|
1023 |
-
'label'
|
1024 |
-
'tooltip'
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
'
|
1033 |
-
'
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
'
|
1042 |
-
'
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
'
|
1047 |
-
'
|
1048 |
-
'
|
1049 |
-
'
|
1050 |
-
),
|
1051 |
-
array(
|
1052 |
-
'id' => '
|
1053 |
-
'type' => '
|
1054 |
-
'
|
1055 |
-
'
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
),
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
'
|
1066 |
-
'
|
1067 |
-
'
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
'
|
1076 |
-
'
|
1077 |
-
'
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
'
|
1084 |
-
'
|
1085 |
-
|
1086 |
-
|
1087 |
-
'
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
'
|
1096 |
-
'
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
'
|
1102 |
-
'
|
1103 |
-
'
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
'
|
1109 |
-
'
|
1110 |
-
'
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
'
|
1120 |
-
'
|
1121 |
-
|
1122 |
-
|
1123 |
-
'
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
'
|
1131 |
-
'
|
1132 |
-
'
|
1133 |
-
|
1134 |
-
|
1135 |
-
),
|
1136 |
-
array(
|
1137 |
-
'id' => '
|
1138 |
-
'type' => 'checkbox',
|
1139 |
-
'label' => __( '
|
1140 |
-
'tooltip' => __( 'Whether to
|
1141 |
-
),
|
1142 |
-
array(
|
1143 |
-
'id'
|
1144 |
-
'type'
|
1145 |
-
'label'
|
1146 |
-
'tooltip'
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
'
|
1151 |
-
'
|
1152 |
-
'
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
'
|
1158 |
-
'
|
1159 |
-
'
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
'
|
1164 |
-
'
|
1165 |
-
'
|
1166 |
-
'
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
'
|
1171 |
-
'
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
'
|
1180 |
-
|
1181 |
-
|
1182 |
-
'
|
1183 |
-
'
|
1184 |
-
|
1185 |
-
|
1186 |
-
'
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
'
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
'
|
1200 |
-
'
|
1201 |
-
|
1202 |
-
|
1203 |
-
'
|
1204 |
-
|
1205 |
-
|
1206 |
-
'
|
1207 |
-
'
|
1208 |
-
'
|
1209 |
-
'
|
1210 |
-
'
|
1211 |
-
),
|
1212 |
-
array(
|
1213 |
-
'id'
|
1214 |
-
'type'
|
1215 |
-
'
|
1216 |
-
'
|
1217 |
-
|
1218 |
-
|
1219 |
-
'
|
1220 |
-
'
|
1221 |
-
|
1222 |
-
|
1223 |
-
'
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
'
|
1228 |
-
'
|
1229 |
-
'
|
1230 |
-
'
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
'
|
1236 |
-
'
|
1237 |
-
|
1238 |
-
|
1239 |
-
'
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
'
|
1257 |
-
'
|
1258 |
-
'label'
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
array(
|
1276 |
-
'id'
|
1277 |
-
'type'
|
1278 |
-
'label'
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
'
|
1310 |
-
'
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
'
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
'
|
1342 |
-
'
|
1343 |
-
'
|
1344 |
-
|
1345 |
-
|
1346 |
-
'
|
1347 |
-
'
|
1348 |
-
|
1349 |
-
|
1350 |
-
'
|
1351 |
-
'
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
'
|
1360 |
-
'
|
1361 |
-
'
|
1362 |
-
'
|
1363 |
-
'
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
'
|
1368 |
-
'
|
1369 |
-
'
|
1370 |
-
'default' => um_get_metadefault( '
|
1371 |
-
'
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
'
|
1377 |
-
|
1378 |
-
|
1379 |
-
'
|
1380 |
-
'
|
1381 |
-
|
1382 |
-
|
1383 |
-
'
|
1384 |
-
'
|
1385 |
-
|
1386 |
-
|
1387 |
-
'
|
1388 |
-
'
|
1389 |
-
|
1390 |
-
),
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
'
|
1395 |
-
'
|
1396 |
-
'
|
1397 |
-
'
|
1398 |
-
'tooltip'
|
1399 |
-
'
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
'
|
1404 |
-
'
|
1405 |
-
'
|
1406 |
-
'
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
'
|
1414 |
-
'
|
1415 |
-
'
|
1416 |
-
|
1417 |
-
|
1418 |
-
'
|
1419 |
-
'
|
1420 |
-
|
1421 |
-
|
1422 |
-
'
|
1423 |
-
|
1424 |
-
|
1425 |
-
'
|
1426 |
-
'
|
1427 |
-
|
1428 |
-
|
1429 |
-
'
|
1430 |
-
'
|
1431 |
-
'
|
1432 |
-
'
|
1433 |
-
|
1434 |
-
|
1435 |
-
'
|
1436 |
-
|
1437 |
-
|
1438 |
-
'
|
1439 |
-
'
|
1440 |
-
'
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
'
|
1447 |
-
'
|
1448 |
-
|
1449 |
-
|
1450 |
-
'
|
1451 |
-
'
|
1452 |
-
'
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
'
|
1458 |
-
'
|
1459 |
-
'
|
1460 |
-
'
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
'
|
1467 |
-
'
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
'
|
1472 |
-
'
|
1473 |
-
'
|
1474 |
-
'
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
'
|
1479 |
-
'
|
1480 |
-
'
|
1481 |
-
'tooltip' => __( 'Switch on/off
|
1482 |
-
),
|
1483 |
-
array(
|
1484 |
-
'id'
|
1485 |
-
'type'
|
1486 |
-
'label'
|
1487 |
-
'default'
|
1488 |
-
'tooltip'
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
'
|
1494 |
-
'
|
1495 |
-
'
|
1496 |
-
|
1497 |
-
|
1498 |
-
'
|
1499 |
-
|
1500 |
-
|
1501 |
-
),
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
'
|
1506 |
-
'
|
1507 |
-
'
|
1508 |
-
'
|
1509 |
-
'
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
'
|
1514 |
-
'
|
1515 |
-
'
|
1516 |
-
'
|
1517 |
-
'
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
'
|
1530 |
-
|
1531 |
-
|
1532 |
-
'
|
1533 |
-
'
|
1534 |
-
'
|
1535 |
-
'
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
'
|
1550 |
-
'
|
1551 |
-
'
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
'
|
1560 |
-
'
|
1561 |
-
'
|
1562 |
-
'tooltip' => __( '
|
1563 |
-
'
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
),
|
1569 |
-
'
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
'
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
'
|
1581 |
-
'
|
1582 |
-
'
|
1583 |
-
'default' =>
|
1584 |
-
'
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
'
|
1590 |
-
|
1591 |
-
|
1592 |
-
'
|
1593 |
-
'
|
1594 |
-
|
1595 |
-
|
1596 |
-
'
|
1597 |
-
'
|
1598 |
-
|
1599 |
-
|
1600 |
-
'
|
1601 |
-
'
|
1602 |
-
'
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
'
|
1608 |
-
'
|
1609 |
-
'
|
1610 |
-
'
|
1611 |
-
'
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
'
|
1620 |
-
'
|
1621 |
-
'
|
1622 |
-
'
|
1623 |
-
|
1624 |
-
|
1625 |
-
'
|
1626 |
-
|
1627 |
-
|
1628 |
-
'
|
1629 |
-
'
|
1630 |
-
'
|
1631 |
-
'
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
'
|
1640 |
-
'
|
1641 |
-
'
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
'
|
1650 |
-
'
|
1651 |
-
'
|
1652 |
-
'tooltip' => __( '
|
1653 |
-
'
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
),
|
1659 |
-
'
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
'
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
'
|
1671 |
-
'
|
1672 |
-
'
|
1673 |
-
'default' =>
|
1674 |
-
'
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
'
|
1680 |
-
|
1681 |
-
|
1682 |
-
'
|
1683 |
-
'
|
1684 |
-
|
1685 |
-
|
1686 |
-
'
|
1687 |
-
'
|
1688 |
-
|
1689 |
-
|
1690 |
-
'
|
1691 |
-
'
|
1692 |
-
'
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
'
|
1698 |
-
'
|
1699 |
-
'
|
1700 |
-
|
1701 |
-
|
1702 |
-
'
|
1703 |
-
'
|
1704 |
-
|
1705 |
-
|
1706 |
-
'
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
'
|
1744 |
-
'
|
1745 |
-
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
'
|
1750 |
-
'
|
1751 |
-
'
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
'
|
1756 |
-
'
|
1757 |
-
'
|
1758 |
-
'
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
'
|
1770 |
-
'
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
'
|
1776 |
-
'
|
1777 |
-
'
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
|
1815 |
-
|
1816 |
-
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
*
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
*
|
1949 |
-
*
|
1950 |
-
* @
|
1951 |
-
* @
|
1952 |
-
*
|
1953 |
-
* @
|
1954 |
-
* @
|
1955 |
-
*
|
1956 |
-
* {
|
1957 |
-
*
|
1958 |
-
*
|
1959 |
-
*
|
1960 |
-
*
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
*
|
2004 |
-
*
|
2005 |
-
* @
|
2006 |
-
* @
|
2007 |
-
*
|
2008 |
-
* @
|
2009 |
-
*
|
2010 |
-
*
|
2011 |
-
*
|
2012 |
-
*
|
2013 |
-
*
|
2014 |
-
*
|
2015 |
-
*
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
2052 |
-
|
2053 |
-
|
2054 |
-
|
2055 |
-
|
2056 |
-
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
|
2087 |
-
|
2088 |
-
|
2089 |
-
|
2090 |
-
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
2104 |
-
|
2105 |
-
|
2106 |
-
|
2107 |
-
|
2108 |
-
|
2109 |
-
|
2110 |
-
|
2111 |
-
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
2130 |
-
|
2131 |
-
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
-
|
2147 |
-
|
2148 |
-
|
2149 |
-
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
*
|
2173 |
-
*
|
2174 |
-
* @
|
2175 |
-
* @
|
2176 |
-
* @
|
2177 |
-
*
|
2178 |
-
*
|
2179 |
-
*
|
2180 |
-
* @
|
2181 |
-
*
|
2182 |
-
*
|
2183 |
-
*
|
2184 |
-
*
|
2185 |
-
*
|
2186 |
-
*
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
*
|
2200 |
-
*
|
2201 |
-
* @
|
2202 |
-
*
|
2203 |
-
*
|
2204 |
-
*
|
2205 |
-
*
|
2206 |
-
*
|
2207 |
-
*
|
2208 |
-
*
|
2209 |
-
|
2210 |
-
|
2211 |
-
|
2212 |
-
|
2213 |
-
|
2214 |
-
|
2215 |
-
|
2216 |
-
|
2217 |
-
|
2218 |
-
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
|
2233 |
-
|
2234 |
-
|
2235 |
-
|
2236 |
-
|
2237 |
-
|
2238 |
-
$
|
2239 |
-
|
2240 |
-
|
2241 |
-
|
2242 |
-
|
2243 |
-
|
2244 |
-
|
2245 |
-
|
2246 |
-
|
2247 |
-
|
2248 |
-
|
2249 |
-
|
2250 |
-
|
2251 |
-
}
|
2252 |
-
|
2253 |
-
|
2254 |
-
|
2255 |
-
|
2256 |
-
|
2257 |
-
|
2258 |
-
|
2259 |
-
|
2260 |
-
|
2261 |
-
|
2262 |
-
|
2263 |
-
|
2264 |
-
|
2265 |
-
|
2266 |
-
|
2267 |
-
|
2268 |
-
|
2269 |
-
|
2270 |
-
|
2271 |
-
|
2272 |
-
|
2273 |
-
|
2274 |
-
|
2275 |
-
|
2276 |
-
|
2277 |
-
|
2278 |
-
|
2279 |
-
|
2280 |
-
|
2281 |
-
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
|
2287 |
-
|
2288 |
-
|
2289 |
-
|
2290 |
-
|
2291 |
-
|
2292 |
-
|
2293 |
-
|
2294 |
-
|
2295 |
-
|
2296 |
-
|
2297 |
-
|
2298 |
-
|
2299 |
-
|
2300 |
-
|
2301 |
-
|
2302 |
-
|
2303 |
-
|
2304 |
-
|
2305 |
-
|
2306 |
-
|
2307 |
-
|
2308 |
-
|
2309 |
-
|
2310 |
-
|
2311 |
-
|
2312 |
-
|
2313 |
-
|
2314 |
-
|
2315 |
-
|
2316 |
-
|
2317 |
-
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
2325 |
-
|
2326 |
-
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
2332 |
-
|
2333 |
-
|
2334 |
-
|
2335 |
-
|
2336 |
-
|
2337 |
-
|
2338 |
-
|
2339 |
-
|
2340 |
-
|
2341 |
-
|
2342 |
-
|
2343 |
-
|
2344 |
-
|
2345 |
-
|
2346 |
-
|
2347 |
-
|
2348 |
-
|
2349 |
-
|
2350 |
-
|
2351 |
-
|
2352 |
-
|
2353 |
-
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
2357 |
-
|
2358 |
-
|
2359 |
-
|
2360 |
-
|
2361 |
-
|
2362 |
-
|
2363 |
-
|
2364 |
-
|
2365 |
-
|
2366 |
-
}
|
2367 |
-
}
|
2368 |
-
|
2369 |
-
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
}
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
2390 |
-
|
2391 |
-
|
2392 |
-
|
2393 |
-
|
2394 |
-
|
2395 |
-
|
2396 |
-
|
2397 |
-
|
2398 |
-
|
2399 |
-
$
|
2400 |
-
|
2401 |
-
|
2402 |
-
|
2403 |
-
|
2404 |
-
|
2405 |
-
}
|
2406 |
-
|
2407 |
-
|
2408 |
-
|
2409 |
-
|
2410 |
-
|
2411 |
-
|
2412 |
-
|
2413 |
-
|
2414 |
-
|
2415 |
-
|
2416 |
-
|
2417 |
-
|
2418 |
-
|
2419 |
-
|
2420 |
-
|
2421 |
-
|
2422 |
-
|
2423 |
-
|
2424 |
-
|
2425 |
-
|
2426 |
-
|
2427 |
-
|
2428 |
-
|
2429 |
-
|
2430 |
-
|
2431 |
-
|
2432 |
-
|
2433 |
-
);
|
2434 |
-
|
2435 |
-
|
2436 |
-
|
2437 |
-
|
2438 |
-
|
2439 |
-
|
2440 |
-
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
-
|
2447 |
-
|
2448 |
-
|
2449 |
-
$
|
2450 |
-
|
2451 |
-
|
2452 |
-
|
2453 |
-
|
2454 |
-
|
2455 |
-
}
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
|
2460 |
-
|
2461 |
-
|
2462 |
-
|
2463 |
-
|
2464 |
-
|
2465 |
-
|
2466 |
-
|
2467 |
-
|
2468 |
-
|
2469 |
-
|
2470 |
-
|
2471 |
-
|
2472 |
-
|
2473 |
-
|
2474 |
-
|
2475 |
-
|
2476 |
-
|
2477 |
-
|
2478 |
-
|
2479 |
-
|
2480 |
-
|
2481 |
-
|
2482 |
-
|
2483 |
-
|
2484 |
-
|
2485 |
-
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
|
2490 |
-
|
2491 |
-
|
2492 |
-
|
2493 |
-
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
|
2505 |
-
$
|
2506 |
-
$
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
$
|
2517 |
-
|
2518 |
-
|
2519 |
-
|
2520 |
-
|
2521 |
-
|
2522 |
-
|
2523 |
-
|
2524 |
-
|
2525 |
-
$
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
2529 |
-
|
2530 |
-
'
|
2531 |
-
|
2532 |
-
|
2533 |
-
|
2534 |
-
|
2535 |
-
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
-
|
2544 |
-
|
2545 |
-
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
-
|
2552 |
-
|
2553 |
-
|
2554 |
-
|
2555 |
-
|
2556 |
-
|
2557 |
-
|
2558 |
-
|
2559 |
-
|
2560 |
-
|
2561 |
-
|
2562 |
-
|
2563 |
-
|
2564 |
-
|
2565 |
-
|
2566 |
-
|
2567 |
-
|
2568 |
-
|
2569 |
-
|
2570 |
-
|
2571 |
-
|
2572 |
-
|
2573 |
-
|
2574 |
-
|
2575 |
-
|
2576 |
-
|
2577 |
-
|
2578 |
-
|
2579 |
-
|
2580 |
-
|
2581 |
-
|
2582 |
-
|
2583 |
-
|
2584 |
-
|
2585 |
-
|
2586 |
-
|
2587 |
-
|
2588 |
-
|
2589 |
-
|
2590 |
-
|
2591 |
-
|
2592 |
-
|
2593 |
-
|
2594 |
-
|
2595 |
-
|
2596 |
-
|
2597 |
-
|
2598 |
-
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
2604 |
-
|
2605 |
-
|
2606 |
-
|
2607 |
-
|
2608 |
-
|
2609 |
-
|
2610 |
-
|
2611 |
-
|
2612 |
-
|
2613 |
-
|
2614 |
-
|
2615 |
-
|
2616 |
-
|
2617 |
-
|
2618 |
-
|
2619 |
-
|
2620 |
-
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
|
2625 |
-
|
2626 |
-
|
2627 |
-
|
2628 |
-
|
2629 |
-
|
2630 |
-
|
2631 |
-
|
2632 |
-
|
2633 |
-
|
2634 |
-
'
|
2635 |
-
'
|
2636 |
-
'
|
2637 |
-
|
2638 |
-
|
2639 |
-
|
2640 |
-
|
2641 |
-
|
2642 |
-
|
2643 |
-
|
2644 |
-
|
2645 |
-
|
2646 |
-
|
2647 |
-
|
2648 |
-
|
2649 |
-
|
2650 |
-
|
2651 |
-
|
2652 |
-
|
2653 |
-
|
2654 |
-
|
2655 |
-
|
2656 |
-
|
2657 |
-
|
2658 |
-
|
2659 |
-
|
2660 |
-
|
2661 |
-
|
2662 |
-
|
2663 |
-
|
2664 |
-
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
-
|
2672 |
-
|
2673 |
-
|
2674 |
-
|
2675 |
-
|
2676 |
-
|
2677 |
-
|
2678 |
-
|
2679 |
-
|
2680 |
-
|
2681 |
-
|
2682 |
-
|
2683 |
-
|
2684 |
-
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
|
2693 |
-
|
2694 |
-
|
2695 |
-
|
2696 |
-
|
2697 |
-
|
2698 |
-
|
2699 |
-
|
2700 |
-
|
2701 |
-
|
2702 |
-
|
2703 |
-
|
2704 |
-
|
2705 |
-
|
2706 |
-
|
2707 |
-
|
2708 |
-
|
2709 |
-
|
2710 |
-
|
2711 |
-
|
2712 |
-
|
2713 |
-
|
2714 |
-
|
2715 |
-
|
2716 |
-
|
2717 |
-
|
2718 |
-
|
2719 |
-
|
2720 |
-
|
2721 |
-
|
2722 |
-
|
2723 |
-
$
|
2724 |
-
|
2725 |
-
|
2726 |
-
|
2727 |
-
|
2728 |
-
|
2729 |
-
$
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
$
|
2736 |
-
|
2737 |
-
|
2738 |
-
|
2739 |
-
|
2740 |
-
|
2741 |
-
|
2742 |
-
|
2743 |
-
|
2744 |
-
|
2745 |
-
|
2746 |
-
|
2747 |
-
|
2748 |
-
|
2749 |
-
|
2750 |
-
|
2751 |
-
|
2752 |
-
|
2753 |
-
|
2754 |
-
|
2755 |
-
|
2756 |
-
$
|
2757 |
-
|
2758 |
-
|
2759 |
-
|
2760 |
-
|
2761 |
-
|
2762 |
-
|
2763 |
-
|
2764 |
-
|
2765 |
-
$
|
2766 |
-
|
2767 |
-
|
2768 |
-
|
2769 |
-
|
2770 |
-
|
2771 |
-
|
2772 |
-
|
2773 |
-
|
2774 |
-
|
2775 |
-
|
2776 |
-
|
2777 |
-
|
2778 |
-
|
2779 |
-
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
|
2785 |
-
|
2786 |
-
|
2787 |
-
|
2788 |
-
|
2789 |
-
|
2790 |
-
|
2791 |
-
|
2792 |
-
|
2793 |
-
|
2794 |
-
|
2795 |
-
|
2796 |
-
|
2797 |
-
|
2798 |
-
|
2799 |
-
|
2800 |
-
|
2801 |
-
|
2802 |
-
|
2803 |
-
|
2804 |
-
|
2805 |
-
|
2806 |
-
|
2807 |
-
|
2808 |
-
|
2809 |
-
|
2810 |
-
|
2811 |
-
|
2812 |
-
|
2813 |
-
|
2814 |
-
|
2815 |
-
|
2816 |
-
|
2817 |
-
|
2818 |
-
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
|
2828 |
-
|
2829 |
-
|
2830 |
-
|
2831 |
-
|
2832 |
-
|
2833 |
-
$
|
2834 |
-
|
2835 |
-
|
2836 |
-
|
2837 |
-
|
2838 |
-
|
2839 |
-
$
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
$
|
2846 |
-
|
2847 |
-
|
2848 |
-
|
2849 |
-
|
2850 |
-
|
2851 |
-
|
2852 |
-
|
2853 |
-
|
2854 |
-
|
2855 |
-
|
2856 |
-
|
2857 |
-
|
2858 |
-
|
2859 |
-
|
2860 |
-
|
2861 |
-
|
2862 |
-
|
2863 |
-
|
2864 |
-
|
2865 |
-
|
2866 |
-
$
|
2867 |
-
|
2868 |
-
|
2869 |
-
|
2870 |
-
|
2871 |
-
|
2872 |
-
|
2873 |
-
|
2874 |
-
$
|
2875 |
-
$
|
2876 |
-
|
2877 |
-
|
2878 |
-
|
2879 |
-
|
2880 |
-
|
2881 |
-
|
2882 |
-
|
2883 |
-
|
2884 |
-
|
2885 |
-
|
2886 |
-
|
2887 |
-
|
2888 |
-
|
2889 |
-
|
2890 |
-
|
2891 |
-
|
2892 |
-
|
2893 |
-
|
2894 |
-
|
2895 |
-
|
2896 |
-
|
2897 |
-
|
2898 |
-
|
2899 |
-
|
2900 |
-
|
2901 |
-
|
2902 |
-
|
2903 |
-
|
2904 |
-
|
2905 |
-
|
2906 |
-
|
2907 |
-
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
-
|
2915 |
-
|
2916 |
-
|
2917 |
-
|
2918 |
-
|
2919 |
-
|
2920 |
-
|
2921 |
-
|
2922 |
-
|
2923 |
-
|
2924 |
-
|
2925 |
-
|
2926 |
-
|
2927 |
-
|
2928 |
-
|
2929 |
-
|
2930 |
-
|
2931 |
-
|
2932 |
-
|
2933 |
-
|
2934 |
-
|
2935 |
-
|
2936 |
-
|
2937 |
-
|
2938 |
-
|
2939 |
-
|
2940 |
-
|
2941 |
-
|
2942 |
-
|
2943 |
-
|
2944 |
-
|
2945 |
-
|
2946 |
-
|
2947 |
-
|
2948 |
-
|
2949 |
-
|
2950 |
-
|
2951 |
-
|
2952 |
-
|
2953 |
-
|
2954 |
-
|
2955 |
-
|
2956 |
-
|
2957 |
-
|
2958 |
-
|
2959 |
-
|
2960 |
-
|
2961 |
-
|
2962 |
-
|
2963 |
-
|
2964 |
-
|
2965 |
-
|
2966 |
-
|
2967 |
-
|
2968 |
-
|
2969 |
-
|
2970 |
-
|
2971 |
-
|
2972 |
-
|
2973 |
-
|
2974 |
-
|
2975 |
-
|
2976 |
-
|
2977 |
-
$
|
2978 |
-
|
2979 |
-
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
|
2985 |
-
|
2986 |
-
|
2987 |
-
|
2988 |
-
|
2989 |
-
|
2990 |
-
|
2991 |
-
|
2992 |
-
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
|
2997 |
-
|
2998 |
-
|
2999 |
-
|
3000 |
-
|
3001 |
-
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
3018 |
-
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
|
3027 |
-
|
3028 |
-
|
3029 |
-
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
-
|
3037 |
-
|
3038 |
-
|
3039 |
-
|
3040 |
-
|
3041 |
-
|
3042 |
-
|
3043 |
-
|
3044 |
-
|
3045 |
-
<?php
|
3046 |
-
<?php
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
<?php
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
-
<?php
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
);
|
3064 |
-
|
3065 |
-
$
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
$
|
3071 |
-
|
3072 |
-
?>
|
3073 |
-
|
3074 |
-
|
3075 |
-
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
-
|
3094 |
-
|
3095 |
-
|
3096 |
-
|
3097 |
-
|
3098 |
-
|
3099 |
-
|
3100 |
-
|
3101 |
-
|
3102 |
-
|
3103 |
-
|
3104 |
-
|
3105 |
-
|
3106 |
-
|
3107 |
-
|
3108 |
-
|
3109 |
-
|
3110 |
-
|
3111 |
-
|
3112 |
-
|
3113 |
-
|
3114 |
-
|
3115 |
-
|
3116 |
-
|
3117 |
-
|
3118 |
-
|
3119 |
-
|
3120 |
-
|
3121 |
-
|
3122 |
-
|
3123 |
-
|
3124 |
-
|
3125 |
-
*
|
3126 |
-
*
|
3127 |
-
* @
|
3128 |
-
*
|
3129 |
-
*
|
3130 |
-
*
|
3131 |
-
*
|
3132 |
-
*
|
3133 |
-
*
|
3134 |
-
|
3135 |
-
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
3140 |
-
|
3141 |
-
|
3142 |
-
|
3143 |
-
|
3144 |
-
|
3145 |
-
|
3146 |
-
|
3147 |
-
|
3148 |
-
|
3149 |
-
|
3150 |
-
|
3151 |
-
|
3152 |
-
|
3153 |
-
|
3154 |
-
|
3155 |
-
|
3156 |
-
|
3157 |
-
|
3158 |
-
|
3159 |
-
|
3160 |
-
|
3161 |
-
|
3162 |
-
|
3163 |
-
|
3164 |
-
|
3165 |
-
|
3166 |
-
|
3167 |
-
<?php
|
3168 |
-
|
3169 |
-
<?php
|
3170 |
-
|
3171 |
-
<?php
|
3172 |
-
|
3173 |
-
<?php
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
<?php
|
3181 |
-
|
3182 |
-
<?php
|
3183 |
-
<?php
|
3184 |
-
|
3185 |
-
<?php } ?>
|
3186 |
-
<?php $
|
3187 |
-
|
3188 |
-
<?php } ?>
|
3189 |
-
<?php
|
3190 |
-
|
3191 |
-
<?php
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
3196 |
-
|
3197 |
-
|
3198 |
-
|
3199 |
-
|
3200 |
-
|
3201 |
-
|
3202 |
-
|
3203 |
-
|
3204 |
-
|
3205 |
-
|
3206 |
-
|
3207 |
-
|
3208 |
-
|
3209 |
-
|
3210 |
-
|
3211 |
-
|
3212 |
-
|
3213 |
-
|
3214 |
-
|
3215 |
-
|
3216 |
-
|
3217 |
-
|
3218 |
-
|
3219 |
-
|
3220 |
-
|
3221 |
-
|
3222 |
-
|
3223 |
-
|
3224 |
-
|
3225 |
-
|
3226 |
-
|
3227 |
-
|
3228 |
-
|
3229 |
-
|
3230 |
-
|
3231 |
-
|
3232 |
-
|
3233 |
-
|
3234 |
-
|
3235 |
-
|
3236 |
-
|
3237 |
-
|
3238 |
-
|
3239 |
-
|
3240 |
-
|
3241 |
-
|
3242 |
-
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
|
3248 |
-
|
3249 |
-
|
3250 |
-
|
3251 |
-
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
|
3263 |
-
|
3264 |
-
|
3265 |
-
|
3266 |
-
|
3267 |
-
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
3286 |
-
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
3293 |
-
|
3294 |
-
|
3295 |
-
|
3296 |
-
|
3297 |
-
|
3298 |
-
|
3299 |
-
|
3300 |
-
|
3301 |
-
|
3302 |
-
|
3303 |
-
|
3304 |
-
|
3305 |
-
|
3306 |
-
|
3307 |
-
|
3308 |
-
|
3309 |
-
|
3310 |
-
|
3311 |
-
|
3312 |
-
|
3313 |
-
|
3314 |
-
|
3315 |
-
|
3316 |
-
|
3317 |
-
|
3318 |
-
|
3319 |
-
|
3320 |
-
|
3321 |
-
|
3322 |
-
|
3323 |
-
|
3324 |
-
|
3325 |
-
|
3326 |
-
|
3327 |
-
|
3328 |
-
|
3329 |
-
|
3330 |
-
|
3331 |
-
|
3332 |
-
|
3333 |
-
|
3334 |
-
|
3335 |
-
|
3336 |
-
|
3337 |
-
|
3338 |
-
|
3339 |
-
|
3340 |
-
|
3341 |
-
|
3342 |
-
|
3343 |
-
|
3344 |
-
|
3345 |
-
|
3346 |
-
|
3347 |
-
|
3348 |
-
|
3349 |
-
|
3350 |
-
|
3351 |
-
|
3352 |
-
|
3353 |
-
|
3354 |
-
|
3355 |
-
|
3356 |
-
|
3357 |
-
|
3358 |
-
|
3359 |
-
|
3360 |
-
|
3361 |
-
|
3362 |
-
|
3363 |
-
|
3364 |
-
|
3365 |
-
|
3366 |
-
|
3367 |
-
|
3368 |
-
|
3369 |
-
|
3370 |
-
|
3371 |
-
|
3372 |
-
|
3373 |
-
|
3374 |
-
|
3375 |
-
|
3376 |
-
|
3377 |
-
|
3378 |
-
|
3379 |
-
|
3380 |
-
|
3381 |
-
|
3382 |
-
|
3383 |
-
|
3384 |
-
|
3385 |
-
*
|
3386 |
-
*/
|
3387 |
-
function
|
3388 |
-
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
*
|
3402 |
-
* @param
|
3403 |
-
* @param string $
|
3404 |
-
*
|
3405 |
-
*
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
|
3412 |
-
|
3413 |
-
|
3414 |
-
|
3415 |
-
|
3416 |
-
|
3417 |
-
|
3418 |
-
|
3419 |
-
|
3420 |
-
|
3421 |
-
|
3422 |
-
|
3423 |
-
|
3424 |
-
* @param
|
3425 |
-
*
|
3426 |
-
* @return
|
3427 |
-
*/
|
3428 |
-
function
|
3429 |
-
|
3430 |
-
|
3431 |
-
|
3432 |
-
|
3433 |
-
|
3434 |
-
|
3435 |
-
|
3436 |
-
|
3437 |
-
$
|
3438 |
-
|
3439 |
-
|
3440 |
-
|
3441 |
-
|
3442 |
-
|
3443 |
-
|
3444 |
-
|
3445 |
-
|
3446 |
-
|
3447 |
-
|
3448 |
-
|
3449 |
-
|
3450 |
-
|
3451 |
-
|
3452 |
-
|
3453 |
-
|
3454 |
-
|
3455 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace um\admin\core;
|
3 |
+
|
4 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
5 |
+
exit;
|
6 |
+
}
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_Settings
|
13 |
+
* @package um\admin\core
|
14 |
+
*/
|
15 |
+
class Admin_Settings {
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var array
|
20 |
+
*/
|
21 |
+
public $settings_map;
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var array
|
26 |
+
*/
|
27 |
+
public $settings_structure;
|
28 |
+
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @var
|
32 |
+
*/
|
33 |
+
private $previous_licenses;
|
34 |
+
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var
|
38 |
+
*/
|
39 |
+
private $need_change_permalinks;
|
40 |
+
|
41 |
+
|
42 |
+
private $gravatar_changed = false;
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Admin_Settings constructor.
|
47 |
+
*/
|
48 |
+
public function __construct() {
|
49 |
+
//init settings structure
|
50 |
+
add_action( 'admin_init', array( &$this, 'init_variables' ), 9 );
|
51 |
+
|
52 |
+
//admin menu
|
53 |
+
add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 );
|
54 |
+
|
55 |
+
//settings structure handlers
|
56 |
+
add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) );
|
57 |
+
add_filter( 'um_settings_section_email__content', array( $this, 'settings_email_tab' ), 10, 1 );
|
58 |
+
|
59 |
+
//enqueue wp_media for profiles tab
|
60 |
+
add_action( 'um_settings_page_appearance__before_section', array( $this, 'settings_appearance_profile_tab' ) );
|
61 |
+
|
62 |
+
//custom content for licenses tab
|
63 |
+
add_filter( 'um_settings_section_licenses__content', array( $this, 'settings_licenses_tab' ), 10, 2 );
|
64 |
+
|
65 |
+
add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 );
|
66 |
+
|
67 |
+
|
68 |
+
add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 );
|
69 |
+
|
70 |
+
|
71 |
+
//save handlers
|
72 |
+
add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 );
|
73 |
+
|
74 |
+
//save pages options
|
75 |
+
add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) );
|
76 |
+
add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
|
77 |
+
|
78 |
+
|
79 |
+
add_filter( 'um_change_settings_before_save', array( $this, 'save_email_templates' ) );
|
80 |
+
|
81 |
+
|
82 |
+
//save licenses options
|
83 |
+
add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) );
|
84 |
+
add_action( 'um_settings_save', array( $this, 'licenses_save' ) );
|
85 |
+
|
86 |
+
add_filter( 'um_change_settings_before_save', array( $this, 'set_default_if_empty' ), 9, 1 );
|
87 |
+
add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 );
|
88 |
+
|
89 |
+
add_action( 'admin_init', array( &$this, 'um_download_install_info' ) );
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
public function same_page_update_ajax() {
|
95 |
+
UM()->admin()->check_ajax_nonce();
|
96 |
+
|
97 |
+
if ( empty( $_POST['cb_func'] ) ) {
|
98 |
+
wp_send_json_error( __( 'Wrong callback', 'ultimate-member' ) );
|
99 |
+
}
|
100 |
+
|
101 |
+
$cb_func = sanitize_key( $_POST['cb_func'] );
|
102 |
+
|
103 |
+
if ( 'um_usermeta_fields' === $cb_func ) {
|
104 |
+
//first install metatable
|
105 |
+
global $wpdb;
|
106 |
+
|
107 |
+
$metakeys = array();
|
108 |
+
foreach ( UM()->builtin()->all_user_fields as $all_user_field ) {
|
109 |
+
$metakeys[] = $all_user_field['metakey'];
|
110 |
+
}
|
111 |
+
|
112 |
+
$metakeys = apply_filters( 'um_metadata_same_page_update_ajax', $metakeys, UM()->builtin()->all_user_fields );
|
113 |
+
|
114 |
+
if ( is_multisite() ) {
|
115 |
+
|
116 |
+
$sites = get_sites( array( 'fields' => 'ids' ) );
|
117 |
+
foreach ( $sites as $blog_id ) {
|
118 |
+
$metakeys[] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
$blog_id = get_current_blog_id();
|
122 |
+
$metakeys[] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
|
123 |
+
}
|
124 |
+
|
125 |
+
//member directory data
|
126 |
+
$metakeys[] = 'um_member_directory_data';
|
127 |
+
$metakeys[] = '_um_verified';
|
128 |
+
$metakeys[] = '_money_spent';
|
129 |
+
$metakeys[] = '_completed';
|
130 |
+
$metakeys[] = '_reviews_avg';
|
131 |
+
|
132 |
+
//myCred meta
|
133 |
+
if ( function_exists( 'mycred_get_types' ) ) {
|
134 |
+
$mycred_types = mycred_get_types();
|
135 |
+
if ( ! empty( $mycred_types ) ) {
|
136 |
+
foreach ( array_keys( $mycred_types ) as $point_type ) {
|
137 |
+
$metakeys[] = $point_type;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
$sortby_custom_keys = $wpdb->get_col( "SELECT DISTINCT meta_value FROM {$wpdb->postmeta} WHERE meta_key='_um_sortby_custom'" );
|
143 |
+
if ( empty( $sortby_custom_keys ) ) {
|
144 |
+
$sortby_custom_keys = array();
|
145 |
+
}
|
146 |
+
|
147 |
+
$sortby_custom_keys2 = $wpdb->get_col( "SELECT meta_value FROM {$wpdb->postmeta} WHERE meta_key='_um_sorting_fields'" );
|
148 |
+
if ( ! empty( $sortby_custom_keys2 ) ) {
|
149 |
+
foreach ( $sortby_custom_keys2 as $custom_val ) {
|
150 |
+
$custom_val = maybe_unserialize( $custom_val );
|
151 |
+
|
152 |
+
foreach ( $custom_val as $sort_value ) {
|
153 |
+
if ( is_array( $sort_value ) ) {
|
154 |
+
$field_keys = array_keys( $sort_value );
|
155 |
+
$sortby_custom_keys[] = $field_keys[0];
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
if ( ! empty( $sortby_custom_keys ) ) {
|
162 |
+
$sortby_custom_keys = array_unique( $sortby_custom_keys );
|
163 |
+
$metakeys = array_merge( $metakeys, $sortby_custom_keys );
|
164 |
+
}
|
165 |
+
|
166 |
+
$skip_fields = UM()->builtin()->get_fields_without_metakey();
|
167 |
+
$skip_fields = array_merge( $skip_fields, UM()->member_directory()->core_search_fields );
|
168 |
+
|
169 |
+
$real_usermeta = $wpdb->get_col( "SELECT DISTINCT meta_key FROM {$wpdb->usermeta}" );
|
170 |
+
$real_usermeta = ! empty( $real_usermeta ) ? $real_usermeta : array();
|
171 |
+
$real_usermeta = array_merge( $real_usermeta, array( 'um_member_directory_data' ) );
|
172 |
+
|
173 |
+
if ( ! empty( $sortby_custom_keys ) ) {
|
174 |
+
$real_usermeta = array_merge( $real_usermeta, $sortby_custom_keys );
|
175 |
+
}
|
176 |
+
|
177 |
+
$wp_usermeta_option = array_intersect( array_diff( $metakeys, $skip_fields ), $real_usermeta );
|
178 |
+
|
179 |
+
update_option( 'um_usermeta_fields', array_values( $wp_usermeta_option ) );
|
180 |
+
|
181 |
+
update_option( 'um_member_directory_update_meta', time() );
|
182 |
+
|
183 |
+
UM()->options()->update( 'member_directory_own_table', true );
|
184 |
+
|
185 |
+
wp_send_json_success();
|
186 |
+
} elseif ( 'um_get_metadata' === $cb_func ) {
|
187 |
+
global $wpdb;
|
188 |
+
|
189 |
+
$wp_usermeta_option = get_option( 'um_usermeta_fields', array() );
|
190 |
+
|
191 |
+
$count = $wpdb->get_var(
|
192 |
+
"SELECT COUNT(*)
|
193 |
+
FROM {$wpdb->usermeta}
|
194 |
+
WHERE meta_key IN ('" . implode( "','", $wp_usermeta_option ) . "')"
|
195 |
+
);
|
196 |
+
|
197 |
+
wp_send_json_success( array( 'count' => $count ) );
|
198 |
+
} elseif ( 'um_update_metadata_per_page' === $cb_func ) {
|
199 |
+
|
200 |
+
if ( empty( $_POST['page'] ) ) {
|
201 |
+
wp_send_json_error( __( 'Wrong data', 'ultimate-member' ) );
|
202 |
+
}
|
203 |
+
|
204 |
+
$per_page = 500;
|
205 |
+
$wp_usermeta_option = get_option( 'um_usermeta_fields', array() );
|
206 |
+
|
207 |
+
global $wpdb;
|
208 |
+
$metadata = $wpdb->get_results(
|
209 |
+
$wpdb->prepare(
|
210 |
+
"SELECT *
|
211 |
+
FROM {$wpdb->usermeta}
|
212 |
+
WHERE meta_key IN ('" . implode( "','", $wp_usermeta_option ) . "')
|
213 |
+
LIMIT %d, %d",
|
214 |
+
( absint( $_POST['page'] ) - 1 ) * $per_page,
|
215 |
+
$per_page
|
216 |
+
),
|
217 |
+
ARRAY_A
|
218 |
+
);
|
219 |
+
|
220 |
+
$values = array();
|
221 |
+
foreach ( $metadata as $metarow ) {
|
222 |
+
$values[] = $wpdb->prepare( '(%d, %s, %s)', $metarow['user_id'], $metarow['meta_key'], $metarow['meta_value'] );
|
223 |
+
}
|
224 |
+
|
225 |
+
if ( ! empty( $values ) ) {
|
226 |
+
$wpdb->query(
|
227 |
+
"INSERT INTO
|
228 |
+
{$wpdb->prefix}um_metadata(user_id, um_key, um_value)
|
229 |
+
VALUES " . implode( ',', $values )
|
230 |
+
);
|
231 |
+
}
|
232 |
+
|
233 |
+
$from = ( absint( $_POST['page'] ) * $per_page ) - $per_page + 1;
|
234 |
+
$to = absint( $_POST['page'] ) * $per_page;
|
235 |
+
|
236 |
+
wp_send_json_success( array( 'message' => sprintf( __( 'Metadata from %1$s to %2$s was upgraded successfully...', 'ultimate-member' ), $from, $to ) ) );
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
/**
|
242 |
+
*
|
243 |
+
*/
|
244 |
+
public function init_variables() {
|
245 |
+
|
246 |
+
$settings_map = array();
|
247 |
+
|
248 |
+
$general_pages_fields = array(
|
249 |
+
array(
|
250 |
+
'id' => 'pages_settings',
|
251 |
+
'type' => 'hidden',
|
252 |
+
'value' => true,
|
253 |
+
'is_option' => false,
|
254 |
+
),
|
255 |
+
);
|
256 |
+
|
257 |
+
$core_pages = UM()->config()->core_pages;
|
258 |
+
|
259 |
+
foreach ( $core_pages as $page_s => $page ) {
|
260 |
+
$have_pages = UM()->query()->wp_pages();
|
261 |
+
$page_id = UM()->options()->get_core_page_id( $page_s );
|
262 |
+
|
263 |
+
$page_title = ! empty( $page['title'] ) ? $page['title'] : '';
|
264 |
+
|
265 |
+
if ( 'reached_maximum_limit' === $have_pages ) {
|
266 |
+
$general_pages_fields[] = array(
|
267 |
+
'id' => $page_id,
|
268 |
+
'type' => 'text',
|
269 |
+
// translators: %s: Page title
|
270 |
+
'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
|
271 |
+
'placeholder' => __( 'Add page ID', 'ultimate-member' ),
|
272 |
+
'compiler' => true,
|
273 |
+
'size' => 'small',
|
274 |
+
);
|
275 |
+
} else {
|
276 |
+
$general_pages_fields[] = array(
|
277 |
+
'id' => $page_id,
|
278 |
+
'type' => 'select',
|
279 |
+
// translators: %s: Page title
|
280 |
+
'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
|
281 |
+
'options' => UM()->query()->wp_pages(),
|
282 |
+
'placeholder' => __( 'Choose a page...', 'ultimate-member' ),
|
283 |
+
'compiler' => true,
|
284 |
+
'size' => 'small',
|
285 |
+
);
|
286 |
+
}
|
287 |
+
|
288 |
+
|
289 |
+
$settings_map[ $page_id ] = array(
|
290 |
+
'sanitize' => 'absint',
|
291 |
+
);
|
292 |
+
}
|
293 |
+
|
294 |
+
$appearances_profile_menu_fields = array(
|
295 |
+
array(
|
296 |
+
'id' => 'profile_menu',
|
297 |
+
'type' => 'checkbox',
|
298 |
+
'label' => __( 'Enable profile menu', 'ultimate-member' ),
|
299 |
+
),
|
300 |
+
);
|
301 |
+
|
302 |
+
$settings_map['profile_menu'] = array(
|
303 |
+
'sanitize' => 'bool',
|
304 |
+
);
|
305 |
+
|
306 |
+
$tabs = UM()->profile()->tabs();
|
307 |
+
|
308 |
+
$tabs_options = array();
|
309 |
+
$tabs_condition = array();
|
310 |
+
foreach ( $tabs as $id => $tab ) {
|
311 |
+
|
312 |
+
if ( ! empty( $tab['hidden'] ) ) {
|
313 |
+
continue;
|
314 |
+
}
|
315 |
+
|
316 |
+
if ( isset( $tab['name'] ) ) {
|
317 |
+
$tabs_options[ $id ] = $tab['name'];
|
318 |
+
$tabs_condition[] = 'profile_tab_' . $id;
|
319 |
+
}
|
320 |
+
|
321 |
+
if ( isset( $tab['default_privacy'] ) ) {
|
322 |
+
$fields = array(
|
323 |
+
array(
|
324 |
+
'id' => 'profile_tab_' . $id,
|
325 |
+
'type' => 'checkbox',
|
326 |
+
// translators: %s: Tab title
|
327 |
+
'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ),
|
328 |
+
'conditional' => array( 'profile_menu', '=', 1 ),
|
329 |
+
'data' => array( 'fill_profile_menu_default_tab' => $id ),
|
330 |
+
),
|
331 |
+
);
|
332 |
+
|
333 |
+
$settings_map[ 'profile_tab_' . $id ] = array(
|
334 |
+
'sanitize' => 'bool',
|
335 |
+
);
|
336 |
+
} else {
|
337 |
+
|
338 |
+
$fields = array(
|
339 |
+
array(
|
340 |
+
'id' => 'profile_tab_' . $id,
|
341 |
+
'type' => 'checkbox',
|
342 |
+
// translators: %s: Tab title
|
343 |
+
'label' => sprintf( __( '%s Tab', 'ultimate-member' ), $tab['name'] ),
|
344 |
+
'conditional' => array( 'profile_menu', '=', 1 ),
|
345 |
+
'data' => array( 'fill_profile_menu_default_tab' => $id ),
|
346 |
+
),
|
347 |
+
array(
|
348 |
+
'id' => 'profile_tab_' . $id . '_privacy',
|
349 |
+
'type' => 'select',
|
350 |
+
// translators: %s: Tab title
|
351 |
+
'label' => sprintf( __( 'Who can see %s Tab?', 'ultimate-member' ), $tab['name'] ),
|
352 |
+
'tooltip' => __( 'Select which users can view this tab.', 'ultimate-member' ),
|
353 |
+
'options' => UM()->profile()->tabs_privacy(),
|
354 |
+
'conditional' => array( 'profile_tab_' . $id, '=', 1 ),
|
355 |
+
'size' => 'small',
|
356 |
+
),
|
357 |
+
array(
|
358 |
+
'id' => 'profile_tab_' . $id . '_roles',
|
359 |
+
'type' => 'select',
|
360 |
+
'multi' => true,
|
361 |
+
'label' => __( 'Allowed roles', 'ultimate-member' ),
|
362 |
+
'tooltip' => __( 'Select the the user roles allowed to view this tab.', 'ultimate-member' ),
|
363 |
+
'options' => UM()->roles()->get_roles(),
|
364 |
+
'placeholder' => __( 'Choose user roles...', 'ultimate-member' ),
|
365 |
+
'conditional' => array( 'profile_tab_' . $id . '_privacy', '=', array( '4', '5' ) ),
|
366 |
+
'size' => 'small',
|
367 |
+
),
|
368 |
+
);
|
369 |
+
|
370 |
+
$settings_map = array_merge(
|
371 |
+
$settings_map,
|
372 |
+
array(
|
373 |
+
"profile_tab_{$id}" => array(
|
374 |
+
'sanitize' => 'bool',
|
375 |
+
),
|
376 |
+
"profile_tab_{$id}_privacy" => array(
|
377 |
+
'sanitize' => array( UM()->admin(), 'sanitize_tabs_privacy' ),
|
378 |
+
),
|
379 |
+
"profile_tab_{$id}_roles" => array(
|
380 |
+
'sanitize' => array( UM()->admin(), 'sanitize_existed_role' ),
|
381 |
+
),
|
382 |
+
)
|
383 |
+
);
|
384 |
+
}
|
385 |
+
|
386 |
+
$appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, $fields );
|
387 |
+
}
|
388 |
+
|
389 |
+
$appearances_profile_menu_fields[] = array(
|
390 |
+
'id' => 'profile_menu_default_tab',
|
391 |
+
'type' => 'select',
|
392 |
+
'label' => __( 'Profile menu default tab', 'ultimate-member' ),
|
393 |
+
'tooltip' => __( 'This will be the default tab on user profile page', 'ultimate-member' ),
|
394 |
+
'options' => $tabs_options,
|
395 |
+
'conditional' => array( implode( '|', $tabs_condition ), '~', 1 ),
|
396 |
+
'size' => 'small',
|
397 |
+
);
|
398 |
+
|
399 |
+
$settings_map['profile_menu_default_tab'] = array(
|
400 |
+
'sanitize' => 'key',
|
401 |
+
);
|
402 |
+
|
403 |
+
$appearances_profile_menu_fields = array_merge(
|
404 |
+
$appearances_profile_menu_fields,
|
405 |
+
array(
|
406 |
+
array(
|
407 |
+
'id' => 'profile_menu_icons',
|
408 |
+
'type' => 'checkbox',
|
409 |
+
'label' => __( 'Enable menu icons in desktop view', 'ultimate-member' ),
|
410 |
+
'conditional' => array( 'profile_menu', '=', 1 ),
|
411 |
+
),
|
412 |
+
)
|
413 |
+
);
|
414 |
+
|
415 |
+
$settings_map['profile_menu_icons'] = array(
|
416 |
+
'sanitize' => 'bool',
|
417 |
+
);
|
418 |
+
|
419 |
+
$post_types_options = array();
|
420 |
+
$all_post_types = get_post_types( array( 'public' => true ), 'objects' );
|
421 |
+
foreach ( $all_post_types as $key => $post_type_data ) {
|
422 |
+
$post_types_options[ $key ] = $post_type_data->labels->singular_name;
|
423 |
+
}
|
424 |
+
|
425 |
+
$duplicates = array();
|
426 |
+
$taxonomies_options = array();
|
427 |
+
$exclude_taxonomies = UM()->excluded_taxonomies();
|
428 |
+
$all_taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
|
429 |
+
foreach ( $all_taxonomies as $key => $taxonomy ) {
|
430 |
+
if ( in_array( $key, $exclude_taxonomies, true ) ) {
|
431 |
+
continue;
|
432 |
+
}
|
433 |
+
|
434 |
+
if ( ! in_array( $taxonomy->labels->singular_name, $duplicates, true ) ) {
|
435 |
+
$duplicates[] = $taxonomy->labels->singular_name;
|
436 |
+
$label = $taxonomy->labels->singular_name;
|
437 |
+
} else {
|
438 |
+
$label = $taxonomy->labels->singular_name . ' (' . $key . ')';
|
439 |
+
}
|
440 |
+
|
441 |
+
$taxonomies_options[ $key ] = $label;
|
442 |
+
}
|
443 |
+
|
444 |
+
$restricted_access_post_metabox_value = array();
|
445 |
+
$restricted_access_post_metabox = UM()->options()->get( 'restricted_access_post_metabox' );
|
446 |
+
if ( ! empty( $restricted_access_post_metabox ) && is_array( $restricted_access_post_metabox ) ) {
|
447 |
+
foreach ( $restricted_access_post_metabox as $key => $value ) {
|
448 |
+
if ( $value ) {
|
449 |
+
$restricted_access_post_metabox_value[] = $key;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
+
|
455 |
+
$restricted_access_taxonomy_metabox_value = array();
|
456 |
+
$restricted_access_taxonomy_metabox = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
457 |
+
if ( ! empty( $restricted_access_taxonomy_metabox ) && is_array( $restricted_access_taxonomy_metabox ) ) {
|
458 |
+
foreach ( $restricted_access_taxonomy_metabox as $key => $value ) {
|
459 |
+
if ( $value ) {
|
460 |
+
$restricted_access_taxonomy_metabox_value[] = $key;
|
461 |
+
}
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
$access_fields = array(
|
466 |
+
array(
|
467 |
+
'id' => 'accessible',
|
468 |
+
'type' => 'select',
|
469 |
+
'label' => __( 'Global Site Access', 'ultimate-member' ),
|
470 |
+
'tooltip' => __( 'Globally control the access of your site, you can have separate restrict options per post/page by editing the desired item.', 'ultimate-member' ),
|
471 |
+
'options' => array(
|
472 |
+
0 => __( 'Site accessible to Everyone', 'ultimate-member' ),
|
473 |
+
2 => __( 'Site accessible to Logged In Users', 'ultimate-member' ),
|
474 |
+
),
|
475 |
+
'size' => 'medium',
|
476 |
+
),
|
477 |
+
array(
|
478 |
+
'id' => 'access_redirect',
|
479 |
+
'type' => 'text',
|
480 |
+
'label' => __( 'Custom Redirect URL', 'ultimate-member' ),
|
481 |
+
'tooltip' => __( 'A logged out user will be redirected to this url If he is not permitted to access the site', 'ultimate-member' ),
|
482 |
+
'conditional' => array( 'accessible', '=', 2 ),
|
483 |
+
),
|
484 |
+
array(
|
485 |
+
'id' => 'access_exclude_uris',
|
486 |
+
'type' => 'multi_text',
|
487 |
+
'label' => __( 'Exclude the following URLs', 'ultimate-member' ),
|
488 |
+
'tooltip' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone', 'ultimate-member' ),
|
489 |
+
'add_text' => __( 'Add New URL', 'ultimate-member' ),
|
490 |
+
'conditional' => array( 'accessible', '=', 2 ),
|
491 |
+
'show_default_number' => 0,
|
492 |
+
),
|
493 |
+
array(
|
494 |
+
'id' => 'home_page_accessible',
|
495 |
+
'type' => 'checkbox',
|
496 |
+
'label' => __( 'Allow Homepage to be accessible', 'ultimate-member' ),
|
497 |
+
'conditional' => array( 'accessible', '=', 2 ),
|
498 |
+
),
|
499 |
+
array(
|
500 |
+
'id' => 'category_page_accessible',
|
501 |
+
'type' => 'checkbox',
|
502 |
+
'label' => __( 'Allow Category pages to be accessible', 'ultimate-member' ),
|
503 |
+
'conditional' => array( 'accessible', '=', 2 ),
|
504 |
+
),
|
505 |
+
array(
|
506 |
+
'id' => 'restricted_post_title_replace',
|
507 |
+
'type' => 'checkbox',
|
508 |
+
'label' => __( 'Replace the restricted Post Title', 'ultimate-member' ),
|
509 |
+
'tooltip' => __( 'Allow to replace the restricted post title to users that do not have permission to view the content', 'ultimate-member' ),
|
510 |
+
),
|
511 |
+
array(
|
512 |
+
'id' => 'restricted_access_post_title',
|
513 |
+
'type' => 'text',
|
514 |
+
'label' => __( 'Restricted Access Post Title', 'ultimate-member' ),
|
515 |
+
'tooltip' => __( 'This is the post title shown to users that do not have permission to view the content', 'ultimate-member' ),
|
516 |
+
'conditional' => array( 'restricted_post_title_replace', '=', 1 ),
|
517 |
+
),
|
518 |
+
array(
|
519 |
+
'id' => 'restricted_access_message',
|
520 |
+
'type' => 'wp_editor',
|
521 |
+
'label' => __( 'Restricted Access Message', 'ultimate-member' ),
|
522 |
+
'tooltip' => __( 'This is the message shown to users that do not have permission to view the content', 'ultimate-member' ),
|
523 |
+
),
|
524 |
+
);
|
525 |
+
|
526 |
+
$settings_map = array_merge(
|
527 |
+
$settings_map,
|
528 |
+
array(
|
529 |
+
'accessible' => array(
|
530 |
+
'sanitize' => 'int',
|
531 |
+
),
|
532 |
+
'access_redirect' => array(
|
533 |
+
'sanitize' => 'url',
|
534 |
+
),
|
535 |
+
'access_exclude_uris' => array(
|
536 |
+
'sanitize' => 'url',
|
537 |
+
),
|
538 |
+
'home_page_accessible' => array(
|
539 |
+
'sanitize' => 'bool',
|
540 |
+
),
|
541 |
+
'category_page_accessible' => array(
|
542 |
+
'sanitize' => 'bool',
|
543 |
+
),
|
544 |
+
'restricted_post_title_replace' => array(
|
545 |
+
'sanitize' => 'bool',
|
546 |
+
),
|
547 |
+
'restricted_access_post_title' => array(
|
548 |
+
'sanitize' => 'text',
|
549 |
+
),
|
550 |
+
'restricted_access_message' => array(
|
551 |
+
'sanitize' => 'wp_kses',
|
552 |
+
),
|
553 |
+
)
|
554 |
+
);
|
555 |
+
|
556 |
+
global $wp_version;
|
557 |
+
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
|
558 |
+
$access_fields = array_merge(
|
559 |
+
$access_fields,
|
560 |
+
array(
|
561 |
+
array(
|
562 |
+
'id' => 'restricted_blocks',
|
563 |
+
'type' => 'checkbox',
|
564 |
+
'label' => __( 'Enable the "Content Restriction" settings for the Gutenberg Blocks', 'ultimate-member' ),
|
565 |
+
),
|
566 |
+
array(
|
567 |
+
'id' => 'restricted_block_message',
|
568 |
+
'type' => 'textarea',
|
569 |
+
'label' => __( 'Restricted Access Block Message', 'ultimate-member' ),
|
570 |
+
'tooltip' => __( 'This is the message shown to users that do not have permission to view the block\'s content', 'ultimate-member' ),
|
571 |
+
'conditional' => array( 'restricted_blocks', '=', 1 ),
|
572 |
+
),
|
573 |
+
)
|
574 |
+
);
|
575 |
+
|
576 |
+
$settings_map['restricted_blocks'] = array(
|
577 |
+
'sanitize' => 'bool',
|
578 |
+
);
|
579 |
+
$settings_map['restricted_block_message'] = array(
|
580 |
+
'sanitize' => 'textarea',
|
581 |
+
);
|
582 |
+
}
|
583 |
+
|
584 |
+
$access_fields = array_merge(
|
585 |
+
$access_fields,
|
586 |
+
array(
|
587 |
+
array(
|
588 |
+
'id' => 'restricted_access_post_metabox',
|
589 |
+
'type' => 'hidden',
|
590 |
+
'value' => '',
|
591 |
+
),
|
592 |
+
array(
|
593 |
+
'id' => 'restricted_access_taxonomy_metabox',
|
594 |
+
'type' => 'hidden',
|
595 |
+
'value' => '',
|
596 |
+
),
|
597 |
+
array(
|
598 |
+
'id' => 'restricted_access_post_metabox',
|
599 |
+
'type' => 'multi_checkbox',
|
600 |
+
'label' => __( 'Enable the "Content Restriction" settings for post types', 'ultimate-member' ),
|
601 |
+
'tooltip' => __( 'Check post types for which you plan to use the "Content Restriction" settings', 'ultimate-member' ),
|
602 |
+
'options' => $post_types_options,
|
603 |
+
'columns' => 3,
|
604 |
+
'value' => $restricted_access_post_metabox_value,
|
605 |
+
'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ),
|
606 |
+
),
|
607 |
+
array(
|
608 |
+
'id' => 'restricted_access_taxonomy_metabox',
|
609 |
+
'type' => 'multi_checkbox',
|
610 |
+
'label' => __( 'Enable the "Content Restriction" settings for taxonomies', 'ultimate-member' ),
|
611 |
+
'tooltip' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings', 'ultimate-member' ),
|
612 |
+
'options' => $taxonomies_options,
|
613 |
+
'columns' => 3,
|
614 |
+
'value' => $restricted_access_taxonomy_metabox_value,
|
615 |
+
'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ),
|
616 |
+
),
|
617 |
+
)
|
618 |
+
);
|
619 |
+
|
620 |
+
$settings_map = array_merge(
|
621 |
+
$settings_map,
|
622 |
+
array(
|
623 |
+
'restricted_access_post_metabox' => array(
|
624 |
+
'sanitize' => 'key',
|
625 |
+
),
|
626 |
+
'restricted_access_taxonomy_metabox' => array(
|
627 |
+
'sanitize' => 'key',
|
628 |
+
),
|
629 |
+
)
|
630 |
+
);
|
631 |
+
|
632 |
+
$latest_update = get_option( 'um_member_directory_update_meta', false );
|
633 |
+
$latest_truncate = get_option( 'um_member_directory_truncated', false );
|
634 |
+
|
635 |
+
$same_page_update = array(
|
636 |
+
'id' => 'member_directory_own_table',
|
637 |
+
'type' => 'same_page_update',
|
638 |
+
'label' => __( 'Enable custom table for usermeta', 'ultimate-member' ),
|
639 |
+
'tooltip' => __( 'Check this box if you would like to enable the use of a custom table for user metadata. Improved performance for member directory searches.', 'ultimate-member' ),
|
640 |
+
);
|
641 |
+
|
642 |
+
if ( empty( $latest_update ) || ( ! empty( $latest_truncate ) && $latest_truncate > $latest_update ) ) {
|
643 |
+
$same_page_update['upgrade_cb'] = 'sync_metatable';
|
644 |
+
$same_page_update['upgrade_description'] = '<p>' . __( 'We recommend creating a backup of your site before running the update process. Do not exit the page before the update process has complete.', 'ultimate-member' ) . '</p>
|
645 |
+
<p>' . __( 'After clicking the <strong>"Run"</strong> button, the update process will start. All information will be displayed in the field below.', 'ultimate-member' ) . '</p>
|
646 |
+
<p>' . __( 'If the update was successful, you will see a corresponding message. Otherwise, contact technical support if the update failed.', 'ultimate-member' ) . '</p>';
|
647 |
+
}
|
648 |
+
|
649 |
+
$settings_map = array_merge(
|
650 |
+
$settings_map,
|
651 |
+
array(
|
652 |
+
'permalink_base' => array(
|
653 |
+
'sanitize' => 'key',
|
654 |
+
),
|
655 |
+
'display_name' => array(
|
656 |
+
'sanitize' => 'key',
|
657 |
+
),
|
658 |
+
'display_name_field' => array(
|
659 |
+
'sanitize' => 'text',
|
660 |
+
),
|
661 |
+
'author_redirect' => array(
|
662 |
+
'sanitize' => 'bool',
|
663 |
+
),
|
664 |
+
'members_page' => array(
|
665 |
+
'sanitize' => 'bool',
|
666 |
+
),
|
667 |
+
'use_gravatars' => array(
|
668 |
+
'sanitize' => 'bool',
|
669 |
+
),
|
670 |
+
'use_um_gravatar_default_builtin_image' => array(
|
671 |
+
'sanitize' => 'key',
|
672 |
+
),
|
673 |
+
'use_um_gravatar_default_image' => array(
|
674 |
+
'sanitize' => 'bool',
|
675 |
+
),
|
676 |
+
'reset_require_strongpass' => array(
|
677 |
+
'sanitize' => 'bool',
|
678 |
+
),
|
679 |
+
'password_min_chars' => array(
|
680 |
+
'sanitize' => 'absint',
|
681 |
+
),
|
682 |
+
'password_max_chars' => array(
|
683 |
+
'sanitize' => 'absint',
|
684 |
+
),
|
685 |
+
'profile_noindex' => array(
|
686 |
+
'sanitize' => 'bool',
|
687 |
+
),
|
688 |
+
'activation_link_expiry_time' => array(
|
689 |
+
'sanitize' => 'absint',
|
690 |
+
),
|
691 |
+
'account_tab_password' => array(
|
692 |
+
'sanitize' => 'bool',
|
693 |
+
),
|
694 |
+
'account_tab_privacy' => array(
|
695 |
+
'sanitize' => 'bool',
|
696 |
+
),
|
697 |
+
'account_tab_notifications' => array(
|
698 |
+
'sanitize' => 'bool',
|
699 |
+
),
|
700 |
+
'account_tab_delete' => array(
|
701 |
+
'sanitize' => 'bool',
|
702 |
+
),
|
703 |
+
'delete_account_text' => array(
|
704 |
+
'sanitize' => 'textarea',
|
705 |
+
),
|
706 |
+
'delete_account_no_pass_required_text' => array(
|
707 |
+
'sanitize' => 'textarea',
|
708 |
+
),
|
709 |
+
'account_name' => array(
|
710 |
+
'sanitize' => 'bool',
|
711 |
+
),
|
712 |
+
'account_name_disable' => array(
|
713 |
+
'sanitize' => 'bool',
|
714 |
+
),
|
715 |
+
'account_name_require' => array(
|
716 |
+
'sanitize' => 'bool',
|
717 |
+
),
|
718 |
+
'account_email' => array(
|
719 |
+
'sanitize' => 'bool',
|
720 |
+
),
|
721 |
+
'account_general_password' => array(
|
722 |
+
'sanitize' => 'bool',
|
723 |
+
),
|
724 |
+
'account_require_strongpass' => array(
|
725 |
+
'sanitize' => 'bool',
|
726 |
+
),
|
727 |
+
'account_hide_in_directory' => array(
|
728 |
+
'sanitize' => 'bool',
|
729 |
+
),
|
730 |
+
'account_hide_in_directory_default' => array(
|
731 |
+
'sanitize' => 'text',
|
732 |
+
),
|
733 |
+
'profile_photo_max_size' => array(
|
734 |
+
'sanitize' => 'absint',
|
735 |
+
),
|
736 |
+
'cover_photo_max_size' => array(
|
737 |
+
'sanitize' => 'absint',
|
738 |
+
),
|
739 |
+
'photo_thumb_sizes' => array(
|
740 |
+
'sanitize' => 'absint',
|
741 |
+
),
|
742 |
+
'cover_thumb_sizes' => array(
|
743 |
+
'sanitize' => 'absint',
|
744 |
+
),
|
745 |
+
'image_orientation_by_exif' => array(
|
746 |
+
'sanitize' => 'bool',
|
747 |
+
),
|
748 |
+
'image_compression' => array(
|
749 |
+
'sanitize' => 'absint',
|
750 |
+
),
|
751 |
+
'image_max_width' => array(
|
752 |
+
'sanitize' => 'absint',
|
753 |
+
),
|
754 |
+
'cover_min_width' => array(
|
755 |
+
'sanitize' => 'absint',
|
756 |
+
),
|
757 |
+
'enable_reset_password_limit' => array(
|
758 |
+
'sanitize' => 'bool',
|
759 |
+
),
|
760 |
+
'reset_password_limit_number' => array(
|
761 |
+
'sanitize' => 'absint',
|
762 |
+
),
|
763 |
+
'blocked_emails' => array(
|
764 |
+
'sanitize' => 'textarea',
|
765 |
+
),
|
766 |
+
'blocked_words' => array(
|
767 |
+
'sanitize' => 'textarea',
|
768 |
+
),
|
769 |
+
'admin_email' => array(
|
770 |
+
'sanitize' => 'text',
|
771 |
+
),
|
772 |
+
'mail_from' => array(
|
773 |
+
'sanitize' => 'text',
|
774 |
+
),
|
775 |
+
'mail_from_addr' => array(
|
776 |
+
'sanitize' => 'text',
|
777 |
+
),
|
778 |
+
'email_html' => array(
|
779 |
+
'sanitize' => 'bool',
|
780 |
+
),
|
781 |
+
'profile_template' => array(
|
782 |
+
'sanitize' => 'text',
|
783 |
+
),
|
784 |
+
'profile_max_width' => array(
|
785 |
+
'sanitize' => 'text',
|
786 |
+
),
|
787 |
+
'profile_area_max_width' => array(
|
788 |
+
'sanitize' => 'text',
|
789 |
+
),
|
790 |
+
'profile_icons' => array(
|
791 |
+
'sanitize' => 'key',
|
792 |
+
),
|
793 |
+
'profile_primary_btn_word' => array(
|
794 |
+
'sanitize' => 'text',
|
795 |
+
),
|
796 |
+
'profile_secondary_btn' => array(
|
797 |
+
'sanitize' => 'bool',
|
798 |
+
),
|
799 |
+
'profile_secondary_btn_word' => array(
|
800 |
+
'sanitize' => 'text',
|
801 |
+
),
|
802 |
+
'default_avatar' => array(
|
803 |
+
'sanitize' => 'url',
|
804 |
+
),
|
805 |
+
'default_cover' => array(
|
806 |
+
'sanitize' => 'url',
|
807 |
+
),
|
808 |
+
'disable_profile_photo_upload' => array(
|
809 |
+
'sanitize' => 'bool',
|
810 |
+
),
|
811 |
+
'profile_photosize' => array(
|
812 |
+
'sanitize' => array( UM()->admin(), 'sanitize_photosize' ),
|
813 |
+
),
|
814 |
+
'profile_cover_enabled' => array(
|
815 |
+
'sanitize' => 'bool',
|
816 |
+
),
|
817 |
+
'profile_coversize' => array(
|
818 |
+
'sanitize' => array( UM()->admin(), 'sanitize_cover_photosize' ),
|
819 |
+
),
|
820 |
+
'profile_cover_ratio' => array(
|
821 |
+
'sanitize' => 'text',
|
822 |
+
),
|
823 |
+
'profile_show_metaicon' => array(
|
824 |
+
'sanitize' => 'bool',
|
825 |
+
),
|
826 |
+
'profile_show_name' => array(
|
827 |
+
'sanitize' => 'bool',
|
828 |
+
),
|
829 |
+
'profile_show_social_links' => array(
|
830 |
+
'sanitize' => 'bool',
|
831 |
+
),
|
832 |
+
'profile_show_bio' => array(
|
833 |
+
'sanitize' => 'bool',
|
834 |
+
),
|
835 |
+
'profile_show_html_bio' => array(
|
836 |
+
'sanitize' => 'bool',
|
837 |
+
),
|
838 |
+
'profile_bio_maxchars' => array(
|
839 |
+
'sanitize' => 'absint',
|
840 |
+
),
|
841 |
+
'profile_header_menu' => array(
|
842 |
+
'sanitize' => 'key',
|
843 |
+
),
|
844 |
+
'profile_empty_text' => array(
|
845 |
+
'sanitize' => 'bool',
|
846 |
+
),
|
847 |
+
'profile_empty_text_emo' => array(
|
848 |
+
'sanitize' => 'bool',
|
849 |
+
),
|
850 |
+
'register_template' => array(
|
851 |
+
'sanitize' => 'text',
|
852 |
+
),
|
853 |
+
'register_max_width' => array(
|
854 |
+
'sanitize' => 'text',
|
855 |
+
),
|
856 |
+
'register_align' => array(
|
857 |
+
'sanitize' => 'key',
|
858 |
+
),
|
859 |
+
'register_icons' => array(
|
860 |
+
'sanitize' => 'key',
|
861 |
+
),
|
862 |
+
'register_primary_btn_word' => array(
|
863 |
+
'sanitize' => 'text',
|
864 |
+
),
|
865 |
+
'register_secondary_btn' => array(
|
866 |
+
'sanitize' => 'bool',
|
867 |
+
),
|
868 |
+
'register_secondary_btn_word' => array(
|
869 |
+
'sanitize' => 'text',
|
870 |
+
),
|
871 |
+
'register_secondary_btn_url' => array(
|
872 |
+
'sanitize' => 'url',
|
873 |
+
),
|
874 |
+
'register_role' => array(
|
875 |
+
'sanitize' => 'key',
|
876 |
+
),
|
877 |
+
'login_template' => array(
|
878 |
+
'sanitize' => 'text',
|
879 |
+
),
|
880 |
+
'login_max_width' => array(
|
881 |
+
'sanitize' => 'text',
|
882 |
+
),
|
883 |
+
'login_align' => array(
|
884 |
+
'sanitize' => 'key',
|
885 |
+
),
|
886 |
+
'login_icons' => array(
|
887 |
+
'sanitize' => 'key',
|
888 |
+
),
|
889 |
+
'login_primary_btn_word' => array(
|
890 |
+
'sanitize' => 'text',
|
891 |
+
),
|
892 |
+
'login_secondary_btn' => array(
|
893 |
+
'sanitize' => 'bool',
|
894 |
+
),
|
895 |
+
'login_secondary_btn_word' => array(
|
896 |
+
'sanitize' => 'text',
|
897 |
+
),
|
898 |
+
'login_secondary_btn_url' => array(
|
899 |
+
'sanitize' => 'url',
|
900 |
+
),
|
901 |
+
'login_forgot_pass_link' => array(
|
902 |
+
'sanitize' => 'bool',
|
903 |
+
),
|
904 |
+
'login_show_rememberme' => array(
|
905 |
+
'sanitize' => 'bool',
|
906 |
+
),
|
907 |
+
'form_asterisk' => array(
|
908 |
+
'sanitize' => 'bool',
|
909 |
+
),
|
910 |
+
'profile_title' => array(
|
911 |
+
'sanitize' => 'text',
|
912 |
+
),
|
913 |
+
'profile_desc' => array(
|
914 |
+
'sanitize' => 'textarea',
|
915 |
+
),
|
916 |
+
'um_profile_object_cache_stop' => array(
|
917 |
+
'sanitize' => 'bool',
|
918 |
+
),
|
919 |
+
'enable_blocks' => array(
|
920 |
+
'sanitize' => 'bool',
|
921 |
+
),
|
922 |
+
'rest_api_version' => array(
|
923 |
+
'sanitize' => 'text',
|
924 |
+
),
|
925 |
+
'uninstall_on_delete' => array(
|
926 |
+
'sanitize' => 'bool',
|
927 |
+
),
|
928 |
+
)
|
929 |
+
);
|
930 |
+
|
931 |
+
$this->settings_map = apply_filters( 'um_settings_map', $settings_map );
|
932 |
+
|
933 |
+
/**
|
934 |
+
* UM hook
|
935 |
+
*
|
936 |
+
* @type filter
|
937 |
+
* @title um_settings_structure
|
938 |
+
* @description Extend UM Settings
|
939 |
+
* @input_vars
|
940 |
+
* [{"var":"$settings","type":"array","desc":"UM Settings"}]
|
941 |
+
* @change_log
|
942 |
+
* ["Since: 2.0"]
|
943 |
+
* @usage add_filter( 'um_settings_structure', 'function_name', 10, 1 );
|
944 |
+
* @example
|
945 |
+
* <?php
|
946 |
+
* add_filter( 'um_settings_structure', 'my_settings_structure', 10, 1 );
|
947 |
+
* function my_settings_structure( $settings ) {
|
948 |
+
* // your code here
|
949 |
+
* return $settings;
|
950 |
+
* }
|
951 |
+
* ?>
|
952 |
+
*/
|
953 |
+
$this->settings_structure = apply_filters(
|
954 |
+
'um_settings_structure',
|
955 |
+
array(
|
956 |
+
'' => array(
|
957 |
+
'title' => __( 'General', 'ultimate-member' ),
|
958 |
+
'sections' => array(
|
959 |
+
'' => array(
|
960 |
+
'title' => __( 'Pages', 'ultimate-member' ),
|
961 |
+
'fields' => $general_pages_fields,
|
962 |
+
),
|
963 |
+
'users' => array(
|
964 |
+
'title' => __( 'Users', 'ultimate-member' ),
|
965 |
+
'fields' => array(
|
966 |
+
array(
|
967 |
+
'id' => 'permalink_base',
|
968 |
+
'type' => 'select',
|
969 |
+
'size' => 'small',
|
970 |
+
'label' => __( 'Profile Permalink Base', 'ultimate-member' ),
|
971 |
+
// translators: %s: Profile page URL
|
972 |
+
'tooltip' => sprintf( __( 'Here you can control the permalink structure of the user profile URL globally e.g. %s<strong>username</strong>/', 'ultimate-member' ), trailingslashit( um_get_core_page( 'user' ) ) ),
|
973 |
+
'options' => array(
|
974 |
+
'user_login' => __( 'Username', 'ultimate-member' ),
|
975 |
+
'name' => __( 'First and Last Name with \'.\'', 'ultimate-member' ),
|
976 |
+
'name_dash' => __( 'First and Last Name with \'-\'', 'ultimate-member' ),
|
977 |
+
'name_plus' => __( 'First and Last Name with \'+\'', 'ultimate-member' ),
|
978 |
+
'user_id' => __( 'User ID', 'ultimate-member' ),
|
979 |
+
),
|
980 |
+
'placeholder' => __( 'Select...', 'ultimate-member' ),
|
981 |
+
),
|
982 |
+
array(
|
983 |
+
'id' => 'display_name',
|
984 |
+
'type' => 'select',
|
985 |
+
'size' => 'medium',
|
986 |
+
'label' => __( 'User Display Name', 'ultimate-member' ),
|
987 |
+
'tooltip' => __( 'This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists', 'ultimate-member' ),
|
988 |
+
'options' => array(
|
989 |
+
'default' => __( 'Default WP Display Name', 'ultimate-member' ),
|
990 |
+
'nickname' => __( 'Nickname', 'ultimate-member' ),
|
991 |
+
'username' => __( 'Username', 'ultimate-member' ),
|
992 |
+
'full_name' => __( 'First name & last name', 'ultimate-member' ),
|
993 |
+
'sur_name' => __( 'Last name & first name', 'ultimate-member' ),
|
994 |
+
'initial_name' => __( 'First name & first initial of last name', 'ultimate-member' ),
|
995 |
+
'initial_name_f' => __( 'First initial of first name & last name', 'ultimate-member' ),
|
996 |
+
'first_name' => __( 'First name only', 'ultimate-member' ),
|
997 |
+
'field' => __( 'Custom field(s)', 'ultimate-member' ),
|
998 |
+
),
|
999 |
+
'placeholder' => __( 'Select...', 'ultimate-member' ),
|
1000 |
+
),
|
1001 |
+
array(
|
1002 |
+
'id' => 'display_name_field',
|
1003 |
+
'type' => 'text',
|
1004 |
+
'label' => __( 'Display Name Custom Field(s)', 'ultimate-member' ),
|
1005 |
+
'tooltip' => __( 'Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site', 'ultimate-member' ),
|
1006 |
+
'conditional' => array( 'display_name', '=', 'field' ),
|
1007 |
+
),
|
1008 |
+
array(
|
1009 |
+
'id' => 'author_redirect',
|
1010 |
+
'type' => 'checkbox',
|
1011 |
+
'label' => __( 'Automatically redirect author page to their profile?', 'ultimate-member' ),
|
1012 |
+
'tooltip' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ),
|
1013 |
+
),
|
1014 |
+
array(
|
1015 |
+
'id' => 'members_page',
|
1016 |
+
'type' => 'checkbox',
|
1017 |
+
'label' => __( 'Enable Members Directory', 'ultimate-member' ),
|
1018 |
+
'tooltip' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ),
|
1019 |
+
),
|
1020 |
+
array(
|
1021 |
+
'id' => 'use_gravatars',
|
1022 |
+
'type' => 'checkbox',
|
1023 |
+
'label' => __( 'Use Gravatars?', 'ultimate-member' ),
|
1024 |
+
'tooltip' => __( 'Do you want to use gravatars instead of the default plugin profile photo (If the user did not upload a custom profile photo / avatar)', 'ultimate-member' ),
|
1025 |
+
),
|
1026 |
+
array(
|
1027 |
+
'id' => 'use_um_gravatar_default_builtin_image',
|
1028 |
+
'type' => 'select',
|
1029 |
+
'label' => __( 'Use Gravatar builtin image', 'ultimate-member' ),
|
1030 |
+
'tooltip' => __( 'Gravatar has a number of built in options which you can also use as defaults', 'ultimate-member' ),
|
1031 |
+
'options' => array(
|
1032 |
+
'default' => __( 'Default', 'ultimate-member' ),
|
1033 |
+
'404' => __( '404 ( File Not Found response )', 'ultimate-member' ),
|
1034 |
+
'mm' => __( 'Mystery Man', 'ultimate-member' ),
|
1035 |
+
'identicon' => __( 'Identicon', 'ultimate-member' ),
|
1036 |
+
'monsterid' => __( 'Monsterid', 'ultimate-member' ),
|
1037 |
+
'wavatar' => __( 'Wavatar', 'ultimate-member' ),
|
1038 |
+
'retro' => __( 'Retro', 'ultimate-member' ),
|
1039 |
+
'blank' => __( 'Blank ( a transparent PNG image )', 'ultimate-member' ),
|
1040 |
+
),
|
1041 |
+
'conditional' => array( 'use_gravatars', '=', 1 ),
|
1042 |
+
'size' => 'medium',
|
1043 |
+
),
|
1044 |
+
array(
|
1045 |
+
'id' => 'use_um_gravatar_default_image',
|
1046 |
+
'type' => 'checkbox',
|
1047 |
+
'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ),
|
1048 |
+
'tooltip' => __( 'Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)', 'ultimate-member' ),
|
1049 |
+
'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
|
1050 |
+
),
|
1051 |
+
array(
|
1052 |
+
'id' => 'reset_require_strongpass',
|
1053 |
+
'type' => 'checkbox',
|
1054 |
+
'label' => __( 'Require a strong password? (when user resets password only)', 'ultimate-member' ),
|
1055 |
+
'tooltip' => __( 'Enable or disable a strong password rules on password reset and change procedure', 'ultimate-member' ),
|
1056 |
+
),
|
1057 |
+
array(
|
1058 |
+
'id' => 'password_min_chars',
|
1059 |
+
'type' => 'number',
|
1060 |
+
'label' => __( 'Password minimum length', 'ultimate-member' ),
|
1061 |
+
'tooltip' => __( 'If you want to enable a minimum number of characters to be in password. User password field in the UM forms has own settings for that. Leave empty to use default value 8', 'ultimate-member' ),
|
1062 |
+
'size' => 'small',
|
1063 |
+
),
|
1064 |
+
array(
|
1065 |
+
'id' => 'password_max_chars',
|
1066 |
+
'type' => 'number',
|
1067 |
+
'label' => __( 'Password maximum length', 'ultimate-member' ),
|
1068 |
+
'tooltip' => __( 'If you want to enable a maximum number of characters to be in password. User password field in the UM forms has own settings for that. Leave empty to use default value 30', 'ultimate-member' ),
|
1069 |
+
'size' => 'small',
|
1070 |
+
),
|
1071 |
+
array(
|
1072 |
+
'id' => 'profile_noindex',
|
1073 |
+
'type' => 'select',
|
1074 |
+
'size' => 'small',
|
1075 |
+
'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ),
|
1076 |
+
'tooltip' => __( 'Hides the profile page for robots. This setting can be overridden by individual role settings.', 'ultimate-member' ),
|
1077 |
+
'options' => array(
|
1078 |
+
'0' => __( 'No', 'ultimate-member' ),
|
1079 |
+
'1' => __( 'Yes', 'ultimate-member' ),
|
1080 |
+
),
|
1081 |
+
),
|
1082 |
+
array(
|
1083 |
+
'id' => 'activation_link_expiry_time',
|
1084 |
+
'type' => 'number',
|
1085 |
+
'label' => __( 'Activation link lifetime', 'ultimate-member' ),
|
1086 |
+
'tooltip' => __( 'How long does an activation link live in seconds? Leave empty for endless links.', 'ultimate-member' ),
|
1087 |
+
'size' => 'small',
|
1088 |
+
),
|
1089 |
+
),
|
1090 |
+
),
|
1091 |
+
'account' => array(
|
1092 |
+
'title' => __( 'Account', 'ultimate-member' ),
|
1093 |
+
'fields' => array(
|
1094 |
+
array(
|
1095 |
+
'id' => 'account_tab_password',
|
1096 |
+
'type' => 'checkbox',
|
1097 |
+
'label' => __( 'Password Account Tab', 'ultimate-member' ),
|
1098 |
+
'tooltip' => __( 'Enable/disable the Password account tab in account page', 'ultimate-member' ),
|
1099 |
+
),
|
1100 |
+
array(
|
1101 |
+
'id' => 'account_tab_privacy',
|
1102 |
+
'type' => 'checkbox',
|
1103 |
+
'label' => __( 'Privacy Account Tab', 'ultimate-member' ),
|
1104 |
+
'tooltip' => __( 'Enable/disable the Privacy account tab in account page', 'ultimate-member' ),
|
1105 |
+
),
|
1106 |
+
array(
|
1107 |
+
'id' => 'account_tab_notifications',
|
1108 |
+
'type' => 'checkbox',
|
1109 |
+
'label' => __( 'Notifications Account Tab', 'ultimate-member' ),
|
1110 |
+
'tooltip' => __( 'Enable/disable the Notifications account tab in account page', 'ultimate-member' ),
|
1111 |
+
),
|
1112 |
+
array(
|
1113 |
+
'id' => 'account_tab_delete',
|
1114 |
+
'type' => 'checkbox',
|
1115 |
+
'label' => __( 'Delete Account Tab', 'ultimate-member' ),
|
1116 |
+
'tooltip' => __( 'Enable/disable the Delete account tab in account page', 'ultimate-member' ),
|
1117 |
+
),
|
1118 |
+
array(
|
1119 |
+
'id' => 'delete_account_text',
|
1120 |
+
'type' => 'textarea', // bug with wp 4.4? should be editor
|
1121 |
+
'label' => __( 'Account Deletion Custom Text', 'ultimate-member' ),
|
1122 |
+
'tooltip' => __( 'This is custom text that will be displayed to users before they delete their accounts from your site when password is required.', 'ultimate-member' ),
|
1123 |
+
'args' => array(
|
1124 |
+
'textarea_rows' => 6,
|
1125 |
+
),
|
1126 |
+
),
|
1127 |
+
array(
|
1128 |
+
'id' => 'delete_account_no_pass_required_text',
|
1129 |
+
'type' => 'textarea',
|
1130 |
+
'label' => __( 'Account Deletion without password Custom Text', 'ultimate-member' ),
|
1131 |
+
'tooltip' => __( 'This is custom text that will be displayed to users before they delete their accounts from your site when password isn\'t required.', 'ultimate-member' ),
|
1132 |
+
'args' => array(
|
1133 |
+
'textarea_rows' => 6,
|
1134 |
+
),
|
1135 |
+
),
|
1136 |
+
array(
|
1137 |
+
'id' => 'account_name',
|
1138 |
+
'type' => 'checkbox',
|
1139 |
+
'label' => __( 'Add a First & Last Name fields', 'ultimate-member' ),
|
1140 |
+
'tooltip' => __( 'Whether to enable these fields on the user account page by default or hide them.', 'ultimate-member' ),
|
1141 |
+
),
|
1142 |
+
array(
|
1143 |
+
'id' => 'account_name_disable',
|
1144 |
+
'type' => 'checkbox',
|
1145 |
+
'label' => __( 'Disable First & Last Name fields', 'ultimate-member' ),
|
1146 |
+
'tooltip' => __( 'Whether to allow users changing their first and last name in account page.', 'ultimate-member' ),
|
1147 |
+
'conditional' => array( 'account_name', '=', '1' ),
|
1148 |
+
),
|
1149 |
+
array(
|
1150 |
+
'id' => 'account_name_require',
|
1151 |
+
'type' => 'checkbox',
|
1152 |
+
'label' => __( 'Require First & Last Name', 'ultimate-member' ),
|
1153 |
+
'tooltip' => __( 'Require first and last name?', 'ultimate-member' ),
|
1154 |
+
'conditional' => array( 'account_name', '=', '1' ),
|
1155 |
+
),
|
1156 |
+
array(
|
1157 |
+
'id' => 'account_email',
|
1158 |
+
'type' => 'checkbox',
|
1159 |
+
'label' => __( 'Allow users to change e-mail', 'ultimate-member' ),
|
1160 |
+
'tooltip' => __( 'Whether to allow users changing their email in account page.', 'ultimate-member' ),
|
1161 |
+
),
|
1162 |
+
array(
|
1163 |
+
'id' => 'account_general_password',
|
1164 |
+
'type' => 'checkbox',
|
1165 |
+
'label' => __( 'Password is required?', 'ultimate-member' ),
|
1166 |
+
'tooltip' => __( 'Password is required to save account data.', 'ultimate-member' ),
|
1167 |
+
),
|
1168 |
+
array(
|
1169 |
+
'id' => 'account_require_strongpass',
|
1170 |
+
'type' => 'checkbox',
|
1171 |
+
'label' => __( 'Require a strong password?', 'ultimate-member' ),
|
1172 |
+
'tooltip' => __( 'Enable or disable a strong password rules on account page / change password tab', 'ultimate-member' ),
|
1173 |
+
),
|
1174 |
+
array(
|
1175 |
+
'id' => 'account_hide_in_directory',
|
1176 |
+
'type' => 'checkbox',
|
1177 |
+
'label' => __( 'Allow users to hide their profiles from directory', 'ultimate-member' ),
|
1178 |
+
'tooltip' => __( 'Whether to allow users changing their profile visibility from member directory in account page.', 'ultimate-member' ),
|
1179 |
+
'conditional' => array( 'account_tab_privacy', '=', '1' ),
|
1180 |
+
),
|
1181 |
+
array(
|
1182 |
+
'id' => 'account_hide_in_directory_default',
|
1183 |
+
'type' => 'select',
|
1184 |
+
'label' => __( 'Hide profiles from directory by default', 'ultimate-member' ),
|
1185 |
+
'tooltip' => __( 'Set default value for the "Hide my profile from directory" option', 'ultimate-member' ),
|
1186 |
+
'options' => array(
|
1187 |
+
'No' => __( 'No', 'ultimate-member' ),
|
1188 |
+
'Yes' => __( 'Yes', 'ultimate-member' ),
|
1189 |
+
),
|
1190 |
+
'size' => 'small',
|
1191 |
+
'conditional' => array( 'account_hide_in_directory', '=', '1' ),
|
1192 |
+
),
|
1193 |
+
),
|
1194 |
+
),
|
1195 |
+
'uploads' => array(
|
1196 |
+
'title' => __( 'Uploads', 'ultimate-member' ),
|
1197 |
+
'fields' => array(
|
1198 |
+
array(
|
1199 |
+
'id' => 'profile_photo_max_size',
|
1200 |
+
'type' => 'text',
|
1201 |
+
'size' => 'small',
|
1202 |
+
'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ),
|
1203 |
+
'tooltip' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ),
|
1204 |
+
),
|
1205 |
+
array(
|
1206 |
+
'id' => 'cover_photo_max_size',
|
1207 |
+
'type' => 'text',
|
1208 |
+
'size' => 'small',
|
1209 |
+
'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ),
|
1210 |
+
'tooltip' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ),
|
1211 |
+
),
|
1212 |
+
array(
|
1213 |
+
'id' => 'photo_thumb_sizes',
|
1214 |
+
'type' => 'multi_text',
|
1215 |
+
'size' => 'small',
|
1216 |
+
'label' => __( 'Profile Photo Thumbnail Sizes (px)', 'ultimate-member' ),
|
1217 |
+
'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.', 'ultimate-member' ),
|
1218 |
+
'validate' => 'numeric',
|
1219 |
+
'add_text' => __( 'Add New Size', 'ultimate-member' ),
|
1220 |
+
'show_default_number' => 1,
|
1221 |
+
),
|
1222 |
+
array(
|
1223 |
+
'id' => 'cover_thumb_sizes',
|
1224 |
+
'type' => 'multi_text',
|
1225 |
+
'size' => 'small',
|
1226 |
+
'label' => __( 'Cover Photo Thumbnail Sizes (px)', 'ultimate-member' ),
|
1227 |
+
'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each cover photo upload.', 'ultimate-member' ),
|
1228 |
+
'validate' => 'numeric',
|
1229 |
+
'add_text' => __( 'Add New Size', 'ultimate-member' ),
|
1230 |
+
'show_default_number' => 1,
|
1231 |
+
),
|
1232 |
+
array(
|
1233 |
+
'id' => 'image_orientation_by_exif',
|
1234 |
+
'type' => 'checkbox',
|
1235 |
+
'label' => __( 'Change image orientation', 'ultimate-member' ),
|
1236 |
+
'tooltip' => __( 'Rotate image to and use orientation by the camera EXIF data.', 'ultimate-member' ),
|
1237 |
+
),
|
1238 |
+
array(
|
1239 |
+
'id' => 'image_compression',
|
1240 |
+
'type' => 'text',
|
1241 |
+
'size' => 'small',
|
1242 |
+
'label' => __( 'Image Quality', 'ultimate-member' ),
|
1243 |
+
'tooltip' => __( 'Quality is used to determine quality of image uploads, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 60.', 'ultimate-member' ),
|
1244 |
+
),
|
1245 |
+
|
1246 |
+
array(
|
1247 |
+
'id' => 'image_max_width',
|
1248 |
+
'type' => 'text',
|
1249 |
+
'size' => 'small',
|
1250 |
+
'label' => __( 'Image Upload Maximum Width (px)', 'ultimate-member' ),
|
1251 |
+
'tooltip' => __( 'Any image upload above this width will be resized to this limit automatically.', 'ultimate-member' ),
|
1252 |
+
),
|
1253 |
+
|
1254 |
+
array(
|
1255 |
+
'id' => 'cover_min_width',
|
1256 |
+
'type' => 'text',
|
1257 |
+
'size' => 'small',
|
1258 |
+
'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ),
|
1259 |
+
'tooltip' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ),
|
1260 |
+
),
|
1261 |
+
),
|
1262 |
+
),
|
1263 |
+
),
|
1264 |
+
),
|
1265 |
+
'access' => array(
|
1266 |
+
'title' => __( 'Access', 'ultimate-member' ),
|
1267 |
+
'sections' => array(
|
1268 |
+
'' => array(
|
1269 |
+
'title' => __( 'Restriction Content', 'ultimate-member' ),
|
1270 |
+
'fields' => $access_fields,
|
1271 |
+
),
|
1272 |
+
'other' => array(
|
1273 |
+
'title' => __( 'Other', 'ultimate-member' ),
|
1274 |
+
'fields' => array(
|
1275 |
+
array(
|
1276 |
+
'id' => 'enable_reset_password_limit',
|
1277 |
+
'type' => 'checkbox',
|
1278 |
+
'label' => __( 'Enable the Reset Password Limit?', 'ultimate-member' ),
|
1279 |
+
),
|
1280 |
+
array(
|
1281 |
+
'id' => 'reset_password_limit_number',
|
1282 |
+
'type' => 'text',
|
1283 |
+
'label' => __( 'Reset Password Limit', 'ultimate-member' ),
|
1284 |
+
'tooltip' => __( 'Set the maximum reset password limit. If reached the maximum limit, user will be locked from using this.', 'ultimate-member' ),
|
1285 |
+
'validate' => 'numeric',
|
1286 |
+
'conditional' => array( 'enable_reset_password_limit', '=', 1 ),
|
1287 |
+
'size' => 'small',
|
1288 |
+
),
|
1289 |
+
array(
|
1290 |
+
'id' => 'blocked_emails',
|
1291 |
+
'type' => 'textarea',
|
1292 |
+
'label' => __( 'Blocked Email Addresses', 'ultimate-member' ),
|
1293 |
+
'tooltip' => __( 'This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com', 'ultimate-member' ),
|
1294 |
+
),
|
1295 |
+
array(
|
1296 |
+
'id' => 'blocked_words',
|
1297 |
+
'type' => 'textarea',
|
1298 |
+
'label' => __( 'Blacklist Words', 'ultimate-member' ),
|
1299 |
+
'tooltip' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ),
|
1300 |
+
),
|
1301 |
+
),
|
1302 |
+
),
|
1303 |
+
),
|
1304 |
+
),
|
1305 |
+
'email' => array(
|
1306 |
+
'title' => __( 'Email', 'ultimate-member' ),
|
1307 |
+
'fields' => array(
|
1308 |
+
array(
|
1309 |
+
'id' => 'admin_email',
|
1310 |
+
'type' => 'text',
|
1311 |
+
'label' => __( 'Admin E-mail Address', 'ultimate-member' ),
|
1312 |
+
'tooltip' => __( 'e.g. admin@companyname.com', 'ultimate-member' ),
|
1313 |
+
),
|
1314 |
+
array(
|
1315 |
+
'id' => 'mail_from',
|
1316 |
+
'type' => 'text',
|
1317 |
+
'label' => __( 'Mail appears from', 'ultimate-member' ),
|
1318 |
+
'tooltip' => __( 'e.g. Site Name', 'ultimate-member' ),
|
1319 |
+
),
|
1320 |
+
array(
|
1321 |
+
'id' => 'mail_from_addr',
|
1322 |
+
'type' => 'text',
|
1323 |
+
'label' => __( 'Mail appears from address', 'ultimate-member' ),
|
1324 |
+
'tooltip' => __( 'e.g. admin@companyname.com', 'ultimate-member' ),
|
1325 |
+
),
|
1326 |
+
array(
|
1327 |
+
'id' => 'email_html',
|
1328 |
+
'type' => 'checkbox',
|
1329 |
+
'label' => __( 'Use HTML for E-mails?', 'ultimate-member' ),
|
1330 |
+
'tooltip' => __( 'If you plan use e-mails with HTML, please make sure that this option is enabled. Otherwise, HTML will be displayed as plain text.', 'ultimate-member' ),
|
1331 |
+
),
|
1332 |
+
),
|
1333 |
+
),
|
1334 |
+
'appearance' => array(
|
1335 |
+
'title' => __( 'Appearance', 'ultimate-member' ),
|
1336 |
+
'sections' => array(
|
1337 |
+
'' => array(
|
1338 |
+
'title' => __( 'Profile', 'ultimate-member' ),
|
1339 |
+
'fields' => array(
|
1340 |
+
array(
|
1341 |
+
'id' => 'profile_template',
|
1342 |
+
'type' => 'select',
|
1343 |
+
'label' => __( 'Profile Default Template', 'ultimate-member' ),
|
1344 |
+
'tooltip' => __( 'This will be the default template to output profile', 'ultimate-member' ),
|
1345 |
+
'default' => um_get_metadefault( 'profile_template' ),
|
1346 |
+
'options' => UM()->shortcodes()->get_templates( 'profile' ),
|
1347 |
+
'size' => 'small',
|
1348 |
+
),
|
1349 |
+
array(
|
1350 |
+
'id' => 'profile_max_width',
|
1351 |
+
'type' => 'text',
|
1352 |
+
'label' => __( 'Profile Maximum Width', 'ultimate-member' ),
|
1353 |
+
'default' => um_get_metadefault( 'profile_max_width' ),
|
1354 |
+
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
|
1355 |
+
'size' => 'small',
|
1356 |
+
),
|
1357 |
+
array(
|
1358 |
+
'id' => 'profile_area_max_width',
|
1359 |
+
'type' => 'text',
|
1360 |
+
'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ),
|
1361 |
+
'default' => um_get_metadefault( 'profile_area_max_width' ),
|
1362 |
+
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
|
1363 |
+
'size' => 'small',
|
1364 |
+
),
|
1365 |
+
array(
|
1366 |
+
'id' => 'profile_icons',
|
1367 |
+
'type' => 'select',
|
1368 |
+
'label' => __( 'Profile Field Icons', 'ultimate-member' ),
|
1369 |
+
'tooltip' => __( 'This is applicable for edit mode only', 'ultimate-member' ),
|
1370 |
+
'default' => um_get_metadefault( 'profile_icons' ),
|
1371 |
+
'options' => array(
|
1372 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
1373 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
1374 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
1375 |
+
),
|
1376 |
+
'size' => 'small',
|
1377 |
+
),
|
1378 |
+
array(
|
1379 |
+
'id' => 'profile_primary_btn_word',
|
1380 |
+
'type' => 'text',
|
1381 |
+
'label' => __( 'Profile Primary Button Text', 'ultimate-member' ),
|
1382 |
+
'default' => um_get_metadefault( 'profile_primary_btn_word' ),
|
1383 |
+
'tooltip' => __( 'The text that is used for updating profile button', 'ultimate-member' ),
|
1384 |
+
'size' => 'medium',
|
1385 |
+
),
|
1386 |
+
array(
|
1387 |
+
'id' => 'profile_secondary_btn',
|
1388 |
+
'type' => 'checkbox',
|
1389 |
+
'label' => __( 'Profile Secondary Button', 'ultimate-member' ),
|
1390 |
+
'default' => um_get_metadefault( 'profile_secondary_btn' ),
|
1391 |
+
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
|
1392 |
+
),
|
1393 |
+
array(
|
1394 |
+
'id' => 'profile_secondary_btn_word',
|
1395 |
+
'type' => 'text',
|
1396 |
+
'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ),
|
1397 |
+
'default' => um_get_metadefault( 'profile_secondary_btn_word' ),
|
1398 |
+
'tooltip' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ),
|
1399 |
+
'conditional' => array( 'profile_secondary_btn', '=', 1 ),
|
1400 |
+
'size' => 'medium',
|
1401 |
+
),
|
1402 |
+
array(
|
1403 |
+
'id' => 'default_avatar',
|
1404 |
+
'type' => 'media',
|
1405 |
+
'label' => __( 'Default Profile Photo', 'ultimate-member' ),
|
1406 |
+
'tooltip' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ),
|
1407 |
+
'upload_frame_title' => __( 'Select Default Profile Photo', 'ultimate-member' ),
|
1408 |
+
'default' => array(
|
1409 |
+
'url' => um_url . 'assets/img/default_avatar.jpg',
|
1410 |
+
),
|
1411 |
+
),
|
1412 |
+
array(
|
1413 |
+
'id' => 'default_cover',
|
1414 |
+
'type' => 'media',
|
1415 |
+
'url' => true,
|
1416 |
+
'preview' => false,
|
1417 |
+
'label' => __( 'Default Cover Photo', 'ultimate-member' ),
|
1418 |
+
'tooltip' => __( 'You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member' ),
|
1419 |
+
'upload_frame_title' => __( 'Select Default Cover Photo', 'ultimate-member' ),
|
1420 |
+
),
|
1421 |
+
array(
|
1422 |
+
'id' => 'disable_profile_photo_upload',
|
1423 |
+
'type' => 'checkbox',
|
1424 |
+
'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ),
|
1425 |
+
'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ),
|
1426 |
+
'default' => um_get_metadefault( 'disable_profile_photo_upload' ),
|
1427 |
+
),
|
1428 |
+
array(
|
1429 |
+
'id' => 'profile_photosize',
|
1430 |
+
'type' => 'select',
|
1431 |
+
'label' => __( 'Profile Photo Size', 'ultimate-member' ),
|
1432 |
+
'default' => um_get_metadefault( 'profile_photosize' ),
|
1433 |
+
'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ),
|
1434 |
+
'tooltip' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ),
|
1435 |
+
'size' => 'small',
|
1436 |
+
),
|
1437 |
+
array(
|
1438 |
+
'id' => 'profile_cover_enabled',
|
1439 |
+
'type' => 'checkbox',
|
1440 |
+
'label' => __( 'Profile Cover Photos', 'ultimate-member' ),
|
1441 |
+
'default' => um_get_metadefault( 'profile_cover_enabled' ),
|
1442 |
+
'tooltip' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ),
|
1443 |
+
),
|
1444 |
+
array(
|
1445 |
+
'id' => 'profile_coversize',
|
1446 |
+
'type' => 'select',
|
1447 |
+
'label' => __( 'Profile Cover Size', 'ultimate-member' ),
|
1448 |
+
'default' => um_get_metadefault( 'profile_coversize' ),
|
1449 |
+
'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ),
|
1450 |
+
'tooltip' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ),
|
1451 |
+
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
|
1452 |
+
'size' => 'small',
|
1453 |
+
),
|
1454 |
+
array(
|
1455 |
+
'id' => 'profile_cover_ratio',
|
1456 |
+
'type' => 'select',
|
1457 |
+
'label' => __( 'Profile Cover Ratio', 'ultimate-member' ),
|
1458 |
+
'tooltip' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ),
|
1459 |
+
'default' => um_get_metadefault( 'profile_cover_ratio' ),
|
1460 |
+
'options' => array(
|
1461 |
+
'1.6:1' => '1.6:1',
|
1462 |
+
'2.7:1' => '2.7:1',
|
1463 |
+
'2.2:1' => '2.2:1',
|
1464 |
+
'3.2:1' => '3.2:1',
|
1465 |
+
),
|
1466 |
+
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
|
1467 |
+
'size' => 'small',
|
1468 |
+
),
|
1469 |
+
array(
|
1470 |
+
'id' => 'profile_show_metaicon',
|
1471 |
+
'type' => 'checkbox',
|
1472 |
+
'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ),
|
1473 |
+
'default' => 0,
|
1474 |
+
'tooltip' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ),
|
1475 |
+
),
|
1476 |
+
array(
|
1477 |
+
'id' => 'profile_show_name',
|
1478 |
+
'type' => 'checkbox',
|
1479 |
+
'label' => __( 'Show display name in profile header', 'ultimate-member' ),
|
1480 |
+
'default' => um_get_metadefault( 'profile_show_name' ),
|
1481 |
+
'tooltip' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ),
|
1482 |
+
),
|
1483 |
+
array(
|
1484 |
+
'id' => 'profile_show_social_links',
|
1485 |
+
'type' => 'checkbox',
|
1486 |
+
'label' => __( 'Show social links in profile header', 'ultimate-member' ),
|
1487 |
+
'default' => um_get_metadefault( 'profile_show_social_links' ),
|
1488 |
+
'tooltip' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ),
|
1489 |
+
),
|
1490 |
+
array(
|
1491 |
+
'id' => 'profile_show_bio',
|
1492 |
+
'type' => 'checkbox',
|
1493 |
+
'label' => __( 'Show user description in header', 'ultimate-member' ),
|
1494 |
+
'default' => um_get_metadefault( 'profile_show_bio' ),
|
1495 |
+
'tooltip' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ),
|
1496 |
+
),
|
1497 |
+
array(
|
1498 |
+
'id' => 'profile_show_html_bio',
|
1499 |
+
'type' => 'checkbox',
|
1500 |
+
'label' => __( 'Enable HTML support for user description', 'ultimate-member' ),
|
1501 |
+
'tooltip' => __( 'Switch on/off to enable/disable support for html tags on user description.', 'ultimate-member' ),
|
1502 |
+
),
|
1503 |
+
array(
|
1504 |
+
'id' => 'profile_bio_maxchars',
|
1505 |
+
'type' => 'text',
|
1506 |
+
'label' => __( 'User description maximum chars', 'ultimate-member' ),
|
1507 |
+
'default' => um_get_metadefault( 'profile_bio_maxchars' ),
|
1508 |
+
'tooltip' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ),
|
1509 |
+
'conditional' => array( 'profile_show_bio', '=', 1 ),
|
1510 |
+
'size' => 'small',
|
1511 |
+
),
|
1512 |
+
array(
|
1513 |
+
'id' => 'profile_header_menu',
|
1514 |
+
'type' => 'select',
|
1515 |
+
'label' => __( 'Profile Header Menu Position', 'ultimate-member' ),
|
1516 |
+
'default' => um_get_metadefault( 'profile_header_menu' ),
|
1517 |
+
'tooltip' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ),
|
1518 |
+
'options' => array(
|
1519 |
+
'bc' => __( 'Bottom of Icon', 'ultimate-member' ),
|
1520 |
+
'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ),
|
1521 |
+
),
|
1522 |
+
'size' => 'small',
|
1523 |
+
),
|
1524 |
+
array(
|
1525 |
+
'id' => 'profile_empty_text',
|
1526 |
+
'type' => 'checkbox',
|
1527 |
+
'label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ),
|
1528 |
+
'default' => um_get_metadefault( 'profile_empty_text' ),
|
1529 |
+
'tooltip' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ),
|
1530 |
+
),
|
1531 |
+
array(
|
1532 |
+
'id' => 'profile_empty_text_emo',
|
1533 |
+
'type' => 'checkbox',
|
1534 |
+
'label' => __( 'Show the emoticon', 'ultimate-member' ),
|
1535 |
+
'default' => um_get_metadefault( 'profile_empty_text_emo' ),
|
1536 |
+
'tooltip' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ),
|
1537 |
+
'conditional' => array( 'profile_empty_text', '=', 1 ),
|
1538 |
+
),
|
1539 |
+
),
|
1540 |
+
),
|
1541 |
+
'profile_menu' => array(
|
1542 |
+
'title' => __( 'Profile Menu', 'ultimate-member' ),
|
1543 |
+
'fields' => $appearances_profile_menu_fields,
|
1544 |
+
),
|
1545 |
+
'registration_form' => array(
|
1546 |
+
'title' => __( 'Registration Form', 'ultimate-member' ),
|
1547 |
+
'fields' => array(
|
1548 |
+
array(
|
1549 |
+
'id' => 'register_template',
|
1550 |
+
'type' => 'select',
|
1551 |
+
'label' => __( 'Registration Default Template', 'ultimate-member' ),
|
1552 |
+
'tooltip' => __( 'This will be the default template to output registration', 'ultimate-member' ),
|
1553 |
+
'default' => um_get_metadefault( 'register_template' ),
|
1554 |
+
'options' => UM()->shortcodes()->get_templates( 'register' ),
|
1555 |
+
'size' => 'small',
|
1556 |
+
),
|
1557 |
+
array(
|
1558 |
+
'id' => 'register_max_width',
|
1559 |
+
'type' => 'text',
|
1560 |
+
'label' => __( 'Registration Maximum Width', 'ultimate-member' ),
|
1561 |
+
'default' => um_get_metadefault( 'register_max_width' ),
|
1562 |
+
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
|
1563 |
+
'size' => 'small',
|
1564 |
+
),
|
1565 |
+
array(
|
1566 |
+
'id' => 'register_align',
|
1567 |
+
'type' => 'select',
|
1568 |
+
'label' => __( 'Registration Shortcode Alignment', 'ultimate-member' ),
|
1569 |
+
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
|
1570 |
+
'default' => um_get_metadefault( 'register_align' ),
|
1571 |
+
'options' => array(
|
1572 |
+
'center' => __( 'Centered', 'ultimate-member' ),
|
1573 |
+
'left' => __( 'Left aligned', 'ultimate-member' ),
|
1574 |
+
'right' => __( 'Right aligned', 'ultimate-member' ),
|
1575 |
+
),
|
1576 |
+
'size' => 'small',
|
1577 |
+
),
|
1578 |
+
array(
|
1579 |
+
'id' => 'register_icons',
|
1580 |
+
'type' => 'select',
|
1581 |
+
'label' => __( 'Registration Field Icons', 'ultimate-member' ),
|
1582 |
+
'tooltip' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ),
|
1583 |
+
'default' => um_get_metadefault( 'register_icons' ),
|
1584 |
+
'options' => array(
|
1585 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
1586 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
1587 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
1588 |
+
),
|
1589 |
+
'size' => 'small',
|
1590 |
+
),
|
1591 |
+
array(
|
1592 |
+
'id' => 'register_primary_btn_word',
|
1593 |
+
'type' => 'text',
|
1594 |
+
'label' => __( 'Registration Primary Button Text', 'ultimate-member' ),
|
1595 |
+
'default' => um_get_metadefault( 'register_primary_btn_word' ),
|
1596 |
+
'tooltip' => __( 'The text that is used for primary button text', 'ultimate-member' ),
|
1597 |
+
'size' => 'medium',
|
1598 |
+
),
|
1599 |
+
array(
|
1600 |
+
'id' => 'register_secondary_btn',
|
1601 |
+
'type' => 'checkbox',
|
1602 |
+
'label' => __( 'Registration Secondary Button', 'ultimate-member' ),
|
1603 |
+
'default' => 1,
|
1604 |
+
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
|
1605 |
+
),
|
1606 |
+
array(
|
1607 |
+
'id' => 'register_secondary_btn_word',
|
1608 |
+
'type' => 'text',
|
1609 |
+
'label' => __( 'Registration Secondary Button Text', 'ultimate-member' ),
|
1610 |
+
'default' => um_get_metadefault( 'register_secondary_btn_word' ),
|
1611 |
+
'tooltip' => __( 'The text that is used for the secondary button text', 'ultimate-member' ),
|
1612 |
+
'conditional' => array( 'register_secondary_btn', '=', 1 ),
|
1613 |
+
'size' => 'medium',
|
1614 |
+
),
|
1615 |
+
array(
|
1616 |
+
'id' => 'register_secondary_btn_url',
|
1617 |
+
'type' => 'text',
|
1618 |
+
'label' => __( 'Registration Secondary Button URL', 'ultimate-member' ),
|
1619 |
+
'default' => um_get_metadefault( 'register_secondary_btn_url' ),
|
1620 |
+
'tooltip' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ),
|
1621 |
+
'conditional' => array( 'register_secondary_btn', '=', 1 ),
|
1622 |
+
'size' => 'medium',
|
1623 |
+
),
|
1624 |
+
array(
|
1625 |
+
'id' => 'register_role',
|
1626 |
+
'type' => 'select',
|
1627 |
+
'label' => __( 'Registration Default Role', 'ultimate-member' ),
|
1628 |
+
'tooltip' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ),
|
1629 |
+
'default' => um_get_metadefault( 'register_role' ),
|
1630 |
+
'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ),
|
1631 |
+
'size' => 'small',
|
1632 |
+
),
|
1633 |
+
),
|
1634 |
+
),
|
1635 |
+
'login_form' => array(
|
1636 |
+
'title' => __( 'Login Form', 'ultimate-member' ),
|
1637 |
+
'fields' => array(
|
1638 |
+
array(
|
1639 |
+
'id' => 'login_template',
|
1640 |
+
'type' => 'select',
|
1641 |
+
'label' => __( 'Login Default Template', 'ultimate-member' ),
|
1642 |
+
'tooltip' => __( 'This will be the default template to output login', 'ultimate-member' ),
|
1643 |
+
'default' => um_get_metadefault( 'login_template' ),
|
1644 |
+
'options' => UM()->shortcodes()->get_templates( 'login' ),
|
1645 |
+
'size' => 'small',
|
1646 |
+
),
|
1647 |
+
array(
|
1648 |
+
'id' => 'login_max_width',
|
1649 |
+
'type' => 'text',
|
1650 |
+
'label' => __( 'Login Maximum Width', 'ultimate-member' ),
|
1651 |
+
'default' => um_get_metadefault( 'login_max_width' ),
|
1652 |
+
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
|
1653 |
+
'size' => 'small',
|
1654 |
+
),
|
1655 |
+
array(
|
1656 |
+
'id' => 'login_align',
|
1657 |
+
'type' => 'select',
|
1658 |
+
'label' => __( 'Login Shortcode Alignment', 'ultimate-member' ),
|
1659 |
+
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
|
1660 |
+
'default' => um_get_metadefault( 'login_align' ),
|
1661 |
+
'options' => array(
|
1662 |
+
'center' => __( 'Centered', 'ultimate-member' ),
|
1663 |
+
'left' => __( 'Left aligned', 'ultimate-member' ),
|
1664 |
+
'right' => __( 'Right aligned', 'ultimate-member' ),
|
1665 |
+
),
|
1666 |
+
'size' => 'small',
|
1667 |
+
),
|
1668 |
+
array(
|
1669 |
+
'id' => 'login_icons',
|
1670 |
+
'type' => 'select',
|
1671 |
+
'label' => __( 'Login Field Icons', 'ultimate-member' ),
|
1672 |
+
'tooltip' => __( 'This controls the display of field icons in the login form', 'ultimate-member' ),
|
1673 |
+
'default' => um_get_metadefault( 'login_icons' ),
|
1674 |
+
'options' => array(
|
1675 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
1676 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
1677 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
1678 |
+
),
|
1679 |
+
'size' => 'small',
|
1680 |
+
),
|
1681 |
+
array(
|
1682 |
+
'id' => 'login_primary_btn_word',
|
1683 |
+
'type' => 'text',
|
1684 |
+
'label' => __( 'Login Primary Button Text', 'ultimate-member' ),
|
1685 |
+
'default' => um_get_metadefault( 'login_primary_btn_word' ),
|
1686 |
+
'tooltip' => __( 'The text that is used for primary button text', 'ultimate-member' ),
|
1687 |
+
'size' => 'medium',
|
1688 |
+
),
|
1689 |
+
array(
|
1690 |
+
'id' => 'login_secondary_btn',
|
1691 |
+
'type' => 'checkbox',
|
1692 |
+
'label' => __( 'Login Secondary Button', 'ultimate-member' ),
|
1693 |
+
'default' => 1,
|
1694 |
+
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
|
1695 |
+
),
|
1696 |
+
array(
|
1697 |
+
'id' => 'login_secondary_btn_word',
|
1698 |
+
'type' => 'text',
|
1699 |
+
'label' => __( 'Login Secondary Button Text', 'ultimate-member' ),
|
1700 |
+
'default' => um_get_metadefault( 'login_secondary_btn_word' ),
|
1701 |
+
'tooltip' => __( 'The text that is used for the secondary button text', 'ultimate-member' ),
|
1702 |
+
'conditional' => array( 'login_secondary_btn', '=', 1 ),
|
1703 |
+
'size' => 'medium',
|
1704 |
+
),
|
1705 |
+
array(
|
1706 |
+
'id' => 'login_secondary_btn_url',
|
1707 |
+
'type' => 'text',
|
1708 |
+
'label' => __( 'Login Secondary Button URL', 'ultimate-member' ),
|
1709 |
+
'default' => um_get_metadefault( 'login_secondary_btn_url' ),
|
1710 |
+
'tooltip' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ),
|
1711 |
+
'conditional' => array( 'login_secondary_btn', '=', 1 ),
|
1712 |
+
'size' => 'medium',
|
1713 |
+
),
|
1714 |
+
array(
|
1715 |
+
'id' => 'login_forgot_pass_link',
|
1716 |
+
'type' => 'checkbox',
|
1717 |
+
'label' => __( 'Login Forgot Password Link', 'ultimate-member' ),
|
1718 |
+
'default' => 1,
|
1719 |
+
'tooltip' => __( 'Switch on/off the forgot password link in login form', 'ultimate-member' ),
|
1720 |
+
),
|
1721 |
+
array(
|
1722 |
+
'id' => 'login_show_rememberme',
|
1723 |
+
'type' => 'checkbox',
|
1724 |
+
'label' => __( 'Show "Remember Me"', 'ultimate-member' ),
|
1725 |
+
'default' => 1,
|
1726 |
+
'tooltip' => __( 'Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.', 'ultimate-member' ),
|
1727 |
+
),
|
1728 |
+
),
|
1729 |
+
),
|
1730 |
+
),
|
1731 |
+
),
|
1732 |
+
'extensions' => array(
|
1733 |
+
'title' => __( 'Extensions', 'ultimate-member' ),
|
1734 |
+
),
|
1735 |
+
'licenses' => array(
|
1736 |
+
'title' => __( 'Licenses', 'ultimate-member' ),
|
1737 |
+
),
|
1738 |
+
'misc' => array(
|
1739 |
+
'title' => __( 'Misc', 'ultimate-member' ),
|
1740 |
+
'fields' => array(
|
1741 |
+
array(
|
1742 |
+
'id' => 'form_asterisk',
|
1743 |
+
'type' => 'checkbox',
|
1744 |
+
'label' => __( 'Show an asterisk for required fields', 'ultimate-member' ),
|
1745 |
+
),
|
1746 |
+
array(
|
1747 |
+
'id' => 'profile_title',
|
1748 |
+
'type' => 'text',
|
1749 |
+
'label' => __( 'User Profile Title', 'ultimate-member' ),
|
1750 |
+
'tooltip' => __( 'This is the title that is displayed on a specific user profile', 'ultimate-member' ),
|
1751 |
+
'size' => 'medium',
|
1752 |
+
),
|
1753 |
+
array(
|
1754 |
+
'id' => 'profile_desc',
|
1755 |
+
'type' => 'textarea',
|
1756 |
+
'label' => __( 'User Profile Dynamic Meta Description', 'ultimate-member' ),
|
1757 |
+
'tooltip' => __( 'This will be used in the meta description that is available for search-engines.', 'ultimate-member' ),
|
1758 |
+
'args' => array(
|
1759 |
+
'textarea_rows' => 6,
|
1760 |
+
),
|
1761 |
+
),
|
1762 |
+
array(
|
1763 |
+
'id' => 'um_profile_object_cache_stop',
|
1764 |
+
'type' => 'checkbox',
|
1765 |
+
'label' => __( 'Disable Cache User Profile', 'ultimate-member' ),
|
1766 |
+
'tooltip' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ),
|
1767 |
+
),
|
1768 |
+
array(
|
1769 |
+
'id' => 'enable_blocks',
|
1770 |
+
'type' => 'checkbox',
|
1771 |
+
'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ),
|
1772 |
+
'tooltip' => __( 'Check this box if you would like to use Ultimate Member blocks in Gutenberg editor. Important some themes have the conflicts with Gutenberg editor.', 'ultimate-member' ),
|
1773 |
+
),
|
1774 |
+
array(
|
1775 |
+
'id' => 'rest_api_version',
|
1776 |
+
'type' => 'select',
|
1777 |
+
'label' => __( 'REST API version', 'ultimate-member' ),
|
1778 |
+
'tooltip' => __( 'This controls the REST API version, we recommend to use the last version', 'ultimate-member' ),
|
1779 |
+
'options' => array(
|
1780 |
+
'1.0' => __( '1.0 version', 'ultimate-member' ),
|
1781 |
+
'2.0' => __( '2.0 version', 'ultimate-member' ),
|
1782 |
+
),
|
1783 |
+
),
|
1784 |
+
// backward compatibility option leave it disabled for better security and ability to exclude posts/terms pre-query
|
1785 |
+
// otherwise we filtering only results and restricted posts/terms can be visible
|
1786 |
+
array(
|
1787 |
+
'id' => 'disable_restriction_pre_queries',
|
1788 |
+
'type' => 'checkbox',
|
1789 |
+
'label' => __( 'Disable pre-queries for restriction content logic (advanced)', 'ultimate-member' ),
|
1790 |
+
'tooltip' => __( 'Please enable this option only in the cases when you have big or unnecessary queries on your site with active restriction logic. If you want to exclude posts only from the results queries instead of pre_get_posts and fully-hidden post logic also please enable this option. It activates the restriction content logic until 2.2.x version without latest security enhancements', 'ultimate-member' ),
|
1791 |
+
),
|
1792 |
+
$same_page_update,
|
1793 |
+
array(
|
1794 |
+
'id' => 'uninstall_on_delete',
|
1795 |
+
'type' => 'checkbox',
|
1796 |
+
'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ),
|
1797 |
+
'tooltip' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ),
|
1798 |
+
),
|
1799 |
+
),
|
1800 |
+
),
|
1801 |
+
'install_info' => array(
|
1802 |
+
'title' => __( 'Install Info', 'ultimate-member' ),
|
1803 |
+
'fields' => array(
|
1804 |
+
array(
|
1805 |
+
'type' => 'install_info',
|
1806 |
+
),
|
1807 |
+
),
|
1808 |
+
),
|
1809 |
+
)
|
1810 |
+
);
|
1811 |
+
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
|
1815 |
+
/**
|
1816 |
+
* @param array $settings
|
1817 |
+
*
|
1818 |
+
* @return array
|
1819 |
+
*/
|
1820 |
+
public function sorting_licenses_options( $settings ) {
|
1821 |
+
//sorting licenses
|
1822 |
+
if ( empty( $settings['licenses']['fields'] ) ) {
|
1823 |
+
return $settings;
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
$licenses = $settings['licenses']['fields'];
|
1827 |
+
@uasort( $licenses, function( $a, $b ) {
|
1828 |
+
return strnatcasecmp( $a['label'], $b['label'] );
|
1829 |
+
} );
|
1830 |
+
$settings['licenses']['fields'] = $licenses;
|
1831 |
+
|
1832 |
+
//sorting extensions
|
1833 |
+
if ( empty( $settings['extensions']['sections'] ) ) {
|
1834 |
+
return $settings;
|
1835 |
+
}
|
1836 |
+
|
1837 |
+
$extensions = $settings['extensions']['sections'];
|
1838 |
+
@uasort( $extensions, function( $a, $b ) {
|
1839 |
+
return strnatcasecmp( $a['title'], $b['title'] );
|
1840 |
+
} );
|
1841 |
+
|
1842 |
+
$keys = array_keys( $extensions );
|
1843 |
+
if ( $keys[0] !== '' ) {
|
1844 |
+
$new_key = strtolower( str_replace( ' ', '_', $extensions['']['title'] ) );
|
1845 |
+
$temp = $extensions[''];
|
1846 |
+
$extensions[ $new_key ] = $temp;
|
1847 |
+
$extensions[''] = $extensions[ $keys[0] ];
|
1848 |
+
unset( $extensions[ $keys[0] ] );
|
1849 |
+
@uasort( $extensions, function( $a, $b ) {
|
1850 |
+
return strnatcasecmp( $a['title'], $b['title'] );
|
1851 |
+
} );
|
1852 |
+
}
|
1853 |
+
|
1854 |
+
$settings['extensions']['sections'] = $extensions;
|
1855 |
+
|
1856 |
+
return $settings;
|
1857 |
+
}
|
1858 |
+
|
1859 |
+
|
1860 |
+
/**
|
1861 |
+
* @param $tab
|
1862 |
+
* @param $section
|
1863 |
+
*
|
1864 |
+
* @return array
|
1865 |
+
*/
|
1866 |
+
function get_section_fields( $tab, $section ) {
|
1867 |
+
|
1868 |
+
if ( empty( $this->settings_structure[ $tab ] ) ) {
|
1869 |
+
return array();
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) {
|
1873 |
+
return $this->settings_structure[ $tab ]['sections'][ $section ]['fields'];
|
1874 |
+
} elseif ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) {
|
1875 |
+
return $this->settings_structure[ $tab ]['fields'];
|
1876 |
+
}
|
1877 |
+
|
1878 |
+
return array();
|
1879 |
+
}
|
1880 |
+
|
1881 |
+
|
1882 |
+
/**
|
1883 |
+
* Setup admin menu
|
1884 |
+
*/
|
1885 |
+
function primary_admin_menu() {
|
1886 |
+
add_submenu_page( 'ultimatemember', __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( &$this, 'settings_page' ) );
|
1887 |
+
}
|
1888 |
+
|
1889 |
+
|
1890 |
+
/**
|
1891 |
+
* Settings page callback
|
1892 |
+
*/
|
1893 |
+
function settings_page() {
|
1894 |
+
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
1895 |
+
$current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] );
|
1896 |
+
|
1897 |
+
$settings_struct = $this->settings_structure[ $current_tab ];
|
1898 |
+
|
1899 |
+
//remove not option hidden fields
|
1900 |
+
if ( ! empty( $settings_struct['fields'] ) ) {
|
1901 |
+
foreach ( $settings_struct['fields'] as $field_key => $field_options ) {
|
1902 |
+
|
1903 |
+
if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) {
|
1904 |
+
unset( $settings_struct['fields'][ $field_key ] );
|
1905 |
+
}
|
1906 |
+
|
1907 |
+
}
|
1908 |
+
}
|
1909 |
+
|
1910 |
+
if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) ) {
|
1911 |
+
um_js_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) );
|
1912 |
+
}
|
1913 |
+
|
1914 |
+
if ( ! empty( $settings_struct['sections'] ) ) {
|
1915 |
+
if ( empty( $settings_struct['sections'][ $current_subtab ] ) ) {
|
1916 |
+
um_js_redirect( add_query_arg( array( 'page' => 'um_options', 'tab' => $current_tab ), admin_url( 'admin.php' ) ) );
|
1917 |
+
}
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
echo '<div id="um-settings-wrap" class="wrap"><h2>' . __( 'Ultimate Member - Settings', 'ultimate-member' ) . '</h2>';
|
1921 |
+
|
1922 |
+
echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab );
|
1923 |
+
|
1924 |
+
/**
|
1925 |
+
* UM hook
|
1926 |
+
*
|
1927 |
+
* @type action
|
1928 |
+
* @title um_settings_page_before_{$current_tab}_{$current_subtab}_content
|
1929 |
+
* @description Show some content before settings page content
|
1930 |
+
* @change_log
|
1931 |
+
* ["Since: 2.0"]
|
1932 |
+
* @usage add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'function_name', 10 );
|
1933 |
+
* @example
|
1934 |
+
* <?php
|
1935 |
+
* add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'my_settings_page_before', 10 );
|
1936 |
+
* function my_settings_page_before() {
|
1937 |
+
* // your code here
|
1938 |
+
* }
|
1939 |
+
* ?>
|
1940 |
+
*/
|
1941 |
+
do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" );
|
1942 |
+
|
1943 |
+
if ( in_array( $current_tab, apply_filters('um_settings_custom_tabs', array( 'licenses', 'install_info' ) ) ) || in_array( $current_subtab, apply_filters( 'um_settings_custom_subtabs', array(), $current_tab ) ) ) {
|
1944 |
+
|
1945 |
+
/**
|
1946 |
+
* UM hook
|
1947 |
+
*
|
1948 |
+
* @type action
|
1949 |
+
* @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
|
1950 |
+
* @description Show some content before section content at settings page
|
1951 |
+
* @change_log
|
1952 |
+
* ["Since: 2.0"]
|
1953 |
+
* @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
|
1954 |
+
* @example
|
1955 |
+
* <?php
|
1956 |
+
* add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'my_settings_page_before_section', 10 );
|
1957 |
+
* function my_settings_page_before_section() {
|
1958 |
+
* // your code here
|
1959 |
+
* }
|
1960 |
+
* ?>
|
1961 |
+
*/
|
1962 |
+
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1963 |
+
|
1964 |
+
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
1965 |
+
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
|
1966 |
+
|
1967 |
+
/**
|
1968 |
+
* UM hook
|
1969 |
+
*
|
1970 |
+
* @type filter
|
1971 |
+
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
1972 |
+
*
|
1973 |
+
* @description Render settings section
|
1974 |
+
* @input_vars
|
1975 |
+
* [{"var":"$content","type":"string","desc":"Section content"},
|
1976 |
+
* {"var":"$section_fields","type":"array","desc":"Section Fields"}]
|
1977 |
+
* @change_log
|
1978 |
+
* ["Since: 2.0"]
|
1979 |
+
* @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
|
1980 |
+
* @example
|
1981 |
+
* <?php
|
1982 |
+
* add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'my_settings_section', 10, 2 );
|
1983 |
+
* function my_settings_section( $content ) {
|
1984 |
+
* // your code here
|
1985 |
+
* return $content;
|
1986 |
+
* }
|
1987 |
+
* ?>
|
1988 |
+
*/
|
1989 |
+
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
1990 |
+
$settings_section,
|
1991 |
+
$section_fields
|
1992 |
+
);
|
1993 |
+
|
1994 |
+
} else { ?>
|
1995 |
+
|
1996 |
+
<form method="post" action="" name="um-settings-form" id="um-settings-form">
|
1997 |
+
<input type="hidden" value="save" name="um-settings-action" />
|
1998 |
+
|
1999 |
+
<?php
|
2000 |
+
/**
|
2001 |
+
* UM hook
|
2002 |
+
*
|
2003 |
+
* @type action
|
2004 |
+
* @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
|
2005 |
+
* @description Show some content before section content at settings page
|
2006 |
+
* @change_log
|
2007 |
+
* ["Since: 2.0"]
|
2008 |
+
* @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
|
2009 |
+
* @example
|
2010 |
+
* <?php
|
2011 |
+
* add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'my_settings_page_before_section', 10 );
|
2012 |
+
* function my_settings_page_before_section() {
|
2013 |
+
* // your code here
|
2014 |
+
* }
|
2015 |
+
* ?>
|
2016 |
+
*/
|
2017 |
+
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
2018 |
+
|
2019 |
+
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
2020 |
+
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
|
2021 |
+
|
2022 |
+
/**
|
2023 |
+
* UM hook
|
2024 |
+
*
|
2025 |
+
* @type filter
|
2026 |
+
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
2027 |
+
* @description Render settings section
|
2028 |
+
* @input_vars
|
2029 |
+
* [{"var":"$content","type":"string","desc":"Section content"},
|
2030 |
+
* {"var":"$section_fields","type":"array","desc":"Section Fields"}]
|
2031 |
+
* @change_log
|
2032 |
+
* ["Since: 2.0"]
|
2033 |
+
* @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
|
2034 |
+
* @example
|
2035 |
+
* <?php
|
2036 |
+
* add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'my_settings_section', 10, 2 );
|
2037 |
+
* function my_settings_section( $content ) {
|
2038 |
+
* // your code here
|
2039 |
+
* return $content;
|
2040 |
+
* }
|
2041 |
+
* ?>
|
2042 |
+
*/
|
2043 |
+
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
2044 |
+
$settings_section,
|
2045 |
+
$section_fields
|
2046 |
+
); ?>
|
2047 |
+
|
2048 |
+
|
2049 |
+
<p class="submit">
|
2050 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Save Changes', 'ultimate-member' ) ?>" />
|
2051 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2052 |
+
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
|
2053 |
+
</p>
|
2054 |
+
</form>
|
2055 |
+
|
2056 |
+
<?php }
|
2057 |
+
}
|
2058 |
+
|
2059 |
+
|
2060 |
+
/**
|
2061 |
+
* Generate pages tabs
|
2062 |
+
*
|
2063 |
+
* @param string $page
|
2064 |
+
* @return string
|
2065 |
+
*/
|
2066 |
+
function generate_tabs_menu( $page = 'settings' ) {
|
2067 |
+
|
2068 |
+
$tabs = '<h2 class="nav-tab-wrapper um-nav-tab-wrapper">';
|
2069 |
+
|
2070 |
+
switch( $page ) {
|
2071 |
+
case 'settings':
|
2072 |
+
$menu_tabs = array();
|
2073 |
+
foreach ( $this->settings_structure as $slug => $tab ) {
|
2074 |
+
if ( ! empty( $tab['fields'] ) ) {
|
2075 |
+
foreach ( $tab['fields'] as $field_key => $field_options ) {
|
2076 |
+
if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) {
|
2077 |
+
unset( $tab['fields'][ $field_key ] );
|
2078 |
+
}
|
2079 |
+
}
|
2080 |
+
}
|
2081 |
+
|
2082 |
+
if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) ) {
|
2083 |
+
$menu_tabs[ $slug ] = $tab['title'];
|
2084 |
+
}
|
2085 |
+
}
|
2086 |
+
|
2087 |
+
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
2088 |
+
foreach ( $menu_tabs as $name => $label ) {
|
2089 |
+
$active = ( $current_tab == $name ) ? 'nav-tab-active' : '';
|
2090 |
+
$tabs .= '<a href="' . esc_url( admin_url( 'admin.php?page=um_options' . ( empty( $name ) ? '' : '&tab=' . $name ) ) ) . '" class="nav-tab ' . esc_attr( $active ) . '">' .
|
2091 |
+
$label .
|
2092 |
+
'</a>';
|
2093 |
+
}
|
2094 |
+
|
2095 |
+
break;
|
2096 |
+
default:
|
2097 |
+
/**
|
2098 |
+
* UM hook
|
2099 |
+
*
|
2100 |
+
* @type filter
|
2101 |
+
* @title um_generate_tabs_menu_{$page}
|
2102 |
+
* @description Generate tabs menu
|
2103 |
+
* @input_vars
|
2104 |
+
* [{"var":"$tabs","type":"array","desc":"UM menu tabs"}]
|
2105 |
+
* @change_log
|
2106 |
+
* ["Since: 2.0"]
|
2107 |
+
* @usage add_filter( 'um_generate_tabs_menu_{$page}', 'function_name', 10, 1 );
|
2108 |
+
* @example
|
2109 |
+
* <?php
|
2110 |
+
* add_filter( 'um_generate_tabs_menu_{$page}', 'my_tabs_menu', 10, 1 );
|
2111 |
+
* function my_tabs_menu( $tabs ) {
|
2112 |
+
* // your code here
|
2113 |
+
* return $tabs;
|
2114 |
+
* }
|
2115 |
+
* ?>
|
2116 |
+
*/
|
2117 |
+
$tabs = apply_filters( 'um_generate_tabs_menu_' . $page, $tabs );
|
2118 |
+
break;
|
2119 |
+
}
|
2120 |
+
|
2121 |
+
return $tabs . '</h2>';
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
|
2125 |
+
/**
|
2126 |
+
* @param string $tab
|
2127 |
+
*
|
2128 |
+
* @return string
|
2129 |
+
*/
|
2130 |
+
function generate_subtabs_menu( $tab = '' ) {
|
2131 |
+
if ( empty( $this->settings_structure[ $tab ]['sections'] ) ) {
|
2132 |
+
return '';
|
2133 |
+
}
|
2134 |
+
|
2135 |
+
$menu_subtabs = array();
|
2136 |
+
foreach ( $this->settings_structure[ $tab ]['sections'] as $slug => $subtab ) {
|
2137 |
+
$menu_subtabs[ $slug ] = $subtab['title'];
|
2138 |
+
}
|
2139 |
+
|
2140 |
+
$subtabs = '<div><ul class="subsubsub">';
|
2141 |
+
|
2142 |
+
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
2143 |
+
$current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] );
|
2144 |
+
foreach ( $menu_subtabs as $name => $label ) {
|
2145 |
+
$active = ( $current_subtab == $name ) ? 'current' : '';
|
2146 |
+
$subtabs .= '<a href="' . esc_url( admin_url( 'admin.php?page=um_options' . ( empty( $current_tab ) ? '' : '&tab=' . $current_tab ) . ( empty( $name ) ? '' : '§ion=' . $name ) ) ) . '" class="' . $active . '">'
|
2147 |
+
. $label .
|
2148 |
+
'</a> | ';
|
2149 |
+
}
|
2150 |
+
|
2151 |
+
return substr( $subtabs, 0, -3 ) . '</ul></div>';
|
2152 |
+
}
|
2153 |
+
|
2154 |
+
|
2155 |
+
/**
|
2156 |
+
* Handler for settings forms
|
2157 |
+
* when "Save Settings" button click
|
2158 |
+
*
|
2159 |
+
*/
|
2160 |
+
function save_settings_handler() {
|
2161 |
+
|
2162 |
+
if ( isset( $_POST['um-settings-action'] ) && 'save' === sanitize_key( $_POST['um-settings-action'] ) && ! empty( $_POST['um_options'] ) ) {
|
2163 |
+
|
2164 |
+
$nonce = ! empty( $_POST['__umnonce'] ) ? $_POST['__umnonce'] : '';
|
2165 |
+
|
2166 |
+
if ( ( ! wp_verify_nonce( $nonce, 'um-settings-nonce' ) || empty( $nonce ) ) || ! current_user_can( 'manage_options' ) ) {
|
2167 |
+
// This nonce is not valid.
|
2168 |
+
wp_die( __( 'Security Check', 'ultimate-member' ) );
|
2169 |
+
}
|
2170 |
+
|
2171 |
+
/**
|
2172 |
+
* UM hook
|
2173 |
+
*
|
2174 |
+
* @type action
|
2175 |
+
* @title um_settings_before_save
|
2176 |
+
* @description Before settings save action
|
2177 |
+
* @change_log
|
2178 |
+
* ["Since: 2.0"]
|
2179 |
+
* @usage add_action( 'um_settings_before_save', 'function_name', 10 );
|
2180 |
+
* @example
|
2181 |
+
* <?php
|
2182 |
+
* add_action( 'um_settings_before_save', 'my_settings_before_save', 10 );
|
2183 |
+
* function my_settings_before_save() {
|
2184 |
+
* // your code here
|
2185 |
+
* }
|
2186 |
+
* ?>
|
2187 |
+
*/
|
2188 |
+
do_action( "um_settings_before_save" );
|
2189 |
+
|
2190 |
+
/**
|
2191 |
+
* UM hook
|
2192 |
+
*
|
2193 |
+
* @type filter
|
2194 |
+
* @title um_change_settings_before_save
|
2195 |
+
* @description Change settings before save
|
2196 |
+
* @input_vars
|
2197 |
+
* [{"var":"$settings","type":"array","desc":"UM Settings on save"}]
|
2198 |
+
* @change_log
|
2199 |
+
* ["Since: 2.0"]
|
2200 |
+
* @usage add_filter( 'um_change_settings_before_save', 'function_name', 10, 1 );
|
2201 |
+
* @example
|
2202 |
+
* <?php
|
2203 |
+
* add_filter( 'um_change_settings_before_save', 'my_change_settings_before_save', 10, 1 );
|
2204 |
+
* function my_change_settings_before_save( $settings ) {
|
2205 |
+
* // your code here
|
2206 |
+
* return $settings;
|
2207 |
+
* }
|
2208 |
+
* ?>
|
2209 |
+
*/
|
2210 |
+
$settings = apply_filters( 'um_change_settings_before_save', $_POST['um_options'] );
|
2211 |
+
|
2212 |
+
$settings = UM()->admin()->sanitize_options( $settings );
|
2213 |
+
|
2214 |
+
foreach ( $settings as $key => $value ) {
|
2215 |
+
UM()->options()->update( $key, $value );
|
2216 |
+
}
|
2217 |
+
|
2218 |
+
/**
|
2219 |
+
* UM hook
|
2220 |
+
*
|
2221 |
+
* @type action
|
2222 |
+
* @title um_settings_save
|
2223 |
+
* @description After settings save action
|
2224 |
+
* @change_log
|
2225 |
+
* ["Since: 2.0"]
|
2226 |
+
* @usage add_action( 'um_settings_save', 'function_name', 10 );
|
2227 |
+
* @example
|
2228 |
+
* <?php
|
2229 |
+
* add_action( 'um_settings_save', 'my_settings_save', 10 );
|
2230 |
+
* function my_settings_save() {
|
2231 |
+
* // your code here
|
2232 |
+
* }
|
2233 |
+
* ?>
|
2234 |
+
*/
|
2235 |
+
do_action( 'um_settings_save' );
|
2236 |
+
|
2237 |
+
//redirect after save settings
|
2238 |
+
$arg = array(
|
2239 |
+
'page' => 'um_options',
|
2240 |
+
);
|
2241 |
+
|
2242 |
+
if ( ! empty( $_GET['tab'] ) ) {
|
2243 |
+
$arg['tab'] = sanitize_key( $_GET['tab'] );
|
2244 |
+
}
|
2245 |
+
|
2246 |
+
if ( ! empty( $_GET['section'] ) ) {
|
2247 |
+
$arg['section'] = sanitize_key( $_GET['section'] );
|
2248 |
+
}
|
2249 |
+
|
2250 |
+
um_js_redirect( add_query_arg( $arg, admin_url( 'admin.php' ) ) );
|
2251 |
+
}
|
2252 |
+
}
|
2253 |
+
|
2254 |
+
|
2255 |
+
function set_default_if_empty( $settings ) {
|
2256 |
+
$tab = '';
|
2257 |
+
if ( ! empty( $_GET['tab'] ) ) {
|
2258 |
+
$tab = sanitize_key( $_GET['tab'] );
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
$section = '';
|
2262 |
+
if ( ! empty( $_GET['section'] ) ) {
|
2263 |
+
$section = sanitize_key( $_GET['section'] );
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
|
2267 |
+
if ( 'access' === $tab && empty( $section ) ) {
|
2268 |
+
if ( ! array_key_exists( 'access_exclude_uris', $settings ) ) {
|
2269 |
+
$settings['access_exclude_uris'] = array();
|
2270 |
+
}
|
2271 |
+
}
|
2272 |
+
|
2273 |
+
return $settings;
|
2274 |
+
}
|
2275 |
+
|
2276 |
+
|
2277 |
+
/**
|
2278 |
+
* Remove empty values from multi text fields
|
2279 |
+
*
|
2280 |
+
* @param $settings
|
2281 |
+
* @return array
|
2282 |
+
*/
|
2283 |
+
function remove_empty_values( $settings ) {
|
2284 |
+
$tab = '';
|
2285 |
+
if ( ! empty( $_GET['tab'] ) ) {
|
2286 |
+
$tab = sanitize_key( $_GET['tab'] );
|
2287 |
+
}
|
2288 |
+
|
2289 |
+
$section = '';
|
2290 |
+
if ( ! empty( $_GET['section'] ) ) {
|
2291 |
+
$section = sanitize_key( $_GET['section'] );
|
2292 |
+
}
|
2293 |
+
|
2294 |
+
if ( isset( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) {
|
2295 |
+
$fields = $this->settings_structure[ $tab ]['sections'][ $section ]['fields'];
|
2296 |
+
} else {
|
2297 |
+
$fields = $this->settings_structure[ $tab ]['fields'];
|
2298 |
+
}
|
2299 |
+
|
2300 |
+
if ( empty( $fields ) ) {
|
2301 |
+
return $settings;
|
2302 |
+
}
|
2303 |
+
|
2304 |
+
|
2305 |
+
$filtered_settings = array();
|
2306 |
+
foreach ( $settings as $key => $value ) {
|
2307 |
+
|
2308 |
+
$filtered_settings[ $key ] = $value;
|
2309 |
+
|
2310 |
+
foreach ( $fields as $field ) {
|
2311 |
+
if ( $field['id'] == $key && isset( $field['type'] ) && $field['type'] == 'multi_text' ) {
|
2312 |
+
$filtered_settings[ $key ] = array_filter( $settings[ $key ] );
|
2313 |
+
}
|
2314 |
+
}
|
2315 |
+
}
|
2316 |
+
|
2317 |
+
return $filtered_settings;
|
2318 |
+
}
|
2319 |
+
|
2320 |
+
|
2321 |
+
/**
|
2322 |
+
*
|
2323 |
+
*/
|
2324 |
+
function check_permalinks_changes() {
|
2325 |
+
if ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
|
2326 |
+
if ( UM()->options()->get( 'permalink_base' ) !== $_POST['um_options']['permalink_base'] ) {
|
2327 |
+
$this->need_change_permalinks = true;
|
2328 |
+
}
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
// set variable if gravatar settings were changed
|
2332 |
+
// update for um_member_directory_data metakey
|
2333 |
+
if ( isset( $_POST['um_options']['use_gravatars'] ) ) {
|
2334 |
+
$use_gravatar = UM()->options()->get( 'use_gravatars' );
|
2335 |
+
if ( ( empty( $use_gravatar ) && ! empty( $_POST['um_options']['use_gravatars'] ) ) || ( ! empty( $use_gravatar ) && empty( $_POST['um_options']['use_gravatars'] ) ) ) {
|
2336 |
+
$this->gravatar_changed = true;
|
2337 |
+
}
|
2338 |
+
}
|
2339 |
+
}
|
2340 |
+
|
2341 |
+
|
2342 |
+
/**
|
2343 |
+
*
|
2344 |
+
*/
|
2345 |
+
function on_settings_save() {
|
2346 |
+
if ( ! empty( $_POST['um_options'] ) ) {
|
2347 |
+
|
2348 |
+
if ( ! empty( $_POST['um_options']['pages_settings'] ) ) {
|
2349 |
+
$post_ids = new \WP_Query( array(
|
2350 |
+
'post_type' => 'page',
|
2351 |
+
'meta_query' => array(
|
2352 |
+
array(
|
2353 |
+
'key' => '_um_core',
|
2354 |
+
'compare' => 'EXISTS'
|
2355 |
+
)
|
2356 |
+
),
|
2357 |
+
'posts_per_page' => -1,
|
2358 |
+
'fields' => 'ids'
|
2359 |
+
) );
|
2360 |
+
|
2361 |
+
$post_ids = $post_ids->get_posts();
|
2362 |
+
|
2363 |
+
if ( ! empty( $post_ids ) ) {
|
2364 |
+
foreach ( $post_ids as $post_id ) {
|
2365 |
+
delete_post_meta( $post_id, '_um_core' );
|
2366 |
+
}
|
2367 |
+
}
|
2368 |
+
|
2369 |
+
foreach ( $_POST['um_options'] as $option_slug => $post_id ) {
|
2370 |
+
$slug = str_replace( 'core_', '', $option_slug );
|
2371 |
+
update_post_meta( $post_id, '_um_core', $slug );
|
2372 |
+
}
|
2373 |
+
|
2374 |
+
// reset rewrite rules after re-save pages
|
2375 |
+
UM()->rewrite()->reset_rules();
|
2376 |
+
|
2377 |
+
} elseif ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
|
2378 |
+
if ( ! empty( $this->need_change_permalinks ) ) {
|
2379 |
+
$users = get_users( array(
|
2380 |
+
'fields' => 'ids',
|
2381 |
+
) );
|
2382 |
+
if ( ! empty( $users ) ) {
|
2383 |
+
foreach ( $users as $user_id ) {
|
2384 |
+
UM()->user()->generate_profile_slug( $user_id );
|
2385 |
+
}
|
2386 |
+
}
|
2387 |
+
}
|
2388 |
+
|
2389 |
+
|
2390 |
+
// update for um_member_directory_data metakey
|
2391 |
+
if ( isset( $_POST['um_options']['use_gravatars'] ) ) {
|
2392 |
+
if ( $this->gravatar_changed ) {
|
2393 |
+
global $wpdb;
|
2394 |
+
|
2395 |
+
if ( ! empty( $_POST['um_options']['use_gravatars'] ) ) {
|
2396 |
+
|
2397 |
+
$results = $wpdb->get_col(
|
2398 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2399 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND um.meta_key = 'synced_gravatar_hashed_id' )
|
2400 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2401 |
+
WHERE um.meta_value != '' AND um.meta_value IS NOT NULL AND
|
2402 |
+
um2.meta_value LIKE '%s:13:\"profile_photo\";b:0;%'"
|
2403 |
+
);
|
2404 |
+
|
2405 |
+
} else {
|
2406 |
+
|
2407 |
+
$results = $wpdb->get_col(
|
2408 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2409 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND ( um.meta_key = 'synced_profile_photo' || um.meta_key = 'profile_photo' ) )
|
2410 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2411 |
+
WHERE ( um.meta_value IS NULL OR um.meta_value = '' ) AND
|
2412 |
+
um2.meta_value LIKE '%s:13:\"profile_photo\";b:1;%'"
|
2413 |
+
);
|
2414 |
+
|
2415 |
+
}
|
2416 |
+
|
2417 |
+
if ( ! empty( $results ) ) {
|
2418 |
+
foreach ( $results as $user_id ) {
|
2419 |
+
$md_data = get_user_meta( $user_id, 'um_member_directory_data', true );
|
2420 |
+
if ( ! empty( $md_data ) ) {
|
2421 |
+
$md_data['profile_photo'] = ! empty( $_POST['um_options']['use_gravatars'] );
|
2422 |
+
update_user_meta( $user_id, 'um_member_directory_data', $md_data );
|
2423 |
+
}
|
2424 |
+
}
|
2425 |
+
}
|
2426 |
+
}
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
} elseif ( isset( $_POST['um_options']['member_directory_own_table'] ) ) {
|
2430 |
+
if ( empty( $_POST['um_options']['member_directory_own_table'] ) ) {
|
2431 |
+
global $wpdb;
|
2432 |
+
|
2433 |
+
$results = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}um_metadata LIMIT 1", ARRAY_A );
|
2434 |
+
|
2435 |
+
if ( ! empty( $results ) ) {
|
2436 |
+
$wpdb->query("TRUNCATE TABLE {$wpdb->prefix}um_metadata" );
|
2437 |
+
}
|
2438 |
+
|
2439 |
+
update_option( 'um_member_directory_truncated', time() );
|
2440 |
+
}
|
2441 |
+
} elseif ( isset( $_POST['um_options']['account_hide_in_directory_default'] ) ) {
|
2442 |
+
|
2443 |
+
global $wpdb;
|
2444 |
+
|
2445 |
+
if ( $_POST['um_options']['account_hide_in_directory_default'] === 'No' ) {
|
2446 |
+
|
2447 |
+
$results = $wpdb->get_col(
|
2448 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2449 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND um.meta_key = 'hide_in_members' )
|
2450 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2451 |
+
WHERE um.meta_value IS NULL AND
|
2452 |
+
um2.meta_value LIKE '%s:15:\"hide_in_members\";b:1;%'"
|
2453 |
+
);
|
2454 |
+
|
2455 |
+
} else {
|
2456 |
+
|
2457 |
+
$results = $wpdb->get_col(
|
2458 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2459 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND um.meta_key = 'hide_in_members' )
|
2460 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2461 |
+
WHERE um.meta_value IS NULL AND
|
2462 |
+
um2.meta_value LIKE '%s:15:\"hide_in_members\";b:0;%'"
|
2463 |
+
);
|
2464 |
+
|
2465 |
+
}
|
2466 |
+
|
2467 |
+
if ( ! empty( $results ) ) {
|
2468 |
+
foreach ( $results as $user_id ) {
|
2469 |
+
$md_data = get_user_meta( $user_id, 'um_member_directory_data', true );
|
2470 |
+
if ( ! empty( $md_data ) ) {
|
2471 |
+
$md_data['hide_in_members'] = ( $_POST['um_options']['account_hide_in_directory_default'] === 'No' ) ? false : true;
|
2472 |
+
update_user_meta( $user_id, 'um_member_directory_data', $md_data );
|
2473 |
+
}
|
2474 |
+
}
|
2475 |
+
}
|
2476 |
+
|
2477 |
+
}
|
2478 |
+
}
|
2479 |
+
}
|
2480 |
+
|
2481 |
+
|
2482 |
+
/**
|
2483 |
+
*
|
2484 |
+
*/
|
2485 |
+
function before_licenses_save() {
|
2486 |
+
if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) ) {
|
2487 |
+
return;
|
2488 |
+
}
|
2489 |
+
|
2490 |
+
foreach ( $_POST['um_options'] as $key => $value ) {
|
2491 |
+
$this->previous_licenses[ sanitize_key( $key ) ] = UM()->options()->get( $key );
|
2492 |
+
}
|
2493 |
+
}
|
2494 |
+
|
2495 |
+
|
2496 |
+
/**
|
2497 |
+
*
|
2498 |
+
*/
|
2499 |
+
function licenses_save() {
|
2500 |
+
if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) ) {
|
2501 |
+
return;
|
2502 |
+
}
|
2503 |
+
|
2504 |
+
foreach ( $_POST['um_options'] as $key => $value ) {
|
2505 |
+
$key = sanitize_key( $key );
|
2506 |
+
$value = sanitize_text_field( $value );
|
2507 |
+
|
2508 |
+
$edd_action = '';
|
2509 |
+
$license_key = '';
|
2510 |
+
if ( empty( $this->previous_licenses[ $key ] ) && ! empty( $value ) || ( ! empty( $this->previous_licenses[ $key ] ) && ! empty( $value ) && $this->previous_licenses[ $key ] != $value ) ) {
|
2511 |
+
$edd_action = 'activate_license';
|
2512 |
+
$license_key = $value;
|
2513 |
+
} elseif ( ! empty( $this->previous_licenses[ $key ] ) && empty( $value ) ) {
|
2514 |
+
$edd_action = 'deactivate_license';
|
2515 |
+
$license_key = $this->previous_licenses[ $key ];
|
2516 |
+
} elseif ( ! empty( $this->previous_licenses[ $key ] ) && ! empty( $value ) ) {
|
2517 |
+
$edd_action = 'check_license';
|
2518 |
+
$license_key = $value;
|
2519 |
+
}
|
2520 |
+
|
2521 |
+
if ( empty( $edd_action ) ) {
|
2522 |
+
continue;
|
2523 |
+
}
|
2524 |
+
|
2525 |
+
$item_name = false;
|
2526 |
+
$version = false;
|
2527 |
+
$author = false;
|
2528 |
+
foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) {
|
2529 |
+
if ( $field_data['id'] == $key ) {
|
2530 |
+
$item_name = ! empty( $field_data['item_name'] ) ? $field_data['item_name'] : false;
|
2531 |
+
$version = ! empty( $field_data['version'] ) ? $field_data['version'] : false;
|
2532 |
+
$author = ! empty( $field_data['author'] ) ? $field_data['author'] : false;
|
2533 |
+
}
|
2534 |
+
}
|
2535 |
+
|
2536 |
+
$api_params = array(
|
2537 |
+
'edd_action' => $edd_action,
|
2538 |
+
'license' => $license_key,
|
2539 |
+
'item_name' => $item_name,
|
2540 |
+
'version' => $version,
|
2541 |
+
'author' => $author,
|
2542 |
+
'url' => home_url(),
|
2543 |
+
);
|
2544 |
+
|
2545 |
+
$request = wp_remote_post(
|
2546 |
+
UM()->store_url,
|
2547 |
+
array(
|
2548 |
+
'timeout' => UM()->request_timeout,
|
2549 |
+
'sslverify' => false,
|
2550 |
+
'body' => $api_params
|
2551 |
+
)
|
2552 |
+
);
|
2553 |
+
|
2554 |
+
if ( ! is_wp_error( $request ) ) {
|
2555 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
2556 |
+
} else {
|
2557 |
+
$request = wp_remote_post(
|
2558 |
+
UM()->store_url,
|
2559 |
+
array(
|
2560 |
+
'timeout' => UM()->request_timeout,
|
2561 |
+
'sslverify' => true,
|
2562 |
+
'body' => $api_params
|
2563 |
+
)
|
2564 |
+
);
|
2565 |
+
|
2566 |
+
if ( ! is_wp_error( $request ) ) {
|
2567 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
2568 |
+
}
|
2569 |
+
}
|
2570 |
+
|
2571 |
+
$request = ( $request ) ? maybe_unserialize( $request ) : false;
|
2572 |
+
|
2573 |
+
if ( $edd_action == 'activate_license' || $edd_action == 'check_license' ) {
|
2574 |
+
update_option( "{$key}_edd_answer", $request );
|
2575 |
+
} else {
|
2576 |
+
delete_option( "{$key}_edd_answer" );
|
2577 |
+
}
|
2578 |
+
|
2579 |
+
}
|
2580 |
+
}
|
2581 |
+
|
2582 |
+
|
2583 |
+
/**
|
2584 |
+
*
|
2585 |
+
*/
|
2586 |
+
function settings_before_email_tab() {
|
2587 |
+
$email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] );
|
2588 |
+
$emails = UM()->config()->email_notifications;
|
2589 |
+
|
2590 |
+
if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
|
2591 |
+
include_once um_path . 'includes/admin/core/list-tables/emails-list-table.php';
|
2592 |
+
}
|
2593 |
+
}
|
2594 |
+
|
2595 |
+
|
2596 |
+
/**
|
2597 |
+
* @param $section
|
2598 |
+
*
|
2599 |
+
* @return string
|
2600 |
+
*/
|
2601 |
+
function settings_email_tab( $section ) {
|
2602 |
+
$email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] );
|
2603 |
+
$emails = UM()->config()->email_notifications;
|
2604 |
+
|
2605 |
+
if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
|
2606 |
+
return $section;
|
2607 |
+
}
|
2608 |
+
|
2609 |
+
$in_theme = UM()->mail()->template_in_theme( $email_key );
|
2610 |
+
|
2611 |
+
/**
|
2612 |
+
* UM hook
|
2613 |
+
*
|
2614 |
+
* @type filter
|
2615 |
+
* @title um_admin_settings_email_section_fields
|
2616 |
+
* @description Extend UM Email Settings
|
2617 |
+
* @input_vars
|
2618 |
+
* [{"var":"$settings","type":"array","desc":"UM Email Settings"},
|
2619 |
+
* {"var":"$email_key","type":"string","desc":"Email Key"}]
|
2620 |
+
* @change_log
|
2621 |
+
* ["Since: 2.0"]
|
2622 |
+
* @usage add_filter( 'um_admin_settings_email_section_fields', 'function_name', 10, 2 );
|
2623 |
+
* @example
|
2624 |
+
* <?php
|
2625 |
+
* add_filter( 'um_admin_settings_email_section_fields', 'my_admin_settings_email_section', 10, 2 );
|
2626 |
+
* function my_admin_settings_email_section( $settings, $email_key ) {
|
2627 |
+
* // your code here
|
2628 |
+
* return $settings;
|
2629 |
+
* }
|
2630 |
+
* ?>
|
2631 |
+
*/
|
2632 |
+
$section_fields = apply_filters( 'um_admin_settings_email_section_fields', array(
|
2633 |
+
array(
|
2634 |
+
'id' => 'um_email_template',
|
2635 |
+
'type' => 'hidden',
|
2636 |
+
'value' => $email_key,
|
2637 |
+
),
|
2638 |
+
array(
|
2639 |
+
'id' => $email_key . '_on',
|
2640 |
+
'type' => 'checkbox',
|
2641 |
+
'label' => $emails[ $email_key ]['title'],
|
2642 |
+
'tooltip' => $emails[ $email_key ]['description'],
|
2643 |
+
),
|
2644 |
+
array(
|
2645 |
+
'id' => $email_key . '_sub',
|
2646 |
+
'type' => 'text',
|
2647 |
+
'label' => __( 'Subject Line', 'ultimate-member' ),
|
2648 |
+
'conditional' => array( $email_key . '_on', '=', 1 ),
|
2649 |
+
'tooltip' => __( 'This is the subject line of the e-mail', 'ultimate-member' ),
|
2650 |
+
),
|
2651 |
+
array(
|
2652 |
+
'id' => $email_key,
|
2653 |
+
'type' => 'email_template',
|
2654 |
+
'label' => __( 'Message Body', 'ultimate-member' ),
|
2655 |
+
'conditional' => array( $email_key . '_on', '=', 1 ),
|
2656 |
+
'tooltip' => __( 'This is the content of the e-mail', 'ultimate-member' ),
|
2657 |
+
'value' => UM()->mail()->get_email_template( $email_key ),
|
2658 |
+
'in_theme' => $in_theme
|
2659 |
+
),
|
2660 |
+
), $email_key );
|
2661 |
+
|
2662 |
+
return $this->render_settings_section( $section_fields, 'email', $email_key );
|
2663 |
+
}
|
2664 |
+
|
2665 |
+
|
2666 |
+
/**
|
2667 |
+
*
|
2668 |
+
*/
|
2669 |
+
function settings_appearance_profile_tab() {
|
2670 |
+
wp_enqueue_media();
|
2671 |
+
}
|
2672 |
+
|
2673 |
+
|
2674 |
+
/**
|
2675 |
+
* @param $html
|
2676 |
+
* @param $section_fields
|
2677 |
+
*
|
2678 |
+
* @return string
|
2679 |
+
*/
|
2680 |
+
function settings_licenses_tab( $html, $section_fields ) {
|
2681 |
+
ob_start(); ?>
|
2682 |
+
|
2683 |
+
<div class="wrap-licenses">
|
2684 |
+
<input type="hidden" id="licenses_settings" name="licenses_settings" value="1">
|
2685 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2686 |
+
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
|
2687 |
+
<table class="form-table um-settings-section">
|
2688 |
+
<tbody>
|
2689 |
+
<?php foreach ( $section_fields as $field_data ) {
|
2690 |
+
$option_value = UM()->options()->get( $field_data['id'] );
|
2691 |
+
$value = isset( $option_value ) && ! empty( $option_value ) ? $option_value : ( isset( $field_data['default'] ) ? $field_data['default'] : '' );
|
2692 |
+
|
2693 |
+
$license = get_option( "{$field_data['id']}_edd_answer" );
|
2694 |
+
|
2695 |
+
if ( is_object( $license ) && ! empty( $value ) ) {
|
2696 |
+
// activate_license 'invalid' on anything other than valid, so if there was an error capture it
|
2697 |
+
if ( empty( $license->success ) ) {
|
2698 |
+
|
2699 |
+
if ( ! empty( $license->error ) ) {
|
2700 |
+
switch ( $license->error ) {
|
2701 |
+
|
2702 |
+
case 'expired' :
|
2703 |
+
|
2704 |
+
$class = 'expired';
|
2705 |
+
$messages[] = sprintf(
|
2706 |
+
__( 'Your license key expired on %s. Please <a href="%s" target="_blank">renew your license key</a>.', 'ultimate-member' ),
|
2707 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
2708 |
+
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
|
2709 |
+
);
|
2710 |
+
|
2711 |
+
$license_status = 'license-' . $class . '-notice';
|
2712 |
+
|
2713 |
+
break;
|
2714 |
+
|
2715 |
+
case 'revoked' :
|
2716 |
+
|
2717 |
+
$class = 'error';
|
2718 |
+
$messages[] = sprintf(
|
2719 |
+
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'ultimate-member' ),
|
2720 |
+
'https://ultimatemember.com/support?utm_campaign=admin&utm_source=licenses&utm_medium=revoked'
|
2721 |
+
);
|
2722 |
+
|
2723 |
+
$license_status = 'license-' . $class . '-notice';
|
2724 |
+
|
2725 |
+
break;
|
2726 |
+
|
2727 |
+
case 'missing' :
|
2728 |
+
|
2729 |
+
$class = 'error';
|
2730 |
+
$messages[] = sprintf(
|
2731 |
+
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'ultimate-member' ),
|
2732 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
|
2733 |
+
);
|
2734 |
+
|
2735 |
+
$license_status = 'license-' . $class . '-notice';
|
2736 |
+
|
2737 |
+
break;
|
2738 |
+
|
2739 |
+
case 'invalid' :
|
2740 |
+
case 'site_inactive' :
|
2741 |
+
|
2742 |
+
$class = 'error';
|
2743 |
+
$messages[] = sprintf(
|
2744 |
+
__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank">visit your account page</a> to manage your license key URLs.', 'ultimate-member' ),
|
2745 |
+
$field_data['item_name'],
|
2746 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
|
2747 |
+
);
|
2748 |
+
|
2749 |
+
$license_status = 'license-' . $class . '-notice';
|
2750 |
+
|
2751 |
+
break;
|
2752 |
+
|
2753 |
+
case 'item_name_mismatch' :
|
2754 |
+
|
2755 |
+
$class = 'error';
|
2756 |
+
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'ultimate-member' ), $field_data['item_name'] );
|
2757 |
+
|
2758 |
+
$license_status = 'license-' . $class . '-notice';
|
2759 |
+
|
2760 |
+
break;
|
2761 |
+
|
2762 |
+
case 'no_activations_left':
|
2763 |
+
|
2764 |
+
$class = 'error';
|
2765 |
+
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'ultimate-member' ), 'https://ultimatemember.com/account' );
|
2766 |
+
|
2767 |
+
$license_status = 'license-' . $class . '-notice';
|
2768 |
+
|
2769 |
+
break;
|
2770 |
+
|
2771 |
+
case 'license_not_activable':
|
2772 |
+
|
2773 |
+
$class = 'error';
|
2774 |
+
$messages[] = __( 'The key you entered belongs to a bundle, please use the product specific license key.', 'ultimate-member' );
|
2775 |
+
|
2776 |
+
$license_status = 'license-' . $class . '-notice';
|
2777 |
+
break;
|
2778 |
+
|
2779 |
+
default :
|
2780 |
+
|
2781 |
+
$class = 'error';
|
2782 |
+
$error = ! empty( $license->error ) ? $license->error : __( 'unknown_error', 'ultimate-member' );
|
2783 |
+
$messages[] = sprintf( __( 'There was an error with this license key: %s. Please <a href="%s">contact our support team</a>.', 'ultimate-member' ), $error, 'https://ultimatemember.com/support' );
|
2784 |
+
|
2785 |
+
$license_status = 'license-' . $class . '-notice';
|
2786 |
+
break;
|
2787 |
+
}
|
2788 |
+
} else {
|
2789 |
+
$class = 'error';
|
2790 |
+
$error = ! empty( $license->error ) ? $license->error : __( 'unknown_error', 'ultimate-member' );
|
2791 |
+
$messages[] = sprintf( __( 'There was an error with this license key: %s. Please <a href="%s">contact our support team</a>.', 'ultimate-member' ), $error, 'https://ultimatemember.com/support' );
|
2792 |
+
|
2793 |
+
$license_status = 'license-' . $class . '-notice';
|
2794 |
+
}
|
2795 |
+
|
2796 |
+
} elseif ( ! empty( $license->errors ) ) {
|
2797 |
+
|
2798 |
+
$errors = array_keys( $license->errors );
|
2799 |
+
$errors_data = array_values( $license->errors );
|
2800 |
+
|
2801 |
+
$class = 'error';
|
2802 |
+
$error = ! empty( $errors[0] ) ? $errors[0] : __( 'unknown_error', 'ultimate-member' );
|
2803 |
+
$errors_data = ! empty( $errors_data[0][0] ) ? ', ' . $errors_data[0][0] : '';
|
2804 |
+
$messages[] = sprintf( __( 'There was an error with this license key: %s%s. Please <a href="%s">contact our support team</a>.', 'ultimate-member' ), $error, $errors_data, 'https://ultimatemember.com/support' );
|
2805 |
+
|
2806 |
+
$license_status = 'license-' . $class . '-notice';
|
2807 |
+
|
2808 |
+
} else {
|
2809 |
+
|
2810 |
+
switch( $license->license ) {
|
2811 |
+
|
2812 |
+
case 'expired' :
|
2813 |
+
|
2814 |
+
$class = 'expired';
|
2815 |
+
$messages[] = sprintf(
|
2816 |
+
__( 'Your license key expired on %s. Please <a href="%s" target="_blank">renew your license key</a>.', 'ultimate-member' ),
|
2817 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
2818 |
+
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
|
2819 |
+
);
|
2820 |
+
|
2821 |
+
$license_status = 'license-' . $class . '-notice';
|
2822 |
+
|
2823 |
+
break;
|
2824 |
+
|
2825 |
+
case 'revoked' :
|
2826 |
+
|
2827 |
+
$class = 'error';
|
2828 |
+
$messages[] = sprintf(
|
2829 |
+
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'ultimate-member' ),
|
2830 |
+
'https://ultimatemember.com/support?utm_campaign=admin&utm_source=licenses&utm_medium=revoked'
|
2831 |
+
);
|
2832 |
+
|
2833 |
+
$license_status = 'license-' . $class . '-notice';
|
2834 |
+
|
2835 |
+
break;
|
2836 |
+
|
2837 |
+
case 'missing' :
|
2838 |
+
|
2839 |
+
$class = 'error';
|
2840 |
+
$messages[] = sprintf(
|
2841 |
+
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'ultimate-member' ),
|
2842 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
|
2843 |
+
);
|
2844 |
+
|
2845 |
+
$license_status = 'license-' . $class . '-notice';
|
2846 |
+
|
2847 |
+
break;
|
2848 |
+
|
2849 |
+
case 'invalid' :
|
2850 |
+
case 'site_inactive' :
|
2851 |
+
|
2852 |
+
$class = 'error';
|
2853 |
+
$messages[] = sprintf(
|
2854 |
+
__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank">visit your account page</a> to manage your license key URLs.', 'ultimate-member' ),
|
2855 |
+
$field_data['item_name'],
|
2856 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
|
2857 |
+
);
|
2858 |
+
|
2859 |
+
$license_status = 'license-' . $class . '-notice';
|
2860 |
+
|
2861 |
+
break;
|
2862 |
+
|
2863 |
+
case 'item_name_mismatch' :
|
2864 |
+
|
2865 |
+
$class = 'error';
|
2866 |
+
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'ultimate-member' ), $field_data['item_name'] );
|
2867 |
+
|
2868 |
+
$license_status = 'license-' . $class . '-notice';
|
2869 |
+
|
2870 |
+
break;
|
2871 |
+
|
2872 |
+
case 'no_activations_left':
|
2873 |
+
|
2874 |
+
$class = 'error';
|
2875 |
+
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'ultimate-member' ), 'https://ultimatemember.com/account' );
|
2876 |
+
|
2877 |
+
$license_status = 'license-' . $class . '-notice';
|
2878 |
+
|
2879 |
+
break;
|
2880 |
+
|
2881 |
+
case 'license_not_activable':
|
2882 |
+
|
2883 |
+
$class = 'error';
|
2884 |
+
$messages[] = __( 'The key you entered belongs to a bundle, please use the product specific license key.', 'ultimate-member' );
|
2885 |
+
|
2886 |
+
$license_status = 'license-' . $class . '-notice';
|
2887 |
+
break;
|
2888 |
+
|
2889 |
+
case 'valid' :
|
2890 |
+
default:
|
2891 |
+
|
2892 |
+
$class = 'valid';
|
2893 |
+
|
2894 |
+
$now = current_time( 'timestamp' );
|
2895 |
+
$expiration = strtotime( $license->expires, $now );
|
2896 |
+
|
2897 |
+
if( 'lifetime' === $license->expires ) {
|
2898 |
+
|
2899 |
+
$messages[] = __( 'License key never expires.', 'ultimate-member' );
|
2900 |
+
|
2901 |
+
$license_status = 'license-lifetime-notice';
|
2902 |
+
|
2903 |
+
} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
|
2904 |
+
|
2905 |
+
$messages[] = sprintf(
|
2906 |
+
__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank">Renew your license key</a>.', 'ultimate-member' ),
|
2907 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
2908 |
+
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
|
2909 |
+
);
|
2910 |
+
|
2911 |
+
$license_status = 'license-expires-soon-notice';
|
2912 |
+
|
2913 |
+
} else {
|
2914 |
+
|
2915 |
+
$messages[] = sprintf(
|
2916 |
+
__( 'Your license key expires on %s.', 'ultimate-member' ),
|
2917 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
|
2918 |
+
);
|
2919 |
+
|
2920 |
+
$license_status = 'license-expiration-date-notice';
|
2921 |
+
|
2922 |
+
}
|
2923 |
+
|
2924 |
+
break;
|
2925 |
+
|
2926 |
+
}
|
2927 |
+
|
2928 |
+
}
|
2929 |
+
|
2930 |
+
} else {
|
2931 |
+
$class = 'empty';
|
2932 |
+
|
2933 |
+
$messages[] = sprintf(
|
2934 |
+
__( 'To receive updates, please enter your valid %s license key.', 'ultimate-member' ),
|
2935 |
+
$field_data['item_name']
|
2936 |
+
);
|
2937 |
+
|
2938 |
+
$license_status = null;
|
2939 |
+
|
2940 |
+
} ?>
|
2941 |
+
|
2942 |
+
<tr class="um-settings-line">
|
2943 |
+
<th><label for="um_options_<?php echo esc_attr( $field_data['id'] ) ?>"><?php echo esc_html( $field_data['label'] ) ?></label></th>
|
2944 |
+
<td>
|
2945 |
+
<form method="post" action="" name="um-settings-form" class="um-settings-form">
|
2946 |
+
<input type="hidden" value="save" name="um-settings-action" />
|
2947 |
+
<input type="hidden" name="licenses_settings" value="1" />
|
2948 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2949 |
+
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
|
2950 |
+
<input type="text" id="um_options_<?php echo esc_attr( $field_data['id'] ) ?>" name="um_options[<?php echo esc_attr( $field_data['id'] ) ?>]" value="<?php echo $value ?>" class="um-option-field um-long-field" data-field_id="<?php echo esc_attr( $field_data['id'] ) ?>" />
|
2951 |
+
<?php if ( ! empty( $field_data['description'] ) ) { ?>
|
2952 |
+
<div class="description"><?php echo $field_data['description'] ?></div>
|
2953 |
+
<?php } ?>
|
2954 |
+
|
2955 |
+
<?php if ( ! empty( $value ) && ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) ) { ?>
|
2956 |
+
<input type="button" class="button um_license_deactivate" id="<?php echo esc_attr( $field_data['id'] ) ?>_deactivate" value="<?php esc_attr_e( 'Clear License', 'ultimate-member' ) ?>"/>
|
2957 |
+
<?php } elseif ( empty( $value ) ) { ?>
|
2958 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Activate', 'ultimate-member' ) ?>" />
|
2959 |
+
<?php } else { ?>
|
2960 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Re-Activate', 'ultimate-member' ) ?>" />
|
2961 |
+
<?php }
|
2962 |
+
|
2963 |
+
if ( ! empty( $messages ) ) {
|
2964 |
+
foreach ( $messages as $message ) { ?>
|
2965 |
+
<div class="edd-license-data edd-license-<?php echo esc_attr( $class . ' ' . $license_status ) ?>">
|
2966 |
+
<p><?php echo $message ?></p>
|
2967 |
+
</div>
|
2968 |
+
<?php }
|
2969 |
+
} ?>
|
2970 |
+
</form>
|
2971 |
+
</td>
|
2972 |
+
</tr>
|
2973 |
+
<?php } ?>
|
2974 |
+
</tbody>
|
2975 |
+
</table>
|
2976 |
+
</div>
|
2977 |
+
<?php $section = ob_get_clean();
|
2978 |
+
|
2979 |
+
return $section;
|
2980 |
+
}
|
2981 |
+
|
2982 |
+
|
2983 |
+
/**
|
2984 |
+
* @param $html
|
2985 |
+
* @param $section_fields
|
2986 |
+
*/
|
2987 |
+
function settings_install_info_tab( $html, $section_fields ) {
|
2988 |
+
global $wpdb;
|
2989 |
+
|
2990 |
+
if ( ! class_exists( '\Browser' ) )
|
2991 |
+
require_once um_path . 'includes/lib/browser.php';
|
2992 |
+
|
2993 |
+
// Detect browser
|
2994 |
+
$browser = new \Browser();
|
2995 |
+
|
2996 |
+
// Get theme info
|
2997 |
+
$theme_data = wp_get_theme();
|
2998 |
+
$theme = $theme_data->Name . ' ' . $theme_data->Version;
|
2999 |
+
|
3000 |
+
// Identify Hosting Provider
|
3001 |
+
$host = um_get_host();
|
3002 |
+
|
3003 |
+
um_fetch_user( get_current_user_id() );
|
3004 |
+
|
3005 |
+
if ( isset( $this->content ) ) {
|
3006 |
+
echo $this->content;
|
3007 |
+
} else { ?>
|
3008 |
+
|
3009 |
+
<h3>Install Info</h3>
|
3010 |
+
|
3011 |
+
<form action="" method="post" dir="ltr">
|
3012 |
+
<textarea style="width:70%; height:400px;" readonly="readonly" onclick="this.focus();this.select()" id="install-info-textarea" name="um-install-info" title="<?php _e( 'To copy the Install info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'ultimate-member' ); ?>">
|
3013 |
+
### Begin Install Info ###
|
3014 |
+
|
3015 |
+
## Please include this information when posting support requests ##
|
3016 |
+
|
3017 |
+
<?php
|
3018 |
+
/**
|
3019 |
+
* UM hook
|
3020 |
+
*
|
3021 |
+
* @type action
|
3022 |
+
* @title um_install_info_before
|
3023 |
+
* @description Before install info settings
|
3024 |
+
* @change_log
|
3025 |
+
* ["Since: 2.0"]
|
3026 |
+
* @usage add_action( 'um_install_info_before', 'function_name', 10 );
|
3027 |
+
* @example
|
3028 |
+
* <?php
|
3029 |
+
* add_action( 'um_install_info_before', 'my_install_info_before', 10 );
|
3030 |
+
* function my_install_info_before() {
|
3031 |
+
* // your code here
|
3032 |
+
* }
|
3033 |
+
* ?>
|
3034 |
+
*/
|
3035 |
+
do_action( 'um_install_info_before' ); ?>
|
3036 |
+
|
3037 |
+
--- Site Info ---
|
3038 |
+
|
3039 |
+
Site URL: <?php echo site_url() . "\n"; ?>
|
3040 |
+
Home URL: <?php echo home_url() . "\n"; ?>
|
3041 |
+
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
|
3042 |
+
|
3043 |
+
--- Hosting Provider ---
|
3044 |
+
|
3045 |
+
<?php if( $host ) : ?>
|
3046 |
+
Host: <?php echo $host . "\n"; ?>
|
3047 |
+
<?php endif; ?>
|
3048 |
+
|
3049 |
+
--- User Browser ---
|
3050 |
+
|
3051 |
+
<?php echo $browser ; ?>
|
3052 |
+
|
3053 |
+
---- Current User Details --
|
3054 |
+
|
3055 |
+
<?php $user = wp_get_current_user(); ?>
|
3056 |
+
Role: <?php echo implode( ', ', um_user( 'roles' ) ). "\n"; ?>
|
3057 |
+
|
3058 |
+
|
3059 |
+
--- WordPress Configurations ---
|
3060 |
+
|
3061 |
+
Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
|
3062 |
+
Language: <?php echo get_locale()."\n"; ?>
|
3063 |
+
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
|
3064 |
+
Active Theme: <?php echo $theme . "\n"; ?>
|
3065 |
+
<?php $show_on_front = get_option( 'show_on_front' ); ?>
|
3066 |
+
<?php if( $show_on_front == "posts" ): ?>
|
3067 |
+
Show On Front: <?php echo get_option( 'show_on_front' ) . "/static\n" ?>
|
3068 |
+
<?php elseif( $show_on_front == "page" ): ?>
|
3069 |
+
Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
|
3070 |
+
Page For Posts: <?php $id = get_option( 'page_for_posts' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
|
3071 |
+
<?php endif; ?>
|
3072 |
+
ABSPATH: <?php echo ABSPATH."\n"; ?>
|
3073 |
+
<?php $wp_count_posts = wp_count_posts(); ?>
|
3074 |
+
All Posts/Pages: <?php echo array_sum((array)$wp_count_posts)."\n";?>
|
3075 |
+
<?php
|
3076 |
+
$request['cmd'] = '_notify-validate';
|
3077 |
+
|
3078 |
+
$params = array(
|
3079 |
+
'sslverify' => false,
|
3080 |
+
'timeout' => 60,
|
3081 |
+
'user-agent' => 'UltimateMember/' . ultimatemember_version,
|
3082 |
+
'body' => $request
|
3083 |
+
);
|
3084 |
+
|
3085 |
+
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
|
3086 |
+
|
3087 |
+
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
|
3088 |
+
$WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
|
3089 |
+
} else {
|
3090 |
+
$WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
|
3091 |
+
}
|
3092 |
+
?>
|
3093 |
+
WP Remote Post: <?php echo $WP_REMOTE_POST; ?>
|
3094 |
+
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
|
3095 |
+
WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo ", Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?>
|
3096 |
+
Memory Limit: <?php echo ( um_let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php echo "\n"; ?>
|
3097 |
+
|
3098 |
+
|
3099 |
+
--- UM Configurations ---
|
3100 |
+
|
3101 |
+
Version: <?php echo ultimatemember_version . "\n"; ?>
|
3102 |
+
Upgraded From: <?php echo get_option( 'um_last_version_upgrade', 'None' ) . "\n"; ?>
|
3103 |
+
Current URL Method: <?php echo UM()->options()->get( 'current_url_method' ). "\n"; ?>
|
3104 |
+
Cache User Profile: <?php if( UM()->options()->get( 'um_profile_object_cache_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
3105 |
+
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
3106 |
+
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3107 |
+
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3108 |
+
<?php if( is_multisite() ): ?>
|
3109 |
+
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
|
3110 |
+
<?php endif; ?>
|
3111 |
+
Port Forwarding in URL: <?php if( UM()->options()->get( 'um_port_forwarding_url' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3112 |
+
Exclude CSS/JS on Home: <?php if( UM()->options()->get( 'js_css_exlcude_home' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3113 |
+
|
3114 |
+
|
3115 |
+
--- UM Pages Configuration ---
|
3116 |
+
|
3117 |
+
<?php
|
3118 |
+
/**
|
3119 |
+
* UM hook
|
3120 |
+
*
|
3121 |
+
* @type action
|
3122 |
+
* @title um_install_info_before_page_config
|
3123 |
+
* @description Before page config install info
|
3124 |
+
* @change_log
|
3125 |
+
* ["Since: 2.0"]
|
3126 |
+
* @usage add_action( 'um_install_info_before_page_config', 'function_name', 10 );
|
3127 |
+
* @example
|
3128 |
+
* <?php
|
3129 |
+
* add_action( 'um_install_info_before_page_config', 'my_install_info_before_page_config', 10 );
|
3130 |
+
* function my_install_info_before_page_config() {
|
3131 |
+
* // your code here
|
3132 |
+
* }
|
3133 |
+
* ?>
|
3134 |
+
*/
|
3135 |
+
do_action( "um_install_info_before_page_config" ); ?>
|
3136 |
+
User: <?php echo get_permalink( UM()->options()->get('core_user') ) . "\n"; ?>
|
3137 |
+
Account: <?php echo get_permalink( UM()->options()->get('core_account') ) . "\n"; ?>
|
3138 |
+
Members: <?php echo get_permalink( UM()->options()->get('core_members') ) . "\n"; ?>
|
3139 |
+
Register: <?php echo get_permalink( UM()->options()->get('core_register') ) . "\n"; ?>
|
3140 |
+
Login: <?php echo get_permalink( UM()->options()->get('core_login') ) . "\n"; ?>
|
3141 |
+
Logout: <?php echo get_permalink( UM()->options()->get('core_logout') ) . "\n"; ?>
|
3142 |
+
Password Reset: <?php echo get_permalink( UM()->options()->get('core_password-reset') ) . "\n"; ?>
|
3143 |
+
<?php
|
3144 |
+
/**
|
3145 |
+
* UM hook
|
3146 |
+
*
|
3147 |
+
* @type action
|
3148 |
+
* @title um_install_info_after_page_config
|
3149 |
+
* @description After page config install info
|
3150 |
+
* @change_log
|
3151 |
+
* ["Since: 2.0"]
|
3152 |
+
* @usage add_action( 'um_install_info_after_page_config', 'function_name', 10 );
|
3153 |
+
* @example
|
3154 |
+
* <?php
|
3155 |
+
* add_action( 'um_install_info_after_page_config', 'my_install_info_after_page_config', 10 );
|
3156 |
+
* function my_install_info_after_page_config() {
|
3157 |
+
* // your code here
|
3158 |
+
* }
|
3159 |
+
* ?>
|
3160 |
+
*/
|
3161 |
+
do_action( "um_install_info_after_page_config" ); ?>
|
3162 |
+
|
3163 |
+
|
3164 |
+
--- UM Users Configuration ---
|
3165 |
+
|
3166 |
+
Default New User Role: <?php echo UM()->options()->get('register_role') . "\n"; ?>
|
3167 |
+
Profile Permalink Base: <?php echo UM()->options()->get('permalink_base') . "\n"; ?>
|
3168 |
+
User Display Name: <?php echo UM()->options()->get('display_name') . "\n"; ?>
|
3169 |
+
Force Name to Uppercase: <?php echo $this->info_value( UM()->options()->get('force_display_name_capitlized'), 'yesno', true ); ?>
|
3170 |
+
Redirect author to profile: <?php echo $this->info_value( UM()->options()->get('author_redirect'), 'yesno', true ); ?>
|
3171 |
+
Enable Members Directory: <?php echo $this->info_value( UM()->options()->get('members_page'), 'yesno', true ); ?>
|
3172 |
+
Use Gravatars: <?php echo $this->info_value( UM()->options()->get('use_gravatars'), 'yesno', true ); ?>
|
3173 |
+
<?php if( UM()->options()->get('use_gravatars') ): ?>Gravatar builtin image: <?php echo UM()->options()->get('use_um_gravatar_default_builtin_image') . "\n"; ?>
|
3174 |
+
UM Avatar as blank Gravatar: <?php echo $this->info_value( UM()->options()->get('use_um_gravatar_default_image'), 'yesno', true ); ?><?php endif; ?>
|
3175 |
+
Require a strong password: <?php echo $this->info_value( UM()->options()->get('reset_require_strongpass'), 'onoff', true ); ?>
|
3176 |
+
|
3177 |
+
|
3178 |
+
--- UM Access Configuration ---
|
3179 |
+
|
3180 |
+
Panic Key: <?php echo UM()->options()->get('panic_key') . "\n"; ?>
|
3181 |
+
Global Site Access: <?php $arr = array('Site accessible to Everyone','','Site accessible to Logged In Users'); echo $arr[ (int) UM()->options()->get('accessible') ] . "\n"; ?>
|
3182 |
+
<?php if( UM()->options()->get('accessible') == 2 ) { ?>
|
3183 |
+
Custom Redirect URL: <?php echo UM()->options()->get('access_redirect')."\n";?>
|
3184 |
+
Exclude the following URLs:<?php echo "\t\t\t\t".implode("\t\n\t\t\t\t\t\t\t\t\t\t",UM()->options()->get('access_exclude_uris') )."\n";?>
|
3185 |
+
<?php } ?>
|
3186 |
+
Backend Login Screen for Guests: <?php echo $this->info_value( UM()->options()->get('wpadmin_login'), 'yesno', true ); ?>
|
3187 |
+
<?php if( ! UM()->options()->get('wpadmin_login') ) { ?>
|
3188 |
+
Redirect to alternative login page: <?php if( UM()->options()->get('wpadmin_login_redirect') == 'um_login_page' ){ echo um_get_core_page('login')."\n"; }else{ echo UM()->options()->get('wpadmin_login_redirect_url')."\n"; }?>
|
3189 |
+
<?php } ?>
|
3190 |
+
Backend Register Screen for Guests: <?php echo $this->info_value( UM()->options()->get('wpadmin_register'), 'yesno', true ); ?>
|
3191 |
+
<?php if( ! UM()->options()->get('wpadmin_register') ) { ?>
|
3192 |
+
Redirect to alternative register page: <?php if( UM()->options()->get('wpadmin_register_redirect') == 'um_register_page' ){ echo um_get_core_page('register')."\n"; }else{ echo UM()->options()->get('wpadmin_register_redirect_url')."\n"; }?>
|
3193 |
+
<?php } ?>
|
3194 |
+
Access Control widget for Admins only: <?php echo $this->info_value( UM()->options()->get('access_widget_admin_only'), 'yesno', true ); ?>
|
3195 |
+
Enable the Reset Password Limit: <?php echo $this->info_value( UM()->options()->get('enable_reset_password_limit'), 'yesno', true ); ?>
|
3196 |
+
<?php if( UM()->options()->get('enable_reset_password_limit') ) { ?>
|
3197 |
+
Reset Password Limit: <?php echo UM()->options()->get('reset_password_limit_number') ?>
|
3198 |
+
Disable Reset Password Limit for Admins: <?php echo $this->info_value( UM()->options()->get('disable_admin_reset_password_limit'), 'yesno', true ) ?>
|
3199 |
+
<?php } ?>
|
3200 |
+
<?php $wpadmin_allow_ips = UM()->options()->get( 'wpadmin_allow_ips' ); if( ! empty( $wpadmin_allow_ips ) ) { ?>
|
3201 |
+
Whitelisted Backend IPs: <?php echo count( explode("\n",trim(UM()->options()->get('wpadmin_allow_ips') ) ) )."\n"; ?>
|
3202 |
+
<?php } ?>
|
3203 |
+
<?php $blocked_ips = UM()->options()->get('blocked_ips'); if( ! empty( $blocked_ips ) ){ ?>
|
3204 |
+
Blocked IP Addresses: <?php echo count( explode("\n",UM()->options()->get('blocked_ips') ) )."\n"; ?>
|
3205 |
+
<?php } ?>
|
3206 |
+
<?php $blocked_emails = UM()->options()->get('blocked_emails'); if( ! empty( $blocked_emails ) ){ ?>
|
3207 |
+
Blocked Email Addresses: <?php echo count( explode("\n",UM()->options()->get('blocked_emails') ) )."\n"; ?>
|
3208 |
+
<?php } ?>
|
3209 |
+
<?php $blocked_words = UM()->options()->get('blocked_words'); if( ! empty( $blocked_words ) ){ ?>
|
3210 |
+
Blacklist Words: <?php echo count( explode("\n",UM()->options()->get('blocked_words') ) )."\n"; ?>
|
3211 |
+
<?php } ?>
|
3212 |
+
|
3213 |
+
|
3214 |
+
--- UM Email Configurations ---
|
3215 |
+
|
3216 |
+
Mail appears from: <?php $mail_from = UM()->options()->get('mail_from'); if( ! empty( $mail_from ) ){echo UM()->options()->get('mail_from');}else{echo "-";}; echo "\n";?>
|
3217 |
+
Mail appears from address: <?php $mail_from_addr = UM()->options()->get('mail_from_addr'); if( ! empty( $mail_from_addr ) ){echo UM()->options()->get('mail_from_addr');}else{echo "-";}; echo "\n";?>
|
3218 |
+
Use HTML for E-mails: <?php echo $this->info_value( UM()->options()->get('email_html'), 'yesno', true ); ?>
|
3219 |
+
Account Welcome Email: <?php echo $this->info_value( UM()->options()->get('welcome_email_on'), 'yesno', true ); ?>
|
3220 |
+
Account Activation Email: <?php echo $this->info_value( UM()->options()->get('checkmail_email_on'), 'yesno', true ); ?>
|
3221 |
+
Pending Review Email: <?php echo $this->info_value( UM()->options()->get('pending_email_on'), 'yesno', true ); ?>
|
3222 |
+
Account Approved Email: <?php echo $this->info_value( UM()->options()->get('approved_email_on'), 'yesno', true ); ?>
|
3223 |
+
Account Rejected Email: <?php echo $this->info_value( UM()->options()->get('rejected_email_on'), 'yesno', true ); ?>
|
3224 |
+
Account Deactivated Email: <?php echo $this->info_value( UM()->options()->get('inactive_email_on'), 'yesno', true ); ?>
|
3225 |
+
Account Deleted Email: <?php echo $this->info_value( UM()->options()->get('deletion_email_on'), 'yesno', true ); ?>
|
3226 |
+
Password Reset Email: <?php echo $this->info_value( UM()->options()->get('resetpw_email_on'), 'yesno', true ); ?>
|
3227 |
+
Password Changed Email: <?php echo $this->info_value( UM()->options()->get('changedpw_email_on'), 'yesno', true ); ?>
|
3228 |
+
|
3229 |
+
|
3230 |
+
--- UM Total Users ---
|
3231 |
+
|
3232 |
+
<?php $result = count_users();
|
3233 |
+
echo 'All Users('.$result['total_users'].")\n";
|
3234 |
+
foreach( $result['avail_roles'] as $role => $count ) {
|
3235 |
+
echo $role."(".$count.")\n";
|
3236 |
+
} ?>
|
3237 |
+
|
3238 |
+
|
3239 |
+
--- UM Roles ---
|
3240 |
+
|
3241 |
+
<?php foreach( UM()->roles()->get_roles() as $role_id => $role ) {
|
3242 |
+
echo $role." ({$role_id})\n";
|
3243 |
+
} ?>
|
3244 |
+
|
3245 |
+
|
3246 |
+
--- UM Custom Templates ---
|
3247 |
+
|
3248 |
+
<?php // Show templates that have been copied to the theme's edd_templates dir
|
3249 |
+
$dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php';
|
3250 |
+
if ( ! empty( $dir ) ) {
|
3251 |
+
$found = glob( $dir );
|
3252 |
+
if ( ! empty( $found ) ) {
|
3253 |
+
foreach ( glob( $dir ) as $file ) {
|
3254 |
+
echo "File: " . $file . "\n";
|
3255 |
+
}
|
3256 |
+
} else {
|
3257 |
+
echo 'N/A'."\n";
|
3258 |
+
}
|
3259 |
+
} ?>
|
3260 |
+
|
3261 |
+
|
3262 |
+
--- UM Email HTML Templates ---
|
3263 |
+
|
3264 |
+
<?php $dir = get_stylesheet_directory() . '/ultimate-member/templates/emails/*.html';
|
3265 |
+
|
3266 |
+
if ( ! empty( $dir ) ) {
|
3267 |
+
$found = glob( $dir );
|
3268 |
+
if ( ! empty( $found ) ){
|
3269 |
+
foreach ( glob( $dir ) as $file ) {
|
3270 |
+
echo "File: ". $file . "\n";
|
3271 |
+
}
|
3272 |
+
} else {
|
3273 |
+
echo 'N/A'."\n";
|
3274 |
+
}
|
3275 |
+
} ?>
|
3276 |
+
|
3277 |
+
|
3278 |
+
--- Web Server Configurations ---
|
3279 |
+
|
3280 |
+
PHP Version: <?php echo PHP_VERSION . "\n"; ?>
|
3281 |
+
MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?>
|
3282 |
+
Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
|
3283 |
+
|
3284 |
+
|
3285 |
+
--- PHP Configurations ---
|
3286 |
+
|
3287 |
+
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
|
3288 |
+
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
|
3289 |
+
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
|
3290 |
+
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
|
3291 |
+
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
|
3292 |
+
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
|
3293 |
+
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
|
3294 |
+
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes\n" : "No\n"; ?>
|
3295 |
+
|
3296 |
+
|
3297 |
+
--- Web Server Extensions/Modules ---
|
3298 |
+
|
3299 |
+
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
|
3300 |
+
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?>
|
3301 |
+
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?>
|
3302 |
+
SOAP Client: <?php echo ( class_exists( 'SoapClient' ) ) ? 'Your server has the SOAP Client enabled.' : 'Your server does not have the SOAP Client enabled.'; ?><?php echo "\n"; ?>
|
3303 |
+
SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?>
|
3304 |
+
GD Library: <?php echo ( extension_loaded( 'gd' ) && function_exists('gd_info') ) ? 'PHP GD library is installed on your web server.' : 'PHP GD library is NOT installed on your web server.'; ?><?php echo "\n"; ?>
|
3305 |
+
Mail: <?php echo ( function_exists('mail') ) ? 'PHP mail function exist on your web server.' : 'PHP mail function doesn\'t exist on your web server.'; ?><?php echo "\n"; ?>
|
3306 |
+
Exif: <?php echo ( extension_loaded( 'exif' ) && function_exists('exif_imagetype') ) ? 'PHP Exif library is installed on your web server.' : 'PHP Exif library is NOT installed on your web server.'; ?><?php echo "\n"; ?>
|
3307 |
+
|
3308 |
+
|
3309 |
+
--- Session Configurations ---
|
3310 |
+
|
3311 |
+
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
|
3312 |
+
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
|
3313 |
+
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
|
3314 |
+
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
|
3315 |
+
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
3316 |
+
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
3317 |
+
|
3318 |
+
|
3319 |
+
--- WordPress Active Plugins ---
|
3320 |
+
|
3321 |
+
<?php $plugins = get_plugins();
|
3322 |
+
$active_plugins = get_option( 'active_plugins', array() );
|
3323 |
+
|
3324 |
+
foreach ( $plugins as $plugin_path => $plugin ) {
|
3325 |
+
// If the plugin isn't active, don't show it.
|
3326 |
+
if ( ! in_array( $plugin_path, $active_plugins ) )
|
3327 |
+
continue;
|
3328 |
+
|
3329 |
+
echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n";
|
3330 |
+
}
|
3331 |
+
|
3332 |
+
if ( is_multisite() ) { ?>
|
3333 |
+
|
3334 |
+
--- WordPress Network Active Plugins ---
|
3335 |
+
|
3336 |
+
<?php $plugins = wp_get_active_network_plugins();
|
3337 |
+
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
3338 |
+
|
3339 |
+
foreach ( $plugins as $plugin_path ) {
|
3340 |
+
$plugin_base = plugin_basename( $plugin_path );
|
3341 |
+
|
3342 |
+
// If the plugin isn't active, don't show it.
|
3343 |
+
if ( ! array_key_exists( $plugin_base, $active_plugins ) )
|
3344 |
+
continue;
|
3345 |
+
|
3346 |
+
$plugin = get_plugin_data( $plugin_path );
|
3347 |
+
|
3348 |
+
echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n";
|
3349 |
+
}
|
3350 |
+
|
3351 |
+
}
|
3352 |
+
|
3353 |
+
/**
|
3354 |
+
* UM hook
|
3355 |
+
*
|
3356 |
+
* @type action
|
3357 |
+
* @title um_install_info_after
|
3358 |
+
* @description After install info
|
3359 |
+
* @change_log
|
3360 |
+
* ["Since: 2.0"]
|
3361 |
+
* @usage add_action( 'um_install_info_after', 'function_name', 10 );
|
3362 |
+
* @example
|
3363 |
+
* <?php
|
3364 |
+
* add_action( 'um_install_info_after', 'my_install_info_after', 10 );
|
3365 |
+
* function my_install_info_after() {
|
3366 |
+
* // your code here
|
3367 |
+
* }
|
3368 |
+
* ?>
|
3369 |
+
*/
|
3370 |
+
do_action( 'um_install_info_after' ); ?>
|
3371 |
+
|
3372 |
+
### End Install Info ###
|
3373 |
+
</textarea>
|
3374 |
+
<p class="submit">
|
3375 |
+
<input type="hidden" name="um-addon-hook" value="download_install_info" />
|
3376 |
+
<?php submit_button( 'Download Install Info File', 'primary', 'download_install_info', false ); ?>
|
3377 |
+
</p>
|
3378 |
+
</form>
|
3379 |
+
|
3380 |
+
<?php }
|
3381 |
+
}
|
3382 |
+
|
3383 |
+
|
3384 |
+
/**
|
3385 |
+
*
|
3386 |
+
*/
|
3387 |
+
function um_download_install_info() {
|
3388 |
+
if ( ! empty( $_POST['download_install_info'] ) ) {
|
3389 |
+
nocache_headers();
|
3390 |
+
|
3391 |
+
header( "Content-type: text/plain" );
|
3392 |
+
header( 'Content-Disposition: attachment; filename="ultimatemember-install-info.txt"' );
|
3393 |
+
|
3394 |
+
echo wp_strip_all_tags( sanitize_textarea_field( $_POST['um-install-info'] ) );
|
3395 |
+
exit;
|
3396 |
+
}
|
3397 |
+
}
|
3398 |
+
|
3399 |
+
|
3400 |
+
/**
|
3401 |
+
* @param string $raw_value
|
3402 |
+
* @param string $type
|
3403 |
+
* @param string $default
|
3404 |
+
*
|
3405 |
+
* @return string
|
3406 |
+
*/
|
3407 |
+
function info_value( $raw_value = '', $type = 'yesno', $default = '' ) {
|
3408 |
+
|
3409 |
+
if ( $type == 'yesno' ) {
|
3410 |
+
$raw_value = ( $default == $raw_value ) ? "Yes" : "No";
|
3411 |
+
} elseif( $type == 'onoff' ) {
|
3412 |
+
$raw_value = ( $default == $raw_value ) ? "On" : "Off";
|
3413 |
+
}
|
3414 |
+
|
3415 |
+
return $raw_value."\n";
|
3416 |
+
}
|
3417 |
+
|
3418 |
+
|
3419 |
+
/**
|
3420 |
+
* Render settings section
|
3421 |
+
*
|
3422 |
+
* @param array $section_fields
|
3423 |
+
* @param string $current_tab
|
3424 |
+
* @param string $current_subtab
|
3425 |
+
*
|
3426 |
+
* @return string
|
3427 |
+
*/
|
3428 |
+
function render_settings_section( $section_fields, $current_tab, $current_subtab ) {
|
3429 |
+
ob_start();
|
3430 |
+
|
3431 |
+
UM()->admin_forms_settings( array(
|
3432 |
+
'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column',
|
3433 |
+
'prefix_id' => 'um_options',
|
3434 |
+
'fields' => $section_fields
|
3435 |
+
) )->render_form(); ?>
|
3436 |
+
|
3437 |
+
<?php $section = ob_get_clean();
|
3438 |
+
|
3439 |
+
return $section;
|
3440 |
+
}
|
3441 |
+
|
3442 |
+
|
3443 |
+
/**
|
3444 |
+
* @param array $settings
|
3445 |
+
*
|
3446 |
+
* @return array
|
3447 |
+
*/
|
3448 |
+
function save_email_templates( $settings ) {
|
3449 |
+
|
3450 |
+
if ( empty( $settings['um_email_template'] ) ) {
|
3451 |
+
return $settings;
|
3452 |
+
}
|
3453 |
+
|
3454 |
+
$template = $settings['um_email_template'];
|
3455 |
+
$content = wp_kses_post( stripslashes( $settings[ $template ] ) );
|
3456 |
+
|
3457 |
+
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
|
3458 |
+
|
3459 |
+
if ( ! file_exists( $theme_template_path ) ) {
|
3460 |
+
UM()->mail()->copy_email_template( $template );
|
3461 |
+
}
|
3462 |
+
|
3463 |
+
$fp = fopen( $theme_template_path, "w" );
|
3464 |
+
$result = fputs( $fp, $content );
|
3465 |
+
fclose( $fp );
|
3466 |
+
|
3467 |
+
if ( $result !== false ) {
|
3468 |
+
unset( $settings['um_email_template'] );
|
3469 |
+
unset( $settings[ $template ] );
|
3470 |
+
}
|
3471 |
+
|
3472 |
+
return $settings;
|
3473 |
+
}
|
3474 |
+
}
|
3475 |
+
}
|
includes/admin/core/list-tables/roles-list-table.php
CHANGED
@@ -16,13 +16,15 @@ if ( isset( $_GET['action'] ) ) {
|
|
16 |
switch ( sanitize_key( $_GET['action'] ) ) {
|
17 |
/* delete action */
|
18 |
case 'delete': {
|
|
|
|
|
19 |
$role_keys = array();
|
20 |
if ( isset( $_REQUEST['id'] ) ) {
|
21 |
-
check_admin_referer( 'um_role_delete' .
|
22 |
-
$role_keys = (array)
|
23 |
} elseif ( isset( $_REQUEST['item'] ) ) {
|
24 |
check_admin_referer( 'bulk-' . sanitize_key( __( 'Roles', 'ultimate-member' ) ) );
|
25 |
-
$role_keys = array_map( '
|
26 |
}
|
27 |
|
28 |
if ( ! count( $role_keys ) ) {
|
@@ -88,13 +90,15 @@ if ( isset( $_GET['action'] ) ) {
|
|
88 |
break;
|
89 |
}
|
90 |
case 'reset': {
|
|
|
|
|
91 |
$role_keys = array();
|
92 |
if ( isset( $_REQUEST['id'] ) ) {
|
93 |
-
check_admin_referer( 'um_role_reset' .
|
94 |
-
$role_keys = (array)
|
95 |
} elseif ( isset( $_REQUEST['item'] ) ) {
|
96 |
check_admin_referer( 'bulk-' . sanitize_key( __( 'Roles', 'ultimate-member' ) ) );
|
97 |
-
$role_keys = array_map( '
|
98 |
}
|
99 |
|
100 |
if ( ! count( $role_keys ) ) {
|
@@ -342,22 +346,23 @@ class UM_Roles_List_Table extends WP_List_Table {
|
|
342 |
*/
|
343 |
function column_title( $item ) {
|
344 |
$actions = array();
|
|
|
|
|
|
|
345 |
|
346 |
-
$actions['edit'] = '<a href="admin.php?page=um_roles&tab=edit&id=' . esc_attr( $
|
347 |
|
348 |
if ( ! empty( $item['_um_is_custom'] ) ) {
|
349 |
-
$actions['delete'] = '<a href="admin.php?page=um_roles&action=delete&id=' . esc_attr( $
|
350 |
} else {
|
351 |
$role_meta = get_option( "um_role_{$item['key']}_meta" );
|
352 |
|
353 |
if ( ! empty( $role_meta ) ) {
|
354 |
-
$actions['reset'] = '<a href="admin.php?page=um_roles&action=reset&id=' . esc_attr( $
|
355 |
}
|
356 |
}
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
return sprintf('%1$s %2$s', '<strong><a class="row-title" href="admin.php?page=um_roles&tab=edit&id=' . esc_attr( $item['key'] ) . '">' . stripslashes( $item['name'] ) . '</a></strong>', $this->row_actions( $actions ) );
|
361 |
}
|
362 |
|
363 |
|
16 |
switch ( sanitize_key( $_GET['action'] ) ) {
|
17 |
/* delete action */
|
18 |
case 'delete': {
|
19 |
+
// uses sanitize_title instead of sanitize_key for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
|
20 |
+
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
|
21 |
$role_keys = array();
|
22 |
if ( isset( $_REQUEST['id'] ) ) {
|
23 |
+
check_admin_referer( 'um_role_delete' . sanitize_title( $_REQUEST['id'] ) . get_current_user_id() );
|
24 |
+
$role_keys = (array) sanitize_title( $_REQUEST['id'] );
|
25 |
} elseif ( isset( $_REQUEST['item'] ) ) {
|
26 |
check_admin_referer( 'bulk-' . sanitize_key( __( 'Roles', 'ultimate-member' ) ) );
|
27 |
+
$role_keys = array_map( 'sanitize_title', $_REQUEST['item'] );
|
28 |
}
|
29 |
|
30 |
if ( ! count( $role_keys ) ) {
|
90 |
break;
|
91 |
}
|
92 |
case 'reset': {
|
93 |
+
// uses sanitize_title instead of sanitize_key for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
|
94 |
+
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
|
95 |
$role_keys = array();
|
96 |
if ( isset( $_REQUEST['id'] ) ) {
|
97 |
+
check_admin_referer( 'um_role_reset' . sanitize_title( $_REQUEST['id'] ) . get_current_user_id() );
|
98 |
+
$role_keys = (array) sanitize_title( $_REQUEST['id'] );
|
99 |
} elseif ( isset( $_REQUEST['item'] ) ) {
|
100 |
check_admin_referer( 'bulk-' . sanitize_key( __( 'Roles', 'ultimate-member' ) ) );
|
101 |
+
$role_keys = array_map( 'sanitize_title', $_REQUEST['item'] );
|
102 |
}
|
103 |
|
104 |
if ( ! count( $role_keys ) ) {
|
346 |
*/
|
347 |
function column_title( $item ) {
|
348 |
$actions = array();
|
349 |
+
// for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
|
350 |
+
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
|
351 |
+
$id = urlencode( $item['key'] );
|
352 |
|
353 |
+
$actions['edit'] = '<a href="admin.php?page=um_roles&tab=edit&id=' . esc_attr( $id ) . '">' . __( 'Edit', 'ultimate-member' ) . '</a>';
|
354 |
|
355 |
if ( ! empty( $item['_um_is_custom'] ) ) {
|
356 |
+
$actions['delete'] = '<a href="admin.php?page=um_roles&action=delete&id=' . esc_attr( $id ) . '&_wpnonce=' . wp_create_nonce( 'um_role_delete' . $item['key'] . get_current_user_id() ) . '" onclick="return confirm( \'' . __( 'Are you sure you want to delete this role?', 'ultimate-member' ) . '\' );">' . __( 'Delete', 'ultimate-member' ) . '</a>';
|
357 |
} else {
|
358 |
$role_meta = get_option( "um_role_{$item['key']}_meta" );
|
359 |
|
360 |
if ( ! empty( $role_meta ) ) {
|
361 |
+
$actions['reset'] = '<a href="admin.php?page=um_roles&action=reset&id=' . esc_attr( $id ) . '&_wpnonce=' . wp_create_nonce( 'um_role_reset' . $item['key'] . get_current_user_id() ) . '" onclick="return confirm( \'' . __( 'Are you sure you want to reset UM role meta?', 'ultimate-member' ) . '\' );">' . __( 'Reset UM Role meta', 'ultimate-member' ) . '</a>';
|
362 |
}
|
363 |
}
|
364 |
|
365 |
+
return sprintf('%1$s %2$s', '<strong><a class="row-title" href="admin.php?page=um_roles&tab=edit&id=' . esc_attr( $id ) . '">' . stripslashes( $item['name'] ) . '</a></strong>', $this->row_actions( $actions ) );
|
|
|
|
|
366 |
}
|
367 |
|
368 |
|
includes/admin/templates/access/restrict_content.php
CHANGED
@@ -96,7 +96,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
96 |
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
97 |
'1' => __( 'Redirect user', 'ultimate-member' ),
|
98 |
),
|
99 |
-
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? '' : array( '_um_access_hide_from_queries', '=', '0' ),
|
100 |
),
|
101 |
array(
|
102 |
'id' => '_um_restrict_by_custom_message',
|
96 |
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
97 |
'1' => __( 'Redirect user', 'ultimate-member' ),
|
98 |
),
|
99 |
+
'conditional' => UM()->options()->get( 'disable_restriction_pre_queries' ) ? array( '_um_accessible', '!=', '0' ) : array( '_um_access_hide_from_queries', '=', '0' ),
|
100 |
),
|
101 |
array(
|
102 |
'id' => '_um_restrict_by_custom_message',
|
includes/admin/templates/role/role-edit.php
CHANGED
@@ -50,7 +50,9 @@ global $wp_roles;
|
|
50 |
|
51 |
if ( ! empty( $_GET['id'] ) ) {
|
52 |
|
53 |
-
|
|
|
|
|
54 |
|
55 |
$data = get_option( "um_role_{$role_id}_meta" );
|
56 |
|
@@ -88,7 +90,9 @@ if ( ! empty( $_POST['role'] ) ) {
|
|
88 |
$error .= __( 'Title is empty!', 'ultimate-member' ) . '<br />';
|
89 |
}
|
90 |
|
91 |
-
if ( preg_match( "
|
|
|
|
|
92 |
$id = sanitize_title( $data['name'] );
|
93 |
} else {
|
94 |
$auto_increment = UM()->options()->get( 'custom_roles_increment' );
|
@@ -96,9 +100,11 @@ if ( ! empty( $_POST['role'] ) ) {
|
|
96 |
$id = 'custom_role_' . $auto_increment;
|
97 |
}
|
98 |
|
99 |
-
$redirect = add_query_arg( array( 'page'=>'um_roles', 'tab'=>'edit', 'id'
|
100 |
} elseif ( 'edit' === sanitize_key( $_GET['tab'] ) && ! empty( $_GET['id'] ) ) {
|
101 |
-
|
|
|
|
|
102 |
|
103 |
$pre_role_meta = get_option( "um_role_{$id}_meta", array() );
|
104 |
if ( isset( $pre_role_meta['name'] ) ) {
|
50 |
|
51 |
if ( ! empty( $_GET['id'] ) ) {
|
52 |
|
53 |
+
// uses sanitize_title instead of sanitize_key for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
|
54 |
+
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
|
55 |
+
$role_id = sanitize_title( $_GET['id'] );
|
56 |
|
57 |
$data = get_option( "um_role_{$role_id}_meta" );
|
58 |
|
90 |
$error .= __( 'Title is empty!', 'ultimate-member' ) . '<br />';
|
91 |
}
|
92 |
|
93 |
+
if ( preg_match( "/^[\p{Latin}\d\-_ ]+$/i", $data['name'] ) ) {
|
94 |
+
// uses sanitize_title instead of sanitize_key for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
|
95 |
+
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
|
96 |
$id = sanitize_title( $data['name'] );
|
97 |
} else {
|
98 |
$auto_increment = UM()->options()->get( 'custom_roles_increment' );
|
100 |
$id = 'custom_role_' . $auto_increment;
|
101 |
}
|
102 |
|
103 |
+
$redirect = add_query_arg( array( 'page' => 'um_roles', 'tab' => 'edit', 'id' => $id, 'msg' => 'a' ), admin_url( 'admin.php' ) );
|
104 |
} elseif ( 'edit' === sanitize_key( $_GET['tab'] ) && ! empty( $_GET['id'] ) ) {
|
105 |
+
// uses sanitize_title instead of sanitize_key for backward compatibility based on #906 pull-request (https://github.com/ultimatemember/ultimatemember/pull/906)
|
106 |
+
// roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID
|
107 |
+
$id = sanitize_title( $_GET['id'] );
|
108 |
|
109 |
$pre_role_meta = get_option( "um_role_{$id}_meta", array() );
|
110 |
if ( isset( $pre_role_meta['name'] ) ) {
|
includes/class-config.php
CHANGED
@@ -1,807 +1,809 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\Config' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Config
|
13 |
-
*
|
14 |
-
* Class with global variables for UM
|
15 |
-
*
|
16 |
-
* @package um
|
17 |
-
*/
|
18 |
-
class Config {
|
19 |
-
|
20 |
-
|
21 |
-
/**
|
22 |
-
* @var array
|
23 |
-
*/
|
24 |
-
var $core_forms;
|
25 |
-
|
26 |
-
|
27 |
-
/**
|
28 |
-
* @var array
|
29 |
-
*/
|
30 |
-
var $core_directories;
|
31 |
-
|
32 |
-
|
33 |
-
/**
|
34 |
-
* @var mixed|void
|
35 |
-
*/
|
36 |
-
var $core_pages;
|
37 |
-
|
38 |
-
|
39 |
-
/**
|
40 |
-
* @var array
|
41 |
-
*/
|
42 |
-
var $core_directory_meta = array();
|
43 |
-
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @var array
|
47 |
-
*/
|
48 |
-
var $core_global_meta_all;
|
49 |
-
|
50 |
-
|
51 |
-
/**
|
52 |
-
* @var mixed|void
|
53 |
-
*/
|
54 |
-
var $core_form_meta_all;
|
55 |
-
|
56 |
-
|
57 |
-
/**
|
58 |
-
* @var array
|
59 |
-
*/
|
60 |
-
var $core_form_meta = array();
|
61 |
-
|
62 |
-
|
63 |
-
/**
|
64 |
-
* @var
|
65 |
-
*/
|
66 |
-
var $perms;
|
67 |
-
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @var
|
71 |
-
*/
|
72 |
-
var $nonadmin_perms;
|
73 |
-
|
74 |
-
|
75 |
-
/**
|
76 |
-
* @var mixed|void
|
77 |
-
*/
|
78 |
-
var $email_notifications;
|
79 |
-
|
80 |
-
|
81 |
-
/**
|
82 |
-
* @var mixed|void
|
83 |
-
*/
|
84 |
-
var $settings_defaults;
|
85 |
-
|
86 |
-
|
87 |
-
/**
|
88 |
-
* @var array
|
89 |
-
*/
|
90 |
-
var $permalinks;
|
91 |
-
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Config constructor.
|
95 |
-
*/
|
96 |
-
function __construct() {
|
97 |
-
$this->core_forms = array(
|
98 |
-
'register',
|
99 |
-
'login',
|
100 |
-
'profile',
|
101 |
-
);
|
102 |
-
|
103 |
-
$this->core_directories = array(
|
104 |
-
'members',
|
105 |
-
);
|
106 |
-
|
107 |
-
|
108 |
-
/**
|
109 |
-
* UM hook
|
110 |
-
*
|
111 |
-
* @type filter
|
112 |
-
* @title um_core_pages
|
113 |
-
* @description Extend UM core pages
|
114 |
-
* @input_vars
|
115 |
-
* [{"var":"$pages","type":"array","desc":"UM core pages"}]
|
116 |
-
* @change_log
|
117 |
-
* ["Since: 2.0"]
|
118 |
-
* @usage
|
119 |
-
* <?php add_filter( 'um_core_pages', 'function_name', 10, 1 ); ?>
|
120 |
-
* @example
|
121 |
-
* <?php
|
122 |
-
* add_filter( 'um_core_pages', 'my_core_pages', 10, 1 );
|
123 |
-
* function my_core_pages( $pages ) {
|
124 |
-
* // your code here
|
125 |
-
* $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ) );
|
126 |
-
* return $pages;
|
127 |
-
* }
|
128 |
-
* ?>
|
129 |
-
*/
|
130 |
-
$this->core_pages = apply_filters( 'um_core_pages', array(
|
131 |
-
'user' => array( 'title' => __( 'User', 'ultimate-member' ) ),
|
132 |
-
'login' => array( 'title' => __( 'Login', 'ultimate-member' ) ),
|
133 |
-
'register' => array( 'title' => __( 'Register', 'ultimate-member' ) ),
|
134 |
-
'members' => array( 'title' => __( 'Members', 'ultimate-member' ) ),
|
135 |
-
'logout' => array( 'title' => __( 'Logout', 'ultimate-member' ) ),
|
136 |
-
'account' => array( 'title' => __( 'Account', 'ultimate-member' ) ),
|
137 |
-
'password-reset' => array( 'title' => __( 'Password Reset', 'ultimate-member' ) ),
|
138 |
-
) );
|
139 |
-
|
140 |
-
$this->core_directory_meta['members'] = array(
|
141 |
-
'_um_core' => 'members',
|
142 |
-
'_um_template' => 'members',
|
143 |
-
'_um_mode' => 'directory',
|
144 |
-
'_um_view_types' => array( 'grid' ),
|
145 |
-
'_um_default_view' => 'grid',
|
146 |
-
'_um_roles' => array(),
|
147 |
-
'_um_has_profile_photo' => 0,
|
148 |
-
'_um_has_cover_photo' => 0,
|
149 |
-
'_um_show_these_users' => '',
|
150 |
-
'_um_exclude_these_users' => '',
|
151 |
-
|
152 |
-
'_um_sortby' => 'user_registered_desc',
|
153 |
-
'_um_sortby_custom' => '',
|
154 |
-
'_um_sortby_custom_label' => '',
|
155 |
-
'_um_enable_sorting' => 0,
|
156 |
-
'_um_sorting_fields' => array(),
|
157 |
-
|
158 |
-
'_um_profile_photo' => '1',
|
159 |
-
'_um_cover_photos' => '1',
|
160 |
-
'_um_show_name' => '1',
|
161 |
-
'_um_show_tagline' => 0,
|
162 |
-
'_um_tagline_fields' => array(),
|
163 |
-
'_um_show_userinfo' => 0,
|
164 |
-
'_um_reveal_fields' => array(),
|
165 |
-
'_um_show_social' => 0,
|
166 |
-
'_um_userinfo_animate' => '1',
|
167 |
-
|
168 |
-
'_um_search' => 0,
|
169 |
-
'_um_roles_can_search' => array(),
|
170 |
-
'_um_filters' => 0,
|
171 |
-
'_um_roles_can_filter' => array(),
|
172 |
-
'_um_search_fields' => array(),
|
173 |
-
'_um_filters_expanded' => 0,
|
174 |
-
'_um_filters_is_collapsible' => 1,
|
175 |
-
'_um_search_filters' => array(),
|
176 |
-
|
177 |
-
'_um_must_search' => 0,
|
178 |
-
'_um_max_users' => '',
|
179 |
-
'_um_profiles_per_page' => 12,
|
180 |
-
'_um_profiles_per_page_mobile' => 6,
|
181 |
-
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
|
182 |
-
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
|
183 |
-
'_um_directory_no_users' => __( 'We are sorry. We cannot find any users who match your search criteria.', 'ultimate-member' ),
|
184 |
-
);
|
185 |
-
|
186 |
-
$this->core_global_meta_all = array(
|
187 |
-
'_um_primary_btn_color',
|
188 |
-
'_um_primary_btn_hover',
|
189 |
-
'_um_primary_btn_text',
|
190 |
-
'_um_secondary_btn_color',
|
191 |
-
'_um_secondary_btn_hover',
|
192 |
-
'_um_secondary_btn_text',
|
193 |
-
'_um_form_border',
|
194 |
-
'_um_form_border_hover',
|
195 |
-
'_um_form_bg_color',
|
196 |
-
'_um_form_bg_color_focus',
|
197 |
-
'_um_form_placeholder',
|
198 |
-
'_um_form_icon_color',
|
199 |
-
'_um_form_asterisk_color',
|
200 |
-
'_um_form_field_label',
|
201 |
-
'_um_form_text_color',
|
202 |
-
'_um_active_color',
|
203 |
-
'_um_help_tip_color',
|
204 |
-
'_um_secondary_color',
|
205 |
-
);
|
206 |
-
|
207 |
-
|
208 |
-
/**
|
209 |
-
* UM hook
|
210 |
-
*
|
211 |
-
* @type filter
|
212 |
-
* @title um_core_form_meta_all
|
213 |
-
* @description Extend UM forms meta keys
|
214 |
-
* @input_vars
|
215 |
-
* [{"var":"$meta","type":"array","desc":"UM forms meta"}]
|
216 |
-
* @change_log
|
217 |
-
* ["Since: 2.0"]
|
218 |
-
* @usage
|
219 |
-
* <?php add_filter( 'um_core_form_meta_all', 'function_name', 10, 1 ); ?>
|
220 |
-
* @example
|
221 |
-
* <?php
|
222 |
-
* add_filter( 'um_core_form_meta_all', 'my_core_form_meta', 10, 1 );
|
223 |
-
* function my_core_form_meta( $meta ) {
|
224 |
-
* // your code here
|
225 |
-
* $meta['my_meta_key'] = 'my_meta_value';
|
226 |
-
* return $meta;
|
227 |
-
* }
|
228 |
-
* ?>
|
229 |
-
*/
|
230 |
-
$this->core_form_meta_all = apply_filters( 'um_core_form_meta_all', array(
|
231 |
-
/*Profile Form*/
|
232 |
-
'_um_profile_show_name' => 1,
|
233 |
-
'_um_profile_show_social_links' => 0,
|
234 |
-
'_um_profile_show_bio' => 1,
|
235 |
-
'_um_profile_bio_maxchars' => 180,
|
236 |
-
'_um_profile_header_menu' => 'bc',
|
237 |
-
'_um_profile_empty_text' => 1,
|
238 |
-
'_um_profile_empty_text_emo' => 1,
|
239 |
-
'_um_profile_role' => array(),
|
240 |
-
'_um_profile_template' => 'profile',
|
241 |
-
'_um_profile_max_width' => '1000px',
|
242 |
-
'_um_profile_area_max_width' => '600px',
|
243 |
-
'_um_profile_align' => 'center',
|
244 |
-
'_um_profile_icons' => 'label',
|
245 |
-
'_um_profile_disable_photo_upload' => 0,
|
246 |
-
'_um_profile_photosize' => '190',
|
247 |
-
'_um_profile_cover_enabled' => 1,
|
248 |
-
'_um_profile_coversize' => 'original',
|
249 |
-
'_um_profile_cover_ratio' => '2.7:1',
|
250 |
-
'_um_profile_photocorner' => '1',
|
251 |
-
'_um_profile_header_bg' => '',
|
252 |
-
'_um_profile_primary_btn_word' => __( 'Update Profile', 'ultimate-member' ),
|
253 |
-
'_um_profile_secondary_btn' => '1',
|
254 |
-
'_um_profile_secondary_btn_word' => __( 'Cancel', 'ultimate-member' ),
|
255 |
-
|
256 |
-
/*Registration Form*/
|
257 |
-
'_um_register_role' => '0',
|
258 |
-
'_um_register_template' => 'register',
|
259 |
-
'_um_register_max_width' => '450px',
|
260 |
-
'_um_register_align' => 'center',
|
261 |
-
'_um_register_icons' => 'label',
|
262 |
-
'_um_register_primary_btn_word' => __( 'Register', 'ultimate-member' ),
|
263 |
-
'_um_register_secondary_btn' => 1,
|
264 |
-
'_um_register_secondary_btn_word' => __( 'Login', 'ultimate-member' ),
|
265 |
-
'_um_register_secondary_btn_url' => '',
|
266 |
-
|
267 |
-
/*Login Form*/
|
268 |
-
'_um_login_template' => 'login',
|
269 |
-
'_um_login_max_width' => '450px',
|
270 |
-
'_um_login_align' => 'center',
|
271 |
-
'_um_login_icons' => 'label',
|
272 |
-
'_um_login_primary_btn_word' => __( 'Login', 'ultimate-member' ),
|
273 |
-
'_um_login_forgot_pass_link' => 1,
|
274 |
-
'_um_login_show_rememberme' => 1,
|
275 |
-
'_um_login_secondary_btn' => 1,
|
276 |
-
'_um_login_secondary_btn_word' => __( 'Register', 'ultimate-member' ),
|
277 |
-
'_um_login_secondary_btn_url' => '',
|
278 |
-
|
279 |
-
/*Member Directory*/
|
280 |
-
'_um_directory_template' => 'members',
|
281 |
-
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
|
282 |
-
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
|
283 |
-
) );
|
284 |
-
|
285 |
-
$this->core_form_meta['register'] = array(
|
286 |
-
'_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"E-mail Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
287 |
-
'_um_mode' => 'register',
|
288 |
-
'_um_core' => 'register',
|
289 |
-
'_um_register_use_custom_settings' => 0,
|
290 |
-
);
|
291 |
-
|
292 |
-
$this->core_form_meta['login'] = array(
|
293 |
-
'_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or E-mail";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
294 |
-
'_um_mode' => 'login',
|
295 |
-
'_um_core' => 'login',
|
296 |
-
'_um_login_use_custom_settings' => 0,
|
297 |
-
);
|
298 |
-
|
299 |
-
$this->core_form_meta['profile'] = array(
|
300 |
-
'_um_custom_fields' => 'a:1:{s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
301 |
-
'_um_mode' => 'profile',
|
302 |
-
'_um_core' => 'profile',
|
303 |
-
'_um_profile_use_custom_settings' => 0,
|
304 |
-
);
|
305 |
-
|
306 |
-
|
307 |
-
/**
|
308 |
-
* UM hook
|
309 |
-
*
|
310 |
-
* @type filter
|
311 |
-
* @title um_email_notifications
|
312 |
-
* @description Extend UM email notifications
|
313 |
-
* @input_vars
|
314 |
-
* [{"var":"$emails","type":"array","desc":"UM email notifications"}]
|
315 |
-
* @change_log
|
316 |
-
* ["Since: 2.0"]
|
317 |
-
* @usage
|
318 |
-
* <?php add_filter( 'um_email_notifications', 'function_name', 10, 1 ); ?>
|
319 |
-
* @example
|
320 |
-
* <?php
|
321 |
-
* add_filter( 'um_email_notifications', 'my_email_notifications', 10, 1 );
|
322 |
-
* function my_email_notifications( $emails ) {
|
323 |
-
* // your code here
|
324 |
-
* $emails['my_email'] = array(
|
325 |
-
* 'key' => 'my_email',
|
326 |
-
* 'title' => __( 'my_email_title','ultimate-member' ),
|
327 |
-
* 'subject' => 'my_email_subject',
|
328 |
-
* 'body' => 'my_email_body',
|
329 |
-
* 'description' => 'my_email_description',
|
330 |
-
* 'recipient' => 'user', // set 'admin' for make administrator as recipient
|
331 |
-
* 'default_active' => true // can be false for make disabled by default
|
332 |
-
* );
|
333 |
-
*
|
334 |
-
* return $emails;
|
335 |
-
* }
|
336 |
-
* ?>
|
337 |
-
*/
|
338 |
-
$this->email_notifications = apply_filters( 'um_email_notifications', array(
|
339 |
-
'welcome_email' => array(
|
340 |
-
'key' => 'welcome_email',
|
341 |
-
'title' => __( 'Account Welcome Email','ultimate-member' ),
|
342 |
-
'subject' => 'Welcome to {site_name}!',
|
343 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
344 |
-
'Thank you for signing up with {site_name}! Your account is now active.<br /><br />' .
|
345 |
-
'To login please visit the following url:<br /><br />' .
|
346 |
-
'{login_url} <br /><br />' .
|
347 |
-
'Your account e-mail: {email} <br />' .
|
348 |
-
'Your account username: {username} <br /><br />' .
|
349 |
-
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
350 |
-
'Thanks,<br />' .
|
351 |
-
'{site_name}',
|
352 |
-
'description' => __('Whether to send the user an email when his account is automatically approved','ultimate-member'),
|
353 |
-
'recipient' => 'user',
|
354 |
-
'default_active' => true
|
355 |
-
),
|
356 |
-
'checkmail_email' => array(
|
357 |
-
'key' => 'checkmail_email',
|
358 |
-
'title' => __( 'Account Activation Email','ultimate-member' ),
|
359 |
-
'subject' => 'Please activate your account',
|
360 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
361 |
-
'Thank you for signing up with {site_name}! To activate your account, please click the link below to confirm your email address:<br /><br />' .
|
362 |
-
'{account_activation_link} <br /><br />' .
|
363 |
-
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
364 |
-
'Thanks, <br />' .
|
365 |
-
'{site_name}',
|
366 |
-
'description' => __('Whether to send the user an email when his account needs e-mail activation','ultimate-member'),
|
367 |
-
'recipient' => 'user'
|
368 |
-
),
|
369 |
-
'pending_email' => array(
|
370 |
-
'key' => 'pending_email',
|
371 |
-
'title' => __( 'Your account is pending review','ultimate-member' ),
|
372 |
-
'subject' => '[{site_name}] New user account',
|
373 |
-
'body' => 'Hi {display_name}, <br /><br />' .
|
374 |
-
'Thank you for signing up with {site_name}! Your account is currently being reviewed by a member of our team.<br /><br />' .
|
375 |
-
'Please allow us some time to process your request.<br /><br />' .
|
376 |
-
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
377 |
-
'Thanks,<br />' .
|
378 |
-
'{site_name}',
|
379 |
-
'description' => __('Whether to send the user an email when his account needs admin review','ultimate-member'),
|
380 |
-
'recipient' => 'user'
|
381 |
-
),
|
382 |
-
'approved_email' => array(
|
383 |
-
'key' => 'approved_email',
|
384 |
-
'title' => __( 'Account Approved Email','ultimate-member' ),
|
385 |
-
'subject' => 'Your account at {site_name} is now active',
|
386 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
387 |
-
'Thank you for signing up with {site_name}! Your account has been approved and is now active.<br /><br />' .
|
388 |
-
'To login please visit the following url:<br /><br />' .
|
389 |
-
'{login_url}<br /><br />' .
|
390 |
-
'Your account e-mail: {email}<br />' .
|
391 |
-
'Your account username: {username}<br />' .
|
392 |
-
'Set your account password: {password_reset_link}<br /><br />' .
|
393 |
-
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
394 |
-
'Thanks,<br />' .
|
395 |
-
'{site_name}',
|
396 |
-
'description' => __('Whether to send the user an email when his account is approved','ultimate-member'),
|
397 |
-
'recipient' => 'user'
|
398 |
-
),
|
399 |
-
'rejected_email' => array(
|
400 |
-
'key' => 'rejected_email',
|
401 |
-
'title' => __( 'Account Rejected Email','ultimate-member' ),
|
402 |
-
'subject' => 'Your account has been rejected',
|
403 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
404 |
-
'Thank you for applying for membership to {site_name}! We have reviewed your information and unfortunately we are unable to accept you as a member at this moment.<br /><br />' .
|
405 |
-
'Please feel free to apply again at a future date.<br /><br />' .
|
406 |
-
'Thanks,<br />' .
|
407 |
-
'{site_name}',
|
408 |
-
'description' => __('Whether to send the user an email when his account is rejected','ultimate-member'),
|
409 |
-
'recipient' => 'user'
|
410 |
-
),
|
411 |
-
'inactive_email' => array(
|
412 |
-
'key' => 'inactive_email',
|
413 |
-
'title' => __( 'Account Deactivated Email','ultimate-member' ),
|
414 |
-
'subject' => 'Your account has been deactivated',
|
415 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
416 |
-
'This is an automated email to let you know your {site_name} account has been deactivated.<br /><br />' .
|
417 |
-
'If you would like your account to be reactivated please contact us at {admin_email}<br /><br />' .
|
418 |
-
'Thanks,<br />' .
|
419 |
-
'{site_name}',
|
420 |
-
'description' => __('Whether to send the user an email when his account is deactivated','ultimate-member'),
|
421 |
-
'recipient' => 'user',
|
422 |
-
'default_active' => true
|
423 |
-
),
|
424 |
-
'deletion_email' => array(
|
425 |
-
'key' => 'deletion_email',
|
426 |
-
'title' => __( 'Account Deleted Email','ultimate-member' ),
|
427 |
-
'subject' => 'Your account has been deleted',
|
428 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
429 |
-
'This is an automated email to let you know your {site_name} account has been deleted. All of your personal information has been permanently deleted and you will no longer be able to login to {site_name}.<br /><br />' .
|
430 |
-
'If your account has been deleted by accident please contact us at {admin_email} <br />' .
|
431 |
-
'Thanks,<br />' .
|
432 |
-
'{site_name}',
|
433 |
-
'description' => __('Whether to send the user an email when his account is deleted','ultimate-member'),
|
434 |
-
'recipient' => 'user',
|
435 |
-
'default_active' => true
|
436 |
-
),
|
437 |
-
'resetpw_email' => array(
|
438 |
-
'key' => 'resetpw_email',
|
439 |
-
'title' => __( 'Password Reset Email','ultimate-member' ),
|
440 |
-
'subject' => 'Reset your password',
|
441 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
442 |
-
'We received a request to reset the password for your account. If you made this request, click the link below to change your password:<br /><br />' .
|
443 |
-
'{password_reset_link}<br /><br />' .
|
444 |
-
'If you didn\'t make this request, you can ignore this email <br /><br />' .
|
445 |
-
'Thanks,<br />' .
|
446 |
-
'{site_name}',
|
447 |
-
'description' => __('Whether to send an email when users changed their password (Recommended, please keep on)','ultimate-member'),
|
448 |
-
'recipient' => 'user',
|
449 |
-
'default_active' => true
|
450 |
-
),
|
451 |
-
'changedpw_email' => array(
|
452 |
-
'key' => 'changedpw_email',
|
453 |
-
'title' => __( 'Password Changed Email','ultimate-member' ),
|
454 |
-
'subject' => 'Your {site_name} password has been changed',
|
455 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
456 |
-
'You recently changed the password associated with your {site_name} account.<br /><br />' .
|
457 |
-
'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}<br /><br />' .
|
458 |
-
'Thanks,<br />' .
|
459 |
-
'{site_name}',
|
460 |
-
'description' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)','ultimate-member'),
|
461 |
-
'recipient' => 'user',
|
462 |
-
'default_active' => true
|
463 |
-
),
|
464 |
-
'changedaccount_email' => array(
|
465 |
-
'key' => 'changedaccount_email',
|
466 |
-
'title' => __( 'Account Updated Email','ultimate-member' ),
|
467 |
-
'subject' => 'Your account at {site_name} was updated',
|
468 |
-
'body' => 'Hi {display_name},<br /><br />' .
|
469 |
-
'You recently updated your {site_name} account.<br /><br />' .
|
470 |
-
'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}<br /><br />' .
|
471 |
-
'Thanks,<br />' .
|
472 |
-
'{site_name}',
|
473 |
-
'description' => __('Whether to send the user an email when he updated their account','ultimate-member'),
|
474 |
-
'recipient' => 'user',
|
475 |
-
'default_active'=> true
|
476 |
-
),
|
477 |
-
'notification_new_user' => array(
|
478 |
-
'key' => 'notification_new_user',
|
479 |
-
'title' => __( 'New User Notification','ultimate-member' ),
|
480 |
-
'subject' => '[{site_name}] New user account',
|
481 |
-
'body' => '{display_name} has just created an account on {site_name}. To view their profile click here:<br /><br />' .
|
482 |
-
'{user_profile_link}<br /><br />' .
|
483 |
-
'Here is the submitted registration form:<br /><br />' .
|
484 |
-
'{submitted_registration}',
|
485 |
-
'description' => __('Whether to receive notification when a new user account is approved','ultimate-member'),
|
486 |
-
'recipient' => 'admin',
|
487 |
-
'default_active' => true
|
488 |
-
),
|
489 |
-
'notification_review' => array(
|
490 |
-
'key' => 'notification_review',
|
491 |
-
'title' => __( 'Account Needs Review Notification','ultimate-member' ),
|
492 |
-
'subject' => '[{site_name}] New user awaiting review',
|
493 |
-
'body' => '{display_name} has just applied for membership to {site_name} and is waiting to be reviewed.<br /><br />' .
|
494 |
-
'To review this member please click the following link:<br /><br />' .
|
495 |
-
'{user_profile_link}<br /><br />' .
|
496 |
-
'Here is the submitted registration form:<br /><br />' .
|
497 |
-
'{submitted_registration}',
|
498 |
-
'description' => __('Whether to receive notification when an account needs admin review','ultimate-member'),
|
499 |
-
'recipient' => 'admin'
|
500 |
-
),
|
501 |
-
'notification_deletion' => array(
|
502 |
-
'key' => 'notification_deletion',
|
503 |
-
'title' => __( 'Account Deletion Notification','ultimate-member' ),
|
504 |
-
'subject' => '[{site_name}] Account deleted',
|
505 |
-
'body' => '{display_name} has just deleted their {site_name} account.',
|
506 |
-
'description' => __('Whether to receive notification when an account is deleted','ultimate-member'),
|
507 |
-
'recipient' => 'admin'
|
508 |
-
)
|
509 |
-
) );
|
510 |
-
|
511 |
-
|
512 |
-
//settings defaults
|
513 |
-
$this->settings_defaults = array(
|
514 |
-
'restricted_access_post_metabox' => array( 'post' => 1, 'page' => 1 ),
|
515 |
-
'disable_restriction_pre_queries' => 0,
|
516 |
-
'uninstall_on_delete' => 0,
|
517 |
-
'permalink_base' => 'user_login',
|
518 |
-
'display_name' => 'full_name',
|
519 |
-
'display_name_field' => '',
|
520 |
-
'author_redirect' => 1,
|
521 |
-
'members_page' => 1,
|
522 |
-
'use_gravatars' => 0,
|
523 |
-
'use_um_gravatar_default_builtin_image' => 'default',
|
524 |
-
'use_um_gravatar_default_image' => 0,
|
525 |
-
'reset_require_strongpass' => 0,
|
526 |
-
'
|
527 |
-
'
|
528 |
-
'
|
529 |
-
'
|
530 |
-
'
|
531 |
-
'
|
532 |
-
'
|
533 |
-
'
|
534 |
-
'
|
535 |
-
'
|
536 |
-
'
|
537 |
-
'
|
538 |
-
'
|
539 |
-
'
|
540 |
-
'
|
541 |
-
'
|
542 |
-
'
|
543 |
-
'
|
544 |
-
'
|
545 |
-
'
|
546 |
-
'
|
547 |
-
'
|
548 |
-
'
|
549 |
-
'
|
550 |
-
'
|
551 |
-
'
|
552 |
-
'
|
553 |
-
'
|
554 |
-
'
|
555 |
-
'
|
556 |
-
'
|
557 |
-
'
|
558 |
-
'
|
559 |
-
'
|
560 |
-
'
|
561 |
-
'
|
562 |
-
'
|
563 |
-
'
|
564 |
-
'
|
565 |
-
'
|
566 |
-
'
|
567 |
-
'
|
568 |
-
'
|
569 |
-
'
|
570 |
-
'
|
571 |
-
'
|
572 |
-
'
|
573 |
-
'
|
574 |
-
'
|
575 |
-
'
|
576 |
-
'
|
577 |
-
'
|
578 |
-
'
|
579 |
-
'
|
580 |
-
'
|
581 |
-
'
|
582 |
-
'
|
583 |
-
'
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
$this->settings_defaults[ $key ] = $notification['
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
*
|
624 |
-
*
|
625 |
-
* @
|
626 |
-
* @
|
627 |
-
*
|
628 |
-
* @
|
629 |
-
* ["
|
630 |
-
* @
|
631 |
-
*
|
632 |
-
* @
|
633 |
-
* <?php
|
634 |
-
*
|
635 |
-
*
|
636 |
-
*
|
637 |
-
*
|
638 |
-
*
|
639 |
-
*
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
$this->
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
*
|
652 |
-
|
653 |
-
|
654 |
-
'
|
655 |
-
'
|
656 |
-
'
|
657 |
-
'
|
658 |
-
'
|
659 |
-
'
|
660 |
-
'
|
661 |
-
'
|
662 |
-
'
|
663 |
-
'
|
664 |
-
'
|
665 |
-
'
|
666 |
-
'
|
667 |
-
'
|
668 |
-
'
|
669 |
-
'
|
670 |
-
'
|
671 |
-
'
|
672 |
-
'
|
673 |
-
'
|
674 |
-
'
|
675 |
-
'
|
676 |
-
'
|
677 |
-
'
|
678 |
-
'
|
679 |
-
'
|
680 |
-
'
|
681 |
-
'
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
'
|
690 |
-
'
|
691 |
-
'
|
692 |
-
'
|
693 |
-
'
|
694 |
-
'
|
695 |
-
'
|
696 |
-
'
|
697 |
-
'
|
698 |
-
'
|
699 |
-
'
|
700 |
-
'
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
'
|
706 |
-
'
|
707 |
-
'
|
708 |
-
'
|
709 |
-
'
|
710 |
-
'
|
711 |
-
'
|
712 |
-
'
|
713 |
-
'
|
714 |
-
'
|
715 |
-
'
|
716 |
-
'
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
'
|
722 |
-
'
|
723 |
-
'
|
724 |
-
'
|
725 |
-
'
|
726 |
-
'
|
727 |
-
'
|
728 |
-
'
|
729 |
-
'
|
730 |
-
'
|
731 |
-
'
|
732 |
-
'
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
'
|
738 |
-
'
|
739 |
-
'
|
740 |
-
'
|
741 |
-
'
|
742 |
-
'
|
743 |
-
'
|
744 |
-
'
|
745 |
-
'
|
746 |
-
'
|
747 |
-
'
|
748 |
-
'
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
'
|
754 |
-
'
|
755 |
-
'
|
756 |
-
'
|
757 |
-
'
|
758 |
-
'
|
759 |
-
'
|
760 |
-
'
|
761 |
-
'
|
762 |
-
'
|
763 |
-
'
|
764 |
-
'
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
*
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
'
|
799 |
-
'
|
800 |
-
'
|
801 |
-
'
|
802 |
-
'
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace um;
|
3 |
+
|
4 |
+
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\Config' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Config
|
13 |
+
*
|
14 |
+
* Class with global variables for UM
|
15 |
+
*
|
16 |
+
* @package um
|
17 |
+
*/
|
18 |
+
class Config {
|
19 |
+
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
var $core_forms;
|
25 |
+
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var array
|
29 |
+
*/
|
30 |
+
var $core_directories;
|
31 |
+
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var mixed|void
|
35 |
+
*/
|
36 |
+
var $core_pages;
|
37 |
+
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @var array
|
41 |
+
*/
|
42 |
+
var $core_directory_meta = array();
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
+
var $core_global_meta_all;
|
49 |
+
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @var mixed|void
|
53 |
+
*/
|
54 |
+
var $core_form_meta_all;
|
55 |
+
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @var array
|
59 |
+
*/
|
60 |
+
var $core_form_meta = array();
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @var
|
65 |
+
*/
|
66 |
+
var $perms;
|
67 |
+
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @var
|
71 |
+
*/
|
72 |
+
var $nonadmin_perms;
|
73 |
+
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @var mixed|void
|
77 |
+
*/
|
78 |
+
var $email_notifications;
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
* @var mixed|void
|
83 |
+
*/
|
84 |
+
var $settings_defaults;
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @var array
|
89 |
+
*/
|
90 |
+
var $permalinks;
|
91 |
+
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Config constructor.
|
95 |
+
*/
|
96 |
+
function __construct() {
|
97 |
+
$this->core_forms = array(
|
98 |
+
'register',
|
99 |
+
'login',
|
100 |
+
'profile',
|
101 |
+
);
|
102 |
+
|
103 |
+
$this->core_directories = array(
|
104 |
+
'members',
|
105 |
+
);
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* UM hook
|
110 |
+
*
|
111 |
+
* @type filter
|
112 |
+
* @title um_core_pages
|
113 |
+
* @description Extend UM core pages
|
114 |
+
* @input_vars
|
115 |
+
* [{"var":"$pages","type":"array","desc":"UM core pages"}]
|
116 |
+
* @change_log
|
117 |
+
* ["Since: 2.0"]
|
118 |
+
* @usage
|
119 |
+
* <?php add_filter( 'um_core_pages', 'function_name', 10, 1 ); ?>
|
120 |
+
* @example
|
121 |
+
* <?php
|
122 |
+
* add_filter( 'um_core_pages', 'my_core_pages', 10, 1 );
|
123 |
+
* function my_core_pages( $pages ) {
|
124 |
+
* // your code here
|
125 |
+
* $pages['my_page_key'] = array( 'title' => __( 'My Page Title', 'my-translate-key' ) );
|
126 |
+
* return $pages;
|
127 |
+
* }
|
128 |
+
* ?>
|
129 |
+
*/
|
130 |
+
$this->core_pages = apply_filters( 'um_core_pages', array(
|
131 |
+
'user' => array( 'title' => __( 'User', 'ultimate-member' ) ),
|
132 |
+
'login' => array( 'title' => __( 'Login', 'ultimate-member' ) ),
|
133 |
+
'register' => array( 'title' => __( 'Register', 'ultimate-member' ) ),
|
134 |
+
'members' => array( 'title' => __( 'Members', 'ultimate-member' ) ),
|
135 |
+
'logout' => array( 'title' => __( 'Logout', 'ultimate-member' ) ),
|
136 |
+
'account' => array( 'title' => __( 'Account', 'ultimate-member' ) ),
|
137 |
+
'password-reset' => array( 'title' => __( 'Password Reset', 'ultimate-member' ) ),
|
138 |
+
) );
|
139 |
+
|
140 |
+
$this->core_directory_meta['members'] = array(
|
141 |
+
'_um_core' => 'members',
|
142 |
+
'_um_template' => 'members',
|
143 |
+
'_um_mode' => 'directory',
|
144 |
+
'_um_view_types' => array( 'grid' ),
|
145 |
+
'_um_default_view' => 'grid',
|
146 |
+
'_um_roles' => array(),
|
147 |
+
'_um_has_profile_photo' => 0,
|
148 |
+
'_um_has_cover_photo' => 0,
|
149 |
+
'_um_show_these_users' => '',
|
150 |
+
'_um_exclude_these_users' => '',
|
151 |
+
|
152 |
+
'_um_sortby' => 'user_registered_desc',
|
153 |
+
'_um_sortby_custom' => '',
|
154 |
+
'_um_sortby_custom_label' => '',
|
155 |
+
'_um_enable_sorting' => 0,
|
156 |
+
'_um_sorting_fields' => array(),
|
157 |
+
|
158 |
+
'_um_profile_photo' => '1',
|
159 |
+
'_um_cover_photos' => '1',
|
160 |
+
'_um_show_name' => '1',
|
161 |
+
'_um_show_tagline' => 0,
|
162 |
+
'_um_tagline_fields' => array(),
|
163 |
+
'_um_show_userinfo' => 0,
|
164 |
+
'_um_reveal_fields' => array(),
|
165 |
+
'_um_show_social' => 0,
|
166 |
+
'_um_userinfo_animate' => '1',
|
167 |
+
|
168 |
+
'_um_search' => 0,
|
169 |
+
'_um_roles_can_search' => array(),
|
170 |
+
'_um_filters' => 0,
|
171 |
+
'_um_roles_can_filter' => array(),
|
172 |
+
'_um_search_fields' => array(),
|
173 |
+
'_um_filters_expanded' => 0,
|
174 |
+
'_um_filters_is_collapsible' => 1,
|
175 |
+
'_um_search_filters' => array(),
|
176 |
+
|
177 |
+
'_um_must_search' => 0,
|
178 |
+
'_um_max_users' => '',
|
179 |
+
'_um_profiles_per_page' => 12,
|
180 |
+
'_um_profiles_per_page_mobile' => 6,
|
181 |
+
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
|
182 |
+
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
|
183 |
+
'_um_directory_no_users' => __( 'We are sorry. We cannot find any users who match your search criteria.', 'ultimate-member' ),
|
184 |
+
);
|
185 |
+
|
186 |
+
$this->core_global_meta_all = array(
|
187 |
+
'_um_primary_btn_color',
|
188 |
+
'_um_primary_btn_hover',
|
189 |
+
'_um_primary_btn_text',
|
190 |
+
'_um_secondary_btn_color',
|
191 |
+
'_um_secondary_btn_hover',
|
192 |
+
'_um_secondary_btn_text',
|
193 |
+
'_um_form_border',
|
194 |
+
'_um_form_border_hover',
|
195 |
+
'_um_form_bg_color',
|
196 |
+
'_um_form_bg_color_focus',
|
197 |
+
'_um_form_placeholder',
|
198 |
+
'_um_form_icon_color',
|
199 |
+
'_um_form_asterisk_color',
|
200 |
+
'_um_form_field_label',
|
201 |
+
'_um_form_text_color',
|
202 |
+
'_um_active_color',
|
203 |
+
'_um_help_tip_color',
|
204 |
+
'_um_secondary_color',
|
205 |
+
);
|
206 |
+
|
207 |
+
|
208 |
+
/**
|
209 |
+
* UM hook
|
210 |
+
*
|
211 |
+
* @type filter
|
212 |
+
* @title um_core_form_meta_all
|
213 |
+
* @description Extend UM forms meta keys
|
214 |
+
* @input_vars
|
215 |
+
* [{"var":"$meta","type":"array","desc":"UM forms meta"}]
|
216 |
+
* @change_log
|
217 |
+
* ["Since: 2.0"]
|
218 |
+
* @usage
|
219 |
+
* <?php add_filter( 'um_core_form_meta_all', 'function_name', 10, 1 ); ?>
|
220 |
+
* @example
|
221 |
+
* <?php
|
222 |
+
* add_filter( 'um_core_form_meta_all', 'my_core_form_meta', 10, 1 );
|
223 |
+
* function my_core_form_meta( $meta ) {
|
224 |
+
* // your code here
|
225 |
+
* $meta['my_meta_key'] = 'my_meta_value';
|
226 |
+
* return $meta;
|
227 |
+
* }
|
228 |
+
* ?>
|
229 |
+
*/
|
230 |
+
$this->core_form_meta_all = apply_filters( 'um_core_form_meta_all', array(
|
231 |
+
/*Profile Form*/
|
232 |
+
'_um_profile_show_name' => 1,
|
233 |
+
'_um_profile_show_social_links' => 0,
|
234 |
+
'_um_profile_show_bio' => 1,
|
235 |
+
'_um_profile_bio_maxchars' => 180,
|
236 |
+
'_um_profile_header_menu' => 'bc',
|
237 |
+
'_um_profile_empty_text' => 1,
|
238 |
+
'_um_profile_empty_text_emo' => 1,
|
239 |
+
'_um_profile_role' => array(),
|
240 |
+
'_um_profile_template' => 'profile',
|
241 |
+
'_um_profile_max_width' => '1000px',
|
242 |
+
'_um_profile_area_max_width' => '600px',
|
243 |
+
'_um_profile_align' => 'center',
|
244 |
+
'_um_profile_icons' => 'label',
|
245 |
+
'_um_profile_disable_photo_upload' => 0,
|
246 |
+
'_um_profile_photosize' => '190',
|
247 |
+
'_um_profile_cover_enabled' => 1,
|
248 |
+
'_um_profile_coversize' => 'original',
|
249 |
+
'_um_profile_cover_ratio' => '2.7:1',
|
250 |
+
'_um_profile_photocorner' => '1',
|
251 |
+
'_um_profile_header_bg' => '',
|
252 |
+
'_um_profile_primary_btn_word' => __( 'Update Profile', 'ultimate-member' ),
|
253 |
+
'_um_profile_secondary_btn' => '1',
|
254 |
+
'_um_profile_secondary_btn_word' => __( 'Cancel', 'ultimate-member' ),
|
255 |
+
|
256 |
+
/*Registration Form*/
|
257 |
+
'_um_register_role' => '0',
|
258 |
+
'_um_register_template' => 'register',
|
259 |
+
'_um_register_max_width' => '450px',
|
260 |
+
'_um_register_align' => 'center',
|
261 |
+
'_um_register_icons' => 'label',
|
262 |
+
'_um_register_primary_btn_word' => __( 'Register', 'ultimate-member' ),
|
263 |
+
'_um_register_secondary_btn' => 1,
|
264 |
+
'_um_register_secondary_btn_word' => __( 'Login', 'ultimate-member' ),
|
265 |
+
'_um_register_secondary_btn_url' => '',
|
266 |
+
|
267 |
+
/*Login Form*/
|
268 |
+
'_um_login_template' => 'login',
|
269 |
+
'_um_login_max_width' => '450px',
|
270 |
+
'_um_login_align' => 'center',
|
271 |
+
'_um_login_icons' => 'label',
|
272 |
+
'_um_login_primary_btn_word' => __( 'Login', 'ultimate-member' ),
|
273 |
+
'_um_login_forgot_pass_link' => 1,
|
274 |
+
'_um_login_show_rememberme' => 1,
|
275 |
+
'_um_login_secondary_btn' => 1,
|
276 |
+
'_um_login_secondary_btn_word' => __( 'Register', 'ultimate-member' ),
|
277 |
+
'_um_login_secondary_btn_url' => '',
|
278 |
+
|
279 |
+
/*Member Directory*/
|
280 |
+
'_um_directory_template' => 'members',
|
281 |
+
'_um_directory_header' => __( '{total_users} Members', 'ultimate-member' ),
|
282 |
+
'_um_directory_header_single' => __( '{total_users} Member', 'ultimate-member' ),
|
283 |
+
) );
|
284 |
+
|
285 |
+
$this->core_form_meta['register'] = array(
|
286 |
+
'_um_custom_fields' => 'a:6:{s:10:"user_login";a:15:{s:5:"title";s:8:"Username";s:7:"metakey";s:10:"user_login";s:4:"type";s:4:"text";s:5:"label";s:8:"Username";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:15:"unique_username";s:9:"min_chars";i:3;s:9:"max_chars";i:24;s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"user_email";a:13:{s:5:"title";s:14:"E-mail Address";s:7:"metakey";s:10:"user_email";s:4:"type";s:4:"text";s:5:"label";s:14:"E-mail Address";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"validate";s:12:"unique_email";s:8:"position";s:1:"4";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"5";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:10:"first_name";a:12:{s:5:"title";s:10:"First Name";s:7:"metakey";s:10:"first_name";s:4:"type";s:4:"text";s:5:"label";s:10:"First Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"last_name";a:12:{s:5:"title";s:9:"Last Name";s:7:"metakey";s:9:"last_name";s:4:"type";s:4:"text";s:5:"label";s:9:"Last Name";s:8:"required";i:0;s:6:"public";i:1;s:8:"editable";i:1;s:8:"position";s:1:"3";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
287 |
+
'_um_mode' => 'register',
|
288 |
+
'_um_core' => 'register',
|
289 |
+
'_um_register_use_custom_settings' => 0,
|
290 |
+
);
|
291 |
+
|
292 |
+
$this->core_form_meta['login'] = array(
|
293 |
+
'_um_custom_fields' => 'a:3:{s:8:"username";a:13:{s:5:"title";s:18:"Username or E-mail";s:7:"metakey";s:8:"username";s:4:"type";s:4:"text";s:5:"label";s:18:"Username or E-mail";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:0;s:8:"validate";s:24:"unique_username_or_email";s:8:"position";s:1:"1";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:13:"user_password";a:16:{s:5:"title";s:8:"Password";s:7:"metakey";s:13:"user_password";s:4:"type";s:8:"password";s:5:"label";s:8:"Password";s:8:"required";i:1;s:6:"public";i:1;s:8:"editable";i:1;s:9:"min_chars";i:8;s:9:"max_chars";i:30;s:15:"force_good_pass";i:1;s:18:"force_confirm_pass";i:1;s:8:"position";s:1:"2";s:6:"in_row";s:9:"_um_row_1";s:10:"in_sub_row";s:1:"0";s:9:"in_column";s:1:"1";s:8:"in_group";s:0:"";}s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
294 |
+
'_um_mode' => 'login',
|
295 |
+
'_um_core' => 'login',
|
296 |
+
'_um_login_use_custom_settings' => 0,
|
297 |
+
);
|
298 |
+
|
299 |
+
$this->core_form_meta['profile'] = array(
|
300 |
+
'_um_custom_fields' => 'a:1:{s:9:"_um_row_1";a:4:{s:4:"type";s:3:"row";s:2:"id";s:9:"_um_row_1";s:8:"sub_rows";s:1:"1";s:4:"cols";s:1:"1";}}',
|
301 |
+
'_um_mode' => 'profile',
|
302 |
+
'_um_core' => 'profile',
|
303 |
+
'_um_profile_use_custom_settings' => 0,
|
304 |
+
);
|
305 |
+
|
306 |
+
|
307 |
+
/**
|
308 |
+
* UM hook
|
309 |
+
*
|
310 |
+
* @type filter
|
311 |
+
* @title um_email_notifications
|
312 |
+
* @description Extend UM email notifications
|
313 |
+
* @input_vars
|
314 |
+
* [{"var":"$emails","type":"array","desc":"UM email notifications"}]
|
315 |
+
* @change_log
|
316 |
+
* ["Since: 2.0"]
|
317 |
+
* @usage
|
318 |
+
* <?php add_filter( 'um_email_notifications', 'function_name', 10, 1 ); ?>
|
319 |
+
* @example
|
320 |
+
* <?php
|
321 |
+
* add_filter( 'um_email_notifications', 'my_email_notifications', 10, 1 );
|
322 |
+
* function my_email_notifications( $emails ) {
|
323 |
+
* // your code here
|
324 |
+
* $emails['my_email'] = array(
|
325 |
+
* 'key' => 'my_email',
|
326 |
+
* 'title' => __( 'my_email_title','ultimate-member' ),
|
327 |
+
* 'subject' => 'my_email_subject',
|
328 |
+
* 'body' => 'my_email_body',
|
329 |
+
* 'description' => 'my_email_description',
|
330 |
+
* 'recipient' => 'user', // set 'admin' for make administrator as recipient
|
331 |
+
* 'default_active' => true // can be false for make disabled by default
|
332 |
+
* );
|
333 |
+
*
|
334 |
+
* return $emails;
|
335 |
+
* }
|
336 |
+
* ?>
|
337 |
+
*/
|
338 |
+
$this->email_notifications = apply_filters( 'um_email_notifications', array(
|
339 |
+
'welcome_email' => array(
|
340 |
+
'key' => 'welcome_email',
|
341 |
+
'title' => __( 'Account Welcome Email','ultimate-member' ),
|
342 |
+
'subject' => 'Welcome to {site_name}!',
|
343 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
344 |
+
'Thank you for signing up with {site_name}! Your account is now active.<br /><br />' .
|
345 |
+
'To login please visit the following url:<br /><br />' .
|
346 |
+
'{login_url} <br /><br />' .
|
347 |
+
'Your account e-mail: {email} <br />' .
|
348 |
+
'Your account username: {username} <br /><br />' .
|
349 |
+
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
350 |
+
'Thanks,<br />' .
|
351 |
+
'{site_name}',
|
352 |
+
'description' => __('Whether to send the user an email when his account is automatically approved','ultimate-member'),
|
353 |
+
'recipient' => 'user',
|
354 |
+
'default_active' => true
|
355 |
+
),
|
356 |
+
'checkmail_email' => array(
|
357 |
+
'key' => 'checkmail_email',
|
358 |
+
'title' => __( 'Account Activation Email','ultimate-member' ),
|
359 |
+
'subject' => 'Please activate your account',
|
360 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
361 |
+
'Thank you for signing up with {site_name}! To activate your account, please click the link below to confirm your email address:<br /><br />' .
|
362 |
+
'{account_activation_link} <br /><br />' .
|
363 |
+
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
364 |
+
'Thanks, <br />' .
|
365 |
+
'{site_name}',
|
366 |
+
'description' => __('Whether to send the user an email when his account needs e-mail activation','ultimate-member'),
|
367 |
+
'recipient' => 'user'
|
368 |
+
),
|
369 |
+
'pending_email' => array(
|
370 |
+
'key' => 'pending_email',
|
371 |
+
'title' => __( 'Your account is pending review','ultimate-member' ),
|
372 |
+
'subject' => '[{site_name}] New user account',
|
373 |
+
'body' => 'Hi {display_name}, <br /><br />' .
|
374 |
+
'Thank you for signing up with {site_name}! Your account is currently being reviewed by a member of our team.<br /><br />' .
|
375 |
+
'Please allow us some time to process your request.<br /><br />' .
|
376 |
+
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
377 |
+
'Thanks,<br />' .
|
378 |
+
'{site_name}',
|
379 |
+
'description' => __('Whether to send the user an email when his account needs admin review','ultimate-member'),
|
380 |
+
'recipient' => 'user'
|
381 |
+
),
|
382 |
+
'approved_email' => array(
|
383 |
+
'key' => 'approved_email',
|
384 |
+
'title' => __( 'Account Approved Email','ultimate-member' ),
|
385 |
+
'subject' => 'Your account at {site_name} is now active',
|
386 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
387 |
+
'Thank you for signing up with {site_name}! Your account has been approved and is now active.<br /><br />' .
|
388 |
+
'To login please visit the following url:<br /><br />' .
|
389 |
+
'{login_url}<br /><br />' .
|
390 |
+
'Your account e-mail: {email}<br />' .
|
391 |
+
'Your account username: {username}<br />' .
|
392 |
+
'Set your account password: {password_reset_link}<br /><br />' .
|
393 |
+
'If you have any problems, please contact us at {admin_email}<br /><br />' .
|
394 |
+
'Thanks,<br />' .
|
395 |
+
'{site_name}',
|
396 |
+
'description' => __('Whether to send the user an email when his account is approved','ultimate-member'),
|
397 |
+
'recipient' => 'user'
|
398 |
+
),
|
399 |
+
'rejected_email' => array(
|
400 |
+
'key' => 'rejected_email',
|
401 |
+
'title' => __( 'Account Rejected Email','ultimate-member' ),
|
402 |
+
'subject' => 'Your account has been rejected',
|
403 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
404 |
+
'Thank you for applying for membership to {site_name}! We have reviewed your information and unfortunately we are unable to accept you as a member at this moment.<br /><br />' .
|
405 |
+
'Please feel free to apply again at a future date.<br /><br />' .
|
406 |
+
'Thanks,<br />' .
|
407 |
+
'{site_name}',
|
408 |
+
'description' => __('Whether to send the user an email when his account is rejected','ultimate-member'),
|
409 |
+
'recipient' => 'user'
|
410 |
+
),
|
411 |
+
'inactive_email' => array(
|
412 |
+
'key' => 'inactive_email',
|
413 |
+
'title' => __( 'Account Deactivated Email','ultimate-member' ),
|
414 |
+
'subject' => 'Your account has been deactivated',
|
415 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
416 |
+
'This is an automated email to let you know your {site_name} account has been deactivated.<br /><br />' .
|
417 |
+
'If you would like your account to be reactivated please contact us at {admin_email}<br /><br />' .
|
418 |
+
'Thanks,<br />' .
|
419 |
+
'{site_name}',
|
420 |
+
'description' => __('Whether to send the user an email when his account is deactivated','ultimate-member'),
|
421 |
+
'recipient' => 'user',
|
422 |
+
'default_active' => true
|
423 |
+
),
|
424 |
+
'deletion_email' => array(
|
425 |
+
'key' => 'deletion_email',
|
426 |
+
'title' => __( 'Account Deleted Email','ultimate-member' ),
|
427 |
+
'subject' => 'Your account has been deleted',
|
428 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
429 |
+
'This is an automated email to let you know your {site_name} account has been deleted. All of your personal information has been permanently deleted and you will no longer be able to login to {site_name}.<br /><br />' .
|
430 |
+
'If your account has been deleted by accident please contact us at {admin_email} <br />' .
|
431 |
+
'Thanks,<br />' .
|
432 |
+
'{site_name}',
|
433 |
+
'description' => __('Whether to send the user an email when his account is deleted','ultimate-member'),
|
434 |
+
'recipient' => 'user',
|
435 |
+
'default_active' => true
|
436 |
+
),
|
437 |
+
'resetpw_email' => array(
|
438 |
+
'key' => 'resetpw_email',
|
439 |
+
'title' => __( 'Password Reset Email','ultimate-member' ),
|
440 |
+
'subject' => 'Reset your password',
|
441 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
442 |
+
'We received a request to reset the password for your account. If you made this request, click the link below to change your password:<br /><br />' .
|
443 |
+
'{password_reset_link}<br /><br />' .
|
444 |
+
'If you didn\'t make this request, you can ignore this email <br /><br />' .
|
445 |
+
'Thanks,<br />' .
|
446 |
+
'{site_name}',
|
447 |
+
'description' => __('Whether to send an email when users changed their password (Recommended, please keep on)','ultimate-member'),
|
448 |
+
'recipient' => 'user',
|
449 |
+
'default_active' => true
|
450 |
+
),
|
451 |
+
'changedpw_email' => array(
|
452 |
+
'key' => 'changedpw_email',
|
453 |
+
'title' => __( 'Password Changed Email','ultimate-member' ),
|
454 |
+
'subject' => 'Your {site_name} password has been changed',
|
455 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
456 |
+
'You recently changed the password associated with your {site_name} account.<br /><br />' .
|
457 |
+
'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}<br /><br />' .
|
458 |
+
'Thanks,<br />' .
|
459 |
+
'{site_name}',
|
460 |
+
'description' => __('Whether to send the user an email when he request to reset password (Recommended, please keep on)','ultimate-member'),
|
461 |
+
'recipient' => 'user',
|
462 |
+
'default_active' => true
|
463 |
+
),
|
464 |
+
'changedaccount_email' => array(
|
465 |
+
'key' => 'changedaccount_email',
|
466 |
+
'title' => __( 'Account Updated Email','ultimate-member' ),
|
467 |
+
'subject' => 'Your account at {site_name} was updated',
|
468 |
+
'body' => 'Hi {display_name},<br /><br />' .
|
469 |
+
'You recently updated your {site_name} account.<br /><br />' .
|
470 |
+
'If you did not make this change and believe your {site_name} account has been compromised, please contact us at the following email address: {admin_email}<br /><br />' .
|
471 |
+
'Thanks,<br />' .
|
472 |
+
'{site_name}',
|
473 |
+
'description' => __('Whether to send the user an email when he updated their account','ultimate-member'),
|
474 |
+
'recipient' => 'user',
|
475 |
+
'default_active'=> true
|
476 |
+
),
|
477 |
+
'notification_new_user' => array(
|
478 |
+
'key' => 'notification_new_user',
|
479 |
+
'title' => __( 'New User Notification','ultimate-member' ),
|
480 |
+
'subject' => '[{site_name}] New user account',
|
481 |
+
'body' => '{display_name} has just created an account on {site_name}. To view their profile click here:<br /><br />' .
|
482 |
+
'{user_profile_link}<br /><br />' .
|
483 |
+
'Here is the submitted registration form:<br /><br />' .
|
484 |
+
'{submitted_registration}',
|
485 |
+
'description' => __('Whether to receive notification when a new user account is approved','ultimate-member'),
|
486 |
+
'recipient' => 'admin',
|
487 |
+
'default_active' => true
|
488 |
+
),
|
489 |
+
'notification_review' => array(
|
490 |
+
'key' => 'notification_review',
|
491 |
+
'title' => __( 'Account Needs Review Notification','ultimate-member' ),
|
492 |
+
'subject' => '[{site_name}] New user awaiting review',
|
493 |
+
'body' => '{display_name} has just applied for membership to {site_name} and is waiting to be reviewed.<br /><br />' .
|
494 |
+
'To review this member please click the following link:<br /><br />' .
|
495 |
+
'{user_profile_link}<br /><br />' .
|
496 |
+
'Here is the submitted registration form:<br /><br />' .
|
497 |
+
'{submitted_registration}',
|
498 |
+
'description' => __('Whether to receive notification when an account needs admin review','ultimate-member'),
|
499 |
+
'recipient' => 'admin'
|
500 |
+
),
|
501 |
+
'notification_deletion' => array(
|
502 |
+
'key' => 'notification_deletion',
|
503 |
+
'title' => __( 'Account Deletion Notification','ultimate-member' ),
|
504 |
+
'subject' => '[{site_name}] Account deleted',
|
505 |
+
'body' => '{display_name} has just deleted their {site_name} account.',
|
506 |
+
'description' => __('Whether to receive notification when an account is deleted','ultimate-member'),
|
507 |
+
'recipient' => 'admin'
|
508 |
+
)
|
509 |
+
) );
|
510 |
+
|
511 |
+
|
512 |
+
//settings defaults
|
513 |
+
$this->settings_defaults = array(
|
514 |
+
'restricted_access_post_metabox' => array( 'post' => 1, 'page' => 1 ),
|
515 |
+
'disable_restriction_pre_queries' => 0,
|
516 |
+
'uninstall_on_delete' => 0,
|
517 |
+
'permalink_base' => 'user_login',
|
518 |
+
'display_name' => 'full_name',
|
519 |
+
'display_name_field' => '',
|
520 |
+
'author_redirect' => 1,
|
521 |
+
'members_page' => 1,
|
522 |
+
'use_gravatars' => 0,
|
523 |
+
'use_um_gravatar_default_builtin_image' => 'default',
|
524 |
+
'use_um_gravatar_default_image' => 0,
|
525 |
+
'reset_require_strongpass' => 0,
|
526 |
+
'password_min_chars' => 8,
|
527 |
+
'password_max_chars' => 30,
|
528 |
+
'account_tab_password' => 1,
|
529 |
+
'account_tab_privacy' => 1,
|
530 |
+
'account_tab_notifications' => 1,
|
531 |
+
'account_tab_delete' => 1,
|
532 |
+
'delete_account_text' => __( 'Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account enter your password below.', 'ultimate-member' ),
|
533 |
+
'delete_account_no_pass_required_text' => __( 'Are you sure you want to delete your account? This will erase all of your account data from the site. To delete your account, click on the button below.', 'ultimate-member' ),
|
534 |
+
'account_name' => 1,
|
535 |
+
'account_name_disable' => 0,
|
536 |
+
'account_name_require' => 1,
|
537 |
+
'account_email' => 1,
|
538 |
+
'account_general_password' => 0,
|
539 |
+
'account_hide_in_directory' => 1,
|
540 |
+
'account_hide_in_directory_default' => 'No',
|
541 |
+
'account_require_strongpass' => 0,
|
542 |
+
'photo_thumb_sizes' => array( 40, 80, 190 ),
|
543 |
+
'cover_thumb_sizes' => array( 300, 600 ),
|
544 |
+
'accessible' => 0,
|
545 |
+
'access_redirect' => '',
|
546 |
+
'access_exclude_uris' => array(),
|
547 |
+
'home_page_accessible' => 1,
|
548 |
+
'category_page_accessible' => 1,
|
549 |
+
'restricted_post_title_replace' => 1,
|
550 |
+
'restricted_access_post_title' => __( 'Restricted content', 'ultimate-member' ),
|
551 |
+
'restricted_access_message' => '',
|
552 |
+
'restricted_blocks' => 0,
|
553 |
+
'enable_blocks' => 0,
|
554 |
+
'restricted_block_message' => '',
|
555 |
+
'enable_reset_password_limit' => 1,
|
556 |
+
'reset_password_limit_number' => 3,
|
557 |
+
'blocked_emails' => '',
|
558 |
+
'blocked_words' => 'admin' . "\r\n" . 'administrator' . "\r\n" . 'webmaster' . "\r\n" . 'support' . "\r\n" . 'staff',
|
559 |
+
'default_avatar' => '',
|
560 |
+
'default_cover' => '',
|
561 |
+
'disable_profile_photo_upload' => 0,
|
562 |
+
'profile_show_metaicon' => 0,
|
563 |
+
'profile_menu' => 1,
|
564 |
+
'profile_menu_default_tab' => 'main',
|
565 |
+
'profile_menu_icons' => 1,
|
566 |
+
'form_asterisk' => 0,
|
567 |
+
'profile_title' => '{display_name} | {site_name}',
|
568 |
+
'profile_desc' => '{display_name} is on {site_name}. Join {site_name} to view {display_name}\'s profile',
|
569 |
+
'admin_email' => get_bloginfo('admin_email'),
|
570 |
+
'mail_from' => get_bloginfo('name'),
|
571 |
+
'mail_from_addr' => get_bloginfo('admin_email'),
|
572 |
+
'email_html' => 1,
|
573 |
+
'image_orientation_by_exif' => 0,
|
574 |
+
'image_compression' => 60,
|
575 |
+
'image_max_width' => 1000,
|
576 |
+
'cover_min_width' => 1000,
|
577 |
+
'profile_photo_max_size' => 999999999,
|
578 |
+
'cover_photo_max_size' => 999999999,
|
579 |
+
'custom_roles_increment' => 1,
|
580 |
+
'um_profile_object_cache_stop' => 0,
|
581 |
+
'rest_api_version' => '2.0',
|
582 |
+
'member_directory_own_table' => 0,
|
583 |
+
'profile_show_html_bio' => 0,
|
584 |
+
'profile_noindex' => 0,
|
585 |
+
'activation_link_expiry_time' => '',
|
586 |
+
);
|
587 |
+
|
588 |
+
add_filter( 'um_get_tabs_from_config', '__return_true' );
|
589 |
+
|
590 |
+
$tabs = UM()->profile()->tabs();
|
591 |
+
|
592 |
+
foreach ( $tabs as $id => $tab ) {
|
593 |
+
|
594 |
+
if ( ! empty( $tab['hidden'] ) ) {
|
595 |
+
continue;
|
596 |
+
}
|
597 |
+
|
598 |
+
$this->settings_defaults[ 'profile_tab_' . $id ] = 1;
|
599 |
+
|
600 |
+
if ( ! isset( $tab['default_privacy'] ) ) {
|
601 |
+
$this->settings_defaults[ 'profile_tab_' . $id . '_privacy' ] = 0;
|
602 |
+
$this->settings_defaults[ 'profile_tab_' . $id . '_roles' ] = '';
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
+
foreach ( $this->email_notifications as $key => $notification ) {
|
607 |
+
$this->settings_defaults[ $key . '_on' ] = ! empty( $notification['default_active'] );
|
608 |
+
$this->settings_defaults[ $key . '_sub' ] = $notification['subject'];
|
609 |
+
$this->settings_defaults[ $key ] = $notification['body'];
|
610 |
+
}
|
611 |
+
|
612 |
+
foreach ( $this->core_pages as $page_s => $page ) {
|
613 |
+
$page_id = UM()->options()->get_core_page_id( $page_s );
|
614 |
+
$this->settings_defaults[ $page_id ] = '';
|
615 |
+
}
|
616 |
+
|
617 |
+
foreach( $this->core_form_meta_all as $key => $value ) {
|
618 |
+
$this->settings_defaults[ str_replace( '_um_', '', $key ) ] = $value;
|
619 |
+
}
|
620 |
+
|
621 |
+
|
622 |
+
/**
|
623 |
+
* UM hook
|
624 |
+
*
|
625 |
+
* @type filter
|
626 |
+
* @title um_default_settings_values
|
627 |
+
* @description Extend UM default settings
|
628 |
+
* @input_vars
|
629 |
+
* [{"var":"$settings","type":"array","desc":"UM default settings"}]
|
630 |
+
* @change_log
|
631 |
+
* ["Since: 2.0"]
|
632 |
+
* @usage
|
633 |
+
* <?php add_filter( 'um_default_settings_values', 'function_name', 10, 1 ); ?>
|
634 |
+
* @example
|
635 |
+
* <?php
|
636 |
+
* add_filter( 'um_default_settings_values', 'my_default_settings_values', 10, 1 );
|
637 |
+
* function my_default_settings_values( $settings ) {
|
638 |
+
* // your code here
|
639 |
+
* return $settings;
|
640 |
+
* }
|
641 |
+
* ?>
|
642 |
+
*/
|
643 |
+
$this->settings_defaults = apply_filters( 'um_default_settings_values', $this->settings_defaults );
|
644 |
+
|
645 |
+
$this->permalinks = $this->get_core_pages();
|
646 |
+
|
647 |
+
|
648 |
+
|
649 |
+
$this->default_roles_metadata = array(
|
650 |
+
/*
|
651 |
+
* All caps map
|
652 |
+
*
|
653 |
+
* '_um_can_access_wpadmin' => 1,
|
654 |
+
'_um_can_not_see_adminbar' => 0,
|
655 |
+
'_um_can_edit_everyone' => 1,
|
656 |
+
'_um_can_edit_roles' => '',
|
657 |
+
'_um_can_delete_everyone' => 1,
|
658 |
+
'_um_can_delete_roles' => '',
|
659 |
+
'_um_after_delete' => '',
|
660 |
+
'_um_delete_redirect_url' => '',
|
661 |
+
'_um_can_edit_profile' => 1,
|
662 |
+
'_um_can_delete_profile' => 1,
|
663 |
+
'_um_default_homepage' => 1,
|
664 |
+
'_um_redirect_homepage' => '',
|
665 |
+
'_um_after_login' => 'redirect_admin',
|
666 |
+
'_um_login_redirect_url' => '',
|
667 |
+
'_um_after_logout' => 'redirect_home',
|
668 |
+
'_um_logout_redirect_url' => '',
|
669 |
+
'_um_can_view_all' => 1,
|
670 |
+
'_um_can_view_roles' => '',
|
671 |
+
'_um_can_make_private_profile' => 1,
|
672 |
+
'_um_can_access_private_profile' => 1,
|
673 |
+
'_um_status' => 'approved',
|
674 |
+
'_um_auto_approve_act' => 'redirect_profile',
|
675 |
+
'_um_auto_approve_url' => '',
|
676 |
+
'_um_login_email_activate' => '',
|
677 |
+
'_um_checkmail_action' => '',
|
678 |
+
'_um_checkmail_message' => '',
|
679 |
+
'_um_checkmail_url' => '',
|
680 |
+
'_um_url_email_activate' => '',
|
681 |
+
'_um_pending_action' => '',
|
682 |
+
'_um_pending_message' => '',
|
683 |
+
'_um_pending_url' => '',
|
684 |
+
*
|
685 |
+
* */
|
686 |
+
|
687 |
+
|
688 |
+
'subscriber' => array(
|
689 |
+
'_um_can_access_wpadmin' => 0,
|
690 |
+
'_um_can_not_see_adminbar' => 1,
|
691 |
+
'_um_can_edit_everyone' => 0,
|
692 |
+
'_um_can_delete_everyone' => 0,
|
693 |
+
'_um_can_edit_profile' => 1,
|
694 |
+
'_um_can_delete_profile' => 1,
|
695 |
+
'_um_after_login' => 'redirect_profile',
|
696 |
+
'_um_after_logout' => 'redirect_home',
|
697 |
+
'_um_default_homepage' => 1,
|
698 |
+
'_um_can_view_all' => 1,
|
699 |
+
'_um_can_make_private_profile' => 0,
|
700 |
+
'_um_can_access_private_profile' => 0,
|
701 |
+
'_um_status' => 'approved',
|
702 |
+
'_um_auto_approve_act' => 'redirect_profile',
|
703 |
+
),
|
704 |
+
'author' => array(
|
705 |
+
'_um_can_access_wpadmin' => 0,
|
706 |
+
'_um_can_not_see_adminbar' => 1,
|
707 |
+
'_um_can_edit_everyone' => 0,
|
708 |
+
'_um_can_delete_everyone' => 0,
|
709 |
+
'_um_can_edit_profile' => 1,
|
710 |
+
'_um_can_delete_profile' => 1,
|
711 |
+
'_um_after_login' => 'redirect_profile',
|
712 |
+
'_um_after_logout' => 'redirect_home',
|
713 |
+
'_um_default_homepage' => 1,
|
714 |
+
'_um_can_view_all' => 1,
|
715 |
+
'_um_can_make_private_profile' => 0,
|
716 |
+
'_um_can_access_private_profile' => 0,
|
717 |
+
'_um_status' => 'approved',
|
718 |
+
'_um_auto_approve_act' => 'redirect_profile',
|
719 |
+
),
|
720 |
+
'contributor' => array(
|
721 |
+
'_um_can_access_wpadmin' => 0,
|
722 |
+
'_um_can_not_see_adminbar' => 1,
|
723 |
+
'_um_can_edit_everyone' => 0,
|
724 |
+
'_um_can_delete_everyone' => 0,
|
725 |
+
'_um_can_edit_profile' => 1,
|
726 |
+
'_um_can_delete_profile' => 1,
|
727 |
+
'_um_after_login' => 'redirect_profile',
|
728 |
+
'_um_after_logout' => 'redirect_home',
|
729 |
+
'_um_default_homepage' => 1,
|
730 |
+
'_um_can_view_all' => 1,
|
731 |
+
'_um_can_make_private_profile' => 0,
|
732 |
+
'_um_can_access_private_profile' => 0,
|
733 |
+
'_um_status' => 'approved',
|
734 |
+
'_um_auto_approve_act' => 'redirect_profile',
|
735 |
+
),
|
736 |
+
'editor' => array(
|
737 |
+
'_um_can_access_wpadmin' => 0,
|
738 |
+
'_um_can_not_see_adminbar' => 1,
|
739 |
+
'_um_can_edit_everyone' => 0,
|
740 |
+
'_um_can_delete_everyone' => 0,
|
741 |
+
'_um_can_edit_profile' => 1,
|
742 |
+
'_um_can_delete_profile' => 1,
|
743 |
+
'_um_after_login' => 'redirect_profile',
|
744 |
+
'_um_after_logout' => 'redirect_home',
|
745 |
+
'_um_default_homepage' => 1,
|
746 |
+
'_um_can_view_all' => 1,
|
747 |
+
'_um_can_make_private_profile' => 0,
|
748 |
+
'_um_can_access_private_profile' => 0,
|
749 |
+
'_um_status' => 'approved',
|
750 |
+
'_um_auto_approve_act' => 'redirect_profile',
|
751 |
+
),
|
752 |
+
'administrator' => array(
|
753 |
+
'_um_can_access_wpadmin' => 1,
|
754 |
+
'_um_can_not_see_adminbar' => 0,
|
755 |
+
'_um_can_edit_everyone' => 1,
|
756 |
+
'_um_can_delete_everyone' => 1,
|
757 |
+
'_um_can_edit_profile' => 1,
|
758 |
+
'_um_can_delete_profile' => 1,
|
759 |
+
'_um_default_homepage' => 1,
|
760 |
+
'_um_after_login' => 'redirect_admin',
|
761 |
+
'_um_after_logout' => 'redirect_home',
|
762 |
+
'_um_can_view_all' => 1,
|
763 |
+
'_um_can_make_private_profile' => 1,
|
764 |
+
'_um_can_access_private_profile' => 1,
|
765 |
+
'_um_status' => 'approved',
|
766 |
+
'_um_auto_approve_act' => 'redirect_profile',
|
767 |
+
),
|
768 |
+
);
|
769 |
+
}
|
770 |
+
|
771 |
+
|
772 |
+
/**
|
773 |
+
* Get UM Pages
|
774 |
+
*
|
775 |
+
* @return array
|
776 |
+
*/
|
777 |
+
function get_core_pages() {
|
778 |
+
$permalink = array();
|
779 |
+
$core_pages = array_keys( $this->core_pages );
|
780 |
+
if ( empty( $core_pages ) ) {
|
781 |
+
return $permalink;
|
782 |
+
}
|
783 |
+
|
784 |
+
foreach ( $core_pages as $page_key ) {
|
785 |
+
$page_option_key = UM()->options()->get_core_page_id( $page_key );
|
786 |
+
$permalink[ $page_key ] = UM()->options()->get( $page_option_key );
|
787 |
+
}
|
788 |
+
|
789 |
+
return $permalink;
|
790 |
+
}
|
791 |
+
|
792 |
+
|
793 |
+
/**
|
794 |
+
* @todo make config class not cycled
|
795 |
+
*/
|
796 |
+
function set_core_page() {
|
797 |
+
$this->core_pages = apply_filters( 'um_core_pages', array(
|
798 |
+
'user' => array( 'title' => __( 'User', 'ultimate-member' ) ),
|
799 |
+
'login' => array( 'title' => __( 'Login', 'ultimate-member' ) ),
|
800 |
+
'register' => array( 'title' => __( 'Register', 'ultimate-member' ) ),
|
801 |
+
'members' => array( 'title' => __( 'Members', 'ultimate-member' ) ),
|
802 |
+
'logout' => array( 'title' => __( 'Logout', 'ultimate-member' ) ),
|
803 |
+
'account' => array( 'title' => __( 'Account', 'ultimate-member' ) ),
|
804 |
+
'password-reset' => array( 'title' => __( 'Password Reset', 'ultimate-member' ) ),
|
805 |
+
) );
|
806 |
+
}
|
807 |
+
//end class
|
808 |
+
}
|
809 |
+
}
|
includes/class-functions.php
CHANGED
@@ -1,395 +1,410 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
-
|
3 |
-
|
4 |
-
if ( ! class_exists( 'UM_Functions' ) ) {
|
5 |
-
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Class UM_Functions
|
9 |
-
*/
|
10 |
-
class UM_Functions {
|
11 |
-
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Store URL
|
15 |
-
*
|
16 |
-
* @var string
|
17 |
-
*/
|
18 |
-
var $store_url = 'https://ultimatemember.com/';
|
19 |
-
|
20 |
-
|
21 |
-
/**
|
22 |
-
* WP remote Post timeout
|
23 |
-
* @var int
|
24 |
-
*/
|
25 |
-
var $request_timeout = 60;
|
26 |
-
|
27 |
-
|
28 |
-
/**
|
29 |
-
* UM_Functions constructor.
|
30 |
-
*/
|
31 |
-
function __construct() {
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Check if AJAX now
|
37 |
-
*
|
38 |
-
* @return bool
|
39 |
-
*/
|
40 |
-
function is_ajax() {
|
41 |
-
return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : defined( 'DOING_AJAX' );
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Check frontend nonce
|
47 |
-
*
|
48 |
-
* @param bool $action
|
49 |
-
*/
|
50 |
-
function check_ajax_nonce( $action = false ) {
|
51 |
-
$nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( $_REQUEST['nonce'] ) : '';
|
52 |
-
$action = empty( $action ) ? 'um-frontend-nonce' : $action;
|
53 |
-
|
54 |
-
if ( ! wp_verify_nonce( $nonce, $action ) ) {
|
55 |
-
wp_send_json_error( esc_js( __( 'Wrong Nonce', 'ultimate-member' ) ) );
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
/**
|
61 |
-
* What type of request is this?
|
62 |
-
*
|
63 |
-
* @param string $type String containing name of request type (ajax, frontend, cron or admin)
|
64 |
-
*
|
65 |
-
* @return bool
|
66 |
-
*/
|
67 |
-
public function is_request( $type ) {
|
68 |
-
switch ( $type ) {
|
69 |
-
case 'admin' :
|
70 |
-
return is_admin();
|
71 |
-
case 'ajax' :
|
72 |
-
return defined( 'DOING_AJAX' );
|
73 |
-
case 'cron' :
|
74 |
-
return defined( 'DOING_CRON' );
|
75 |
-
case 'frontend' :
|
76 |
-
return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
|
77 |
-
}
|
78 |
-
|
79 |
-
return false;
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
/**
|
84 |
-
* Help Tip displaying
|
85 |
-
*
|
86 |
-
* Function for render/displaying UltimateMember help tip
|
87 |
-
*
|
88 |
-
* @since 2.0.0
|
89 |
-
*
|
90 |
-
* @param string $tip Help tip text
|
91 |
-
* @param bool $allow_html Allow sanitized HTML if true or escape
|
92 |
-
* @param bool $echo Return HTML or echo
|
93 |
-
* @return string
|
94 |
-
*/
|
95 |
-
function tooltip( $tip, $allow_html = false, $echo = true ) {
|
96 |
-
if ( $allow_html ) {
|
97 |
-
|
98 |
-
$tip = htmlspecialchars( wp_kses( html_entity_decode( $tip ), array(
|
99 |
-
'br' => array(),
|
100 |
-
'em' => array(),
|
101 |
-
'strong' => array(),
|
102 |
-
'small' => array(),
|
103 |
-
'span' => array(),
|
104 |
-
'ul' => array(),
|
105 |
-
'li' => array(),
|
106 |
-
'ol' => array(),
|
107 |
-
'p' => array(),
|
108 |
-
) ) );
|
109 |
-
|
110 |
-
} else {
|
111 |
-
$tip = esc_attr( $tip );
|
112 |
-
}
|
113 |
-
|
114 |
-
ob_start(); ?>
|
115 |
-
|
116 |
-
<span class="um_tooltip dashicons dashicons-editor-help" title="<?php echo $tip ?>"></span>
|
117 |
-
|
118 |
-
<?php if ( $echo ) {
|
119 |
-
ob_get_flush();
|
120 |
-
return '';
|
121 |
-
} else {
|
122 |
-
return ob_get_clean();
|
123 |
-
}
|
124 |
-
|
125 |
-
}
|
126 |
-
|
127 |
-
|
128 |
-
/**
|
129 |
-
* @return mixed|void
|
130 |
-
*/
|
131 |
-
function excluded_taxonomies() {
|
132 |
-
$taxes = array(
|
133 |
-
'nav_menu',
|
134 |
-
'link_category',
|
135 |
-
'post_format',
|
136 |
-
);
|
137 |
-
|
138 |
-
/**
|
139 |
-
* UM hook
|
140 |
-
*
|
141 |
-
* @type filter
|
142 |
-
* @title um_excluded_taxonomies
|
143 |
-
* @description Exclude taxonomies for UM
|
144 |
-
* @input_vars
|
145 |
-
* [{"var":"$taxes","type":"array","desc":"Taxonomies keys"}]
|
146 |
-
* @change_log
|
147 |
-
* ["Since: 2.0"]
|
148 |
-
* @usage
|
149 |
-
* <?php add_filter( 'um_excluded_taxonomies', 'function_name', 10, 1 ); ?>
|
150 |
-
* @example
|
151 |
-
* <?php
|
152 |
-
* add_filter( 'um_excluded_taxonomies', 'my_excluded_taxonomies', 10, 1 );
|
153 |
-
* function my_excluded_taxonomies( $taxes ) {
|
154 |
-
* // your code here
|
155 |
-
* return $taxes;
|
156 |
-
* }
|
157 |
-
* ?>
|
158 |
-
*/
|
159 |
-
return apply_filters( 'um_excluded_taxonomies', $taxes );
|
160 |
-
}
|
161 |
-
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Output templates
|
165 |
-
*
|
166 |
-
* @access public
|
167 |
-
* @param string $template_name
|
168 |
-
* @param string $basename (default: '')
|
169 |
-
* @param array $t_args (default: array())
|
170 |
-
* @param bool $echo
|
171 |
-
*
|
172 |
-
* @return string|void
|
173 |
-
*/
|
174 |
-
function get_template( $template_name, $basename = '', $t_args = array(), $echo = false ) {
|
175 |
-
if ( ! empty( $t_args ) && is_array( $t_args ) ) {
|
176 |
-
extract( $t_args );
|
177 |
-
}
|
178 |
-
|
179 |
-
$path = '';
|
180 |
-
if ( $basename ) {
|
181 |
-
// use '/' instead of "DIRECTORY_SEPARATOR", because wp_normalize_path makes the correct replace
|
182 |
-
$array = explode( '/', wp_normalize_path( trim( $basename ) ) );
|
183 |
-
$path = $array[0];
|
184 |
-
}
|
185 |
-
|
186 |
-
$located = $this->locate_template( $template_name, $path );
|
187 |
-
if ( ! file_exists( $located ) ) {
|
188 |
-
_doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $located ), '2.1' );
|
189 |
-
return;
|
190 |
-
}
|
191 |
-
|
192 |
-
|
193 |
-
/**
|
194 |
-
* UM hook
|
195 |
-
*
|
196 |
-
* @type filter
|
197 |
-
* @title um_get_template
|
198 |
-
* @description Change template location
|
199 |
-
* @input_vars
|
200 |
-
* [{"var":"$located","type":"string","desc":"template Located"},
|
201 |
-
* {"var":"$template_name","type":"string","desc":"Template Name"},
|
202 |
-
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
203 |
-
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
204 |
-
* @change_log
|
205 |
-
* ["Since: 2.0"]
|
206 |
-
* @usage add_filter( 'um_get_template', 'function_name', 10, 4 );
|
207 |
-
* @example
|
208 |
-
* <?php
|
209 |
-
* add_filter( 'um_get_template', 'my_get_template', 10, 4 );
|
210 |
-
* function my_get_template( $located, $template_name, $path, $t_args ) {
|
211 |
-
* // your code here
|
212 |
-
* return $located;
|
213 |
-
* }
|
214 |
-
* ?>
|
215 |
-
*/
|
216 |
-
$located = apply_filters( 'um_get_template', $located, $template_name, $path, $t_args );
|
217 |
-
|
218 |
-
ob_start();
|
219 |
-
|
220 |
-
/**
|
221 |
-
* UM hook
|
222 |
-
*
|
223 |
-
* @type action
|
224 |
-
* @title um_before_template_part
|
225 |
-
* @description Make some action before include template file
|
226 |
-
* @input_vars
|
227 |
-
* [{"var":"$template_name","type":"string","desc":"Template Name"},
|
228 |
-
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
229 |
-
* {"var":"$located","type":"string","desc":"template Located"},
|
230 |
-
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
231 |
-
* @change_log
|
232 |
-
* ["Since: 2.0"]
|
233 |
-
* @usage add_action( 'um_before_template_part', 'function_name', 10, 4 );
|
234 |
-
* @example
|
235 |
-
* <?php
|
236 |
-
* add_action( 'um_before_template_part', 'my_before_template_part', 10, 4 );
|
237 |
-
* function my_before_template_part( $template_name, $path, $located, $t_args ) {
|
238 |
-
* // your code here
|
239 |
-
* }
|
240 |
-
* ?>
|
241 |
-
*/
|
242 |
-
do_action( 'um_before_template_part', $template_name, $path, $located, $t_args );
|
243 |
-
include( $located );
|
244 |
-
|
245 |
-
/**
|
246 |
-
* UM hook
|
247 |
-
*
|
248 |
-
* @type action
|
249 |
-
* @title um_after_template_part
|
250 |
-
* @description Make some action after include template file
|
251 |
-
* @input_vars
|
252 |
-
* [{"var":"$template_name","type":"string","desc":"Template Name"},
|
253 |
-
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
254 |
-
* {"var":"$located","type":"string","desc":"template Located"},
|
255 |
-
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
256 |
-
* @change_log
|
257 |
-
* ["Since: 2.0"]
|
258 |
-
* @usage add_action( 'um_after_template_part', 'function_name', 10, 4 );
|
259 |
-
* @example
|
260 |
-
* <?php
|
261 |
-
* add_action( 'um_after_template_part', 'my_after_template_part', 10, 4 );
|
262 |
-
* function my_after_template_part( $template_name, $path, $located, $t_args ) {
|
263 |
-
* // your code here
|
264 |
-
* }
|
265 |
-
* ?>
|
266 |
-
*/
|
267 |
-
do_action( 'um_after_template_part', $template_name, $path, $located, $t_args );
|
268 |
-
$html = ob_get_clean();
|
269 |
-
|
270 |
-
if ( ! $echo ) {
|
271 |
-
return $html;
|
272 |
-
} else {
|
273 |
-
echo $html;
|
274 |
-
return;
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
|
279 |
-
/**
|
280 |
-
* Locate a template and return the path for inclusion.
|
281 |
-
*
|
282 |
-
* @access public
|
283 |
-
* @param string $template_name
|
284 |
-
* @param string $path (default: '')
|
285 |
-
* @return string
|
286 |
-
*/
|
287 |
-
function locate_template( $template_name, $path = '' ) {
|
288 |
-
// check if there is template at theme folder
|
289 |
-
$template = locate_template( array(
|
290 |
-
trailingslashit( 'ultimate-member' . DIRECTORY_SEPARATOR . $path ) . $template_name
|
291 |
-
) );
|
292 |
-
|
293 |
-
if ( ! $template ) {
|
294 |
-
if ( $path ) {
|
295 |
-
$template = trailingslashit( trailingslashit( WP_PLUGIN_DIR ) . $path );
|
296 |
-
} else {
|
297 |
-
$template = trailingslashit( um_path );
|
298 |
-
}
|
299 |
-
$template .= 'templates' . DIRECTORY_SEPARATOR . $template_name;
|
300 |
-
}
|
301 |
-
|
302 |
-
|
303 |
-
/**
|
304 |
-
* UM hook
|
305 |
-
*
|
306 |
-
* @type filter
|
307 |
-
* @title um_locate_template
|
308 |
-
* @description Change template locate
|
309 |
-
* @input_vars
|
310 |
-
* [{"var":"$template","type":"string","desc":"Template locate"},
|
311 |
-
* {"var":"$template_name","type":"string","desc":"Template Name"},
|
312 |
-
* {"var":"$path","type":"string","desc":"Template Path at server"}]
|
313 |
-
* @change_log
|
314 |
-
* ["Since: 2.0"]
|
315 |
-
* @usage add_filter( 'um_locate_template', 'function_name', 10, 3 );
|
316 |
-
* @example
|
317 |
-
* <?php
|
318 |
-
* add_filter( 'um_locate_template', 'my_locate_template', 10, 3 );
|
319 |
-
* function my_locate_template( $template, $template_name, $path ) {
|
320 |
-
* // your code here
|
321 |
-
* return $template;
|
322 |
-
* }
|
323 |
-
* ?>
|
324 |
-
*/
|
325 |
-
return apply_filters( 'um_locate_template', $template, $template_name, $path );
|
326 |
-
}
|
327 |
-
|
328 |
-
|
329 |
-
/**
|
330 |
-
* @return mixed|void
|
331 |
-
*/
|
332 |
-
function cpt_list() {
|
333 |
-
/**
|
334 |
-
* UM hook
|
335 |
-
*
|
336 |
-
* @type filter
|
337 |
-
* @title um_cpt_list
|
338 |
-
* @description Extend UM Custom Post Types
|
339 |
-
* @input_vars
|
340 |
-
* [{"var":"$list","type":"array","desc":"Custom Post Types list"}]
|
341 |
-
* @change_log
|
342 |
-
* ["Since: 2.0"]
|
343 |
-
* @usage
|
344 |
-
* <?php add_filter( 'um_cpt_list', 'function_name', 10, 1 ); ?>
|
345 |
-
* @example
|
346 |
-
* <?php
|
347 |
-
* add_filter( 'um_cpt_list', 'my_cpt_list', 10, 1 );
|
348 |
-
* function my_admin_pending_queue( $list ) {
|
349 |
-
* // your code here
|
350 |
-
* return $list;
|
351 |
-
* }
|
352 |
-
* ?>
|
353 |
-
*/
|
354 |
-
$cpt = apply_filters( 'um_cpt_list', array( 'um_form', 'um_directory' ) );
|
355 |
-
return $cpt;
|
356 |
-
}
|
357 |
-
|
358 |
-
|
359 |
-
/**
|
360 |
-
* @param array $array
|
361 |
-
* @param string $key
|
362 |
-
* @param array $insert_array
|
363 |
-
*
|
364 |
-
* @return array
|
365 |
-
*/
|
366 |
-
function array_insert_before( $array, $key, $insert_array ) {
|
367 |
-
$index = array_search( $key, array_keys( $array ) );
|
368 |
-
if ( $index === false ) {
|
369 |
-
return $array;
|
370 |
-
}
|
371 |
-
|
372 |
-
$array = array_slice( $array, 0, $index, true ) +
|
373 |
-
$insert_array +
|
374 |
-
array_slice( $array, $index, count( $array ) - 1, true );
|
375 |
-
|
376 |
-
return $array;
|
377 |
-
}
|
378 |
-
|
379 |
-
|
380 |
-
/**
|
381 |
-
* @since 2.1.0
|
382 |
-
*
|
383 |
-
* @param $var
|
384 |
-
* @return array|string
|
385 |
-
*/
|
386 |
-
function clean_array( $var ) {
|
387 |
-
if ( is_array( $var ) ) {
|
388 |
-
return array_map( array( $this, 'clean_array' ), $var );
|
389 |
-
} else {
|
390 |
-
return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
|
391 |
-
}
|
392 |
-
}
|
393 |
-
|
394 |
-
|
395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
2 |
+
|
3 |
+
|
4 |
+
if ( ! class_exists( 'UM_Functions' ) ) {
|
5 |
+
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class UM_Functions
|
9 |
+
*/
|
10 |
+
class UM_Functions {
|
11 |
+
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Store URL
|
15 |
+
*
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
var $store_url = 'https://ultimatemember.com/';
|
19 |
+
|
20 |
+
|
21 |
+
/**
|
22 |
+
* WP remote Post timeout
|
23 |
+
* @var int
|
24 |
+
*/
|
25 |
+
var $request_timeout = 60;
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* UM_Functions constructor.
|
30 |
+
*/
|
31 |
+
function __construct() {
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Check if AJAX now
|
37 |
+
*
|
38 |
+
* @return bool
|
39 |
+
*/
|
40 |
+
function is_ajax() {
|
41 |
+
return function_exists( 'wp_doing_ajax' ) ? wp_doing_ajax() : defined( 'DOING_AJAX' );
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Check frontend nonce
|
47 |
+
*
|
48 |
+
* @param bool $action
|
49 |
+
*/
|
50 |
+
function check_ajax_nonce( $action = false ) {
|
51 |
+
$nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( $_REQUEST['nonce'] ) : '';
|
52 |
+
$action = empty( $action ) ? 'um-frontend-nonce' : $action;
|
53 |
+
|
54 |
+
if ( ! wp_verify_nonce( $nonce, $action ) ) {
|
55 |
+
wp_send_json_error( esc_js( __( 'Wrong Nonce', 'ultimate-member' ) ) );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
/**
|
61 |
+
* What type of request is this?
|
62 |
+
*
|
63 |
+
* @param string $type String containing name of request type (ajax, frontend, cron or admin)
|
64 |
+
*
|
65 |
+
* @return bool
|
66 |
+
*/
|
67 |
+
public function is_request( $type ) {
|
68 |
+
switch ( $type ) {
|
69 |
+
case 'admin' :
|
70 |
+
return is_admin();
|
71 |
+
case 'ajax' :
|
72 |
+
return defined( 'DOING_AJAX' );
|
73 |
+
case 'cron' :
|
74 |
+
return defined( 'DOING_CRON' );
|
75 |
+
case 'frontend' :
|
76 |
+
return ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' );
|
77 |
+
}
|
78 |
+
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Help Tip displaying
|
85 |
+
*
|
86 |
+
* Function for render/displaying UltimateMember help tip
|
87 |
+
*
|
88 |
+
* @since 2.0.0
|
89 |
+
*
|
90 |
+
* @param string $tip Help tip text
|
91 |
+
* @param bool $allow_html Allow sanitized HTML if true or escape
|
92 |
+
* @param bool $echo Return HTML or echo
|
93 |
+
* @return string
|
94 |
+
*/
|
95 |
+
function tooltip( $tip, $allow_html = false, $echo = true ) {
|
96 |
+
if ( $allow_html ) {
|
97 |
+
|
98 |
+
$tip = htmlspecialchars( wp_kses( html_entity_decode( $tip ), array(
|
99 |
+
'br' => array(),
|
100 |
+
'em' => array(),
|
101 |
+
'strong' => array(),
|
102 |
+
'small' => array(),
|
103 |
+
'span' => array(),
|
104 |
+
'ul' => array(),
|
105 |
+
'li' => array(),
|
106 |
+
'ol' => array(),
|
107 |
+
'p' => array(),
|
108 |
+
) ) );
|
109 |
+
|
110 |
+
} else {
|
111 |
+
$tip = esc_attr( $tip );
|
112 |
+
}
|
113 |
+
|
114 |
+
ob_start(); ?>
|
115 |
+
|
116 |
+
<span class="um_tooltip dashicons dashicons-editor-help" title="<?php echo $tip ?>"></span>
|
117 |
+
|
118 |
+
<?php if ( $echo ) {
|
119 |
+
ob_get_flush();
|
120 |
+
return '';
|
121 |
+
} else {
|
122 |
+
return ob_get_clean();
|
123 |
+
}
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @return mixed|void
|
130 |
+
*/
|
131 |
+
function excluded_taxonomies() {
|
132 |
+
$taxes = array(
|
133 |
+
'nav_menu',
|
134 |
+
'link_category',
|
135 |
+
'post_format',
|
136 |
+
);
|
137 |
+
|
138 |
+
/**
|
139 |
+
* UM hook
|
140 |
+
*
|
141 |
+
* @type filter
|
142 |
+
* @title um_excluded_taxonomies
|
143 |
+
* @description Exclude taxonomies for UM
|
144 |
+
* @input_vars
|
145 |
+
* [{"var":"$taxes","type":"array","desc":"Taxonomies keys"}]
|
146 |
+
* @change_log
|
147 |
+
* ["Since: 2.0"]
|
148 |
+
* @usage
|
149 |
+
* <?php add_filter( 'um_excluded_taxonomies', 'function_name', 10, 1 ); ?>
|
150 |
+
* @example
|
151 |
+
* <?php
|
152 |
+
* add_filter( 'um_excluded_taxonomies', 'my_excluded_taxonomies', 10, 1 );
|
153 |
+
* function my_excluded_taxonomies( $taxes ) {
|
154 |
+
* // your code here
|
155 |
+
* return $taxes;
|
156 |
+
* }
|
157 |
+
* ?>
|
158 |
+
*/
|
159 |
+
return apply_filters( 'um_excluded_taxonomies', $taxes );
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Output templates
|
165 |
+
*
|
166 |
+
* @access public
|
167 |
+
* @param string $template_name
|
168 |
+
* @param string $basename (default: '')
|
169 |
+
* @param array $t_args (default: array())
|
170 |
+
* @param bool $echo
|
171 |
+
*
|
172 |
+
* @return string|void
|
173 |
+
*/
|
174 |
+
function get_template( $template_name, $basename = '', $t_args = array(), $echo = false ) {
|
175 |
+
if ( ! empty( $t_args ) && is_array( $t_args ) ) {
|
176 |
+
extract( $t_args );
|
177 |
+
}
|
178 |
+
|
179 |
+
$path = '';
|
180 |
+
if ( $basename ) {
|
181 |
+
// use '/' instead of "DIRECTORY_SEPARATOR", because wp_normalize_path makes the correct replace
|
182 |
+
$array = explode( '/', wp_normalize_path( trim( $basename ) ) );
|
183 |
+
$path = $array[0];
|
184 |
+
}
|
185 |
+
|
186 |
+
$located = $this->locate_template( $template_name, $path );
|
187 |
+
if ( ! file_exists( $located ) ) {
|
188 |
+
_doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $located ), '2.1' );
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
/**
|
194 |
+
* UM hook
|
195 |
+
*
|
196 |
+
* @type filter
|
197 |
+
* @title um_get_template
|
198 |
+
* @description Change template location
|
199 |
+
* @input_vars
|
200 |
+
* [{"var":"$located","type":"string","desc":"template Located"},
|
201 |
+
* {"var":"$template_name","type":"string","desc":"Template Name"},
|
202 |
+
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
203 |
+
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
204 |
+
* @change_log
|
205 |
+
* ["Since: 2.0"]
|
206 |
+
* @usage add_filter( 'um_get_template', 'function_name', 10, 4 );
|
207 |
+
* @example
|
208 |
+
* <?php
|
209 |
+
* add_filter( 'um_get_template', 'my_get_template', 10, 4 );
|
210 |
+
* function my_get_template( $located, $template_name, $path, $t_args ) {
|
211 |
+
* // your code here
|
212 |
+
* return $located;
|
213 |
+
* }
|
214 |
+
* ?>
|
215 |
+
*/
|
216 |
+
$located = apply_filters( 'um_get_template', $located, $template_name, $path, $t_args );
|
217 |
+
|
218 |
+
ob_start();
|
219 |
+
|
220 |
+
/**
|
221 |
+
* UM hook
|
222 |
+
*
|
223 |
+
* @type action
|
224 |
+
* @title um_before_template_part
|
225 |
+
* @description Make some action before include template file
|
226 |
+
* @input_vars
|
227 |
+
* [{"var":"$template_name","type":"string","desc":"Template Name"},
|
228 |
+
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
229 |
+
* {"var":"$located","type":"string","desc":"template Located"},
|
230 |
+
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
231 |
+
* @change_log
|
232 |
+
* ["Since: 2.0"]
|
233 |
+
* @usage add_action( 'um_before_template_part', 'function_name', 10, 4 );
|
234 |
+
* @example
|
235 |
+
* <?php
|
236 |
+
* add_action( 'um_before_template_part', 'my_before_template_part', 10, 4 );
|
237 |
+
* function my_before_template_part( $template_name, $path, $located, $t_args ) {
|
238 |
+
* // your code here
|
239 |
+
* }
|
240 |
+
* ?>
|
241 |
+
*/
|
242 |
+
do_action( 'um_before_template_part', $template_name, $path, $located, $t_args );
|
243 |
+
include( $located );
|
244 |
+
|
245 |
+
/**
|
246 |
+
* UM hook
|
247 |
+
*
|
248 |
+
* @type action
|
249 |
+
* @title um_after_template_part
|
250 |
+
* @description Make some action after include template file
|
251 |
+
* @input_vars
|
252 |
+
* [{"var":"$template_name","type":"string","desc":"Template Name"},
|
253 |
+
* {"var":"$path","type":"string","desc":"Template Path at server"},
|
254 |
+
* {"var":"$located","type":"string","desc":"template Located"},
|
255 |
+
* {"var":"$t_args","type":"array","desc":"Template Arguments"}]
|
256 |
+
* @change_log
|
257 |
+
* ["Since: 2.0"]
|
258 |
+
* @usage add_action( 'um_after_template_part', 'function_name', 10, 4 );
|
259 |
+
* @example
|
260 |
+
* <?php
|
261 |
+
* add_action( 'um_after_template_part', 'my_after_template_part', 10, 4 );
|
262 |
+
* function my_after_template_part( $template_name, $path, $located, $t_args ) {
|
263 |
+
* // your code here
|
264 |
+
* }
|
265 |
+
* ?>
|
266 |
+
*/
|
267 |
+
do_action( 'um_after_template_part', $template_name, $path, $located, $t_args );
|
268 |
+
$html = ob_get_clean();
|
269 |
+
|
270 |
+
if ( ! $echo ) {
|
271 |
+
return $html;
|
272 |
+
} else {
|
273 |
+
echo $html;
|
274 |
+
return;
|
275 |
+
}
|
276 |
+
}
|
277 |
+
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Locate a template and return the path for inclusion.
|
281 |
+
*
|
282 |
+
* @access public
|
283 |
+
* @param string $template_name
|
284 |
+
* @param string $path (default: '')
|
285 |
+
* @return string
|
286 |
+
*/
|
287 |
+
function locate_template( $template_name, $path = '' ) {
|
288 |
+
// check if there is template at theme folder
|
289 |
+
$template = locate_template( array(
|
290 |
+
trailingslashit( 'ultimate-member' . DIRECTORY_SEPARATOR . $path ) . $template_name
|
291 |
+
) );
|
292 |
+
|
293 |
+
if ( ! $template ) {
|
294 |
+
if ( $path ) {
|
295 |
+
$template = trailingslashit( trailingslashit( WP_PLUGIN_DIR ) . $path );
|
296 |
+
} else {
|
297 |
+
$template = trailingslashit( um_path );
|
298 |
+
}
|
299 |
+
$template .= 'templates' . DIRECTORY_SEPARATOR . $template_name;
|
300 |
+
}
|
301 |
+
|
302 |
+
|
303 |
+
/**
|
304 |
+
* UM hook
|
305 |
+
*
|
306 |
+
* @type filter
|
307 |
+
* @title um_locate_template
|
308 |
+
* @description Change template locate
|
309 |
+
* @input_vars
|
310 |
+
* [{"var":"$template","type":"string","desc":"Template locate"},
|
311 |
+
* {"var":"$template_name","type":"string","desc":"Template Name"},
|
312 |
+
* {"var":"$path","type":"string","desc":"Template Path at server"}]
|
313 |
+
* @change_log
|
314 |
+
* ["Since: 2.0"]
|
315 |
+
* @usage add_filter( 'um_locate_template', 'function_name', 10, 3 );
|
316 |
+
* @example
|
317 |
+
* <?php
|
318 |
+
* add_filter( 'um_locate_template', 'my_locate_template', 10, 3 );
|
319 |
+
* function my_locate_template( $template, $template_name, $path ) {
|
320 |
+
* // your code here
|
321 |
+
* return $template;
|
322 |
+
* }
|
323 |
+
* ?>
|
324 |
+
*/
|
325 |
+
return apply_filters( 'um_locate_template', $template, $template_name, $path );
|
326 |
+
}
|
327 |
+
|
328 |
+
|
329 |
+
/**
|
330 |
+
* @return mixed|void
|
331 |
+
*/
|
332 |
+
function cpt_list() {
|
333 |
+
/**
|
334 |
+
* UM hook
|
335 |
+
*
|
336 |
+
* @type filter
|
337 |
+
* @title um_cpt_list
|
338 |
+
* @description Extend UM Custom Post Types
|
339 |
+
* @input_vars
|
340 |
+
* [{"var":"$list","type":"array","desc":"Custom Post Types list"}]
|
341 |
+
* @change_log
|
342 |
+
* ["Since: 2.0"]
|
343 |
+
* @usage
|
344 |
+
* <?php add_filter( 'um_cpt_list', 'function_name', 10, 1 ); ?>
|
345 |
+
* @example
|
346 |
+
* <?php
|
347 |
+
* add_filter( 'um_cpt_list', 'my_cpt_list', 10, 1 );
|
348 |
+
* function my_admin_pending_queue( $list ) {
|
349 |
+
* // your code here
|
350 |
+
* return $list;
|
351 |
+
* }
|
352 |
+
* ?>
|
353 |
+
*/
|
354 |
+
$cpt = apply_filters( 'um_cpt_list', array( 'um_form', 'um_directory' ) );
|
355 |
+
return $cpt;
|
356 |
+
}
|
357 |
+
|
358 |
+
|
359 |
+
/**
|
360 |
+
* @param array $array
|
361 |
+
* @param string $key
|
362 |
+
* @param array $insert_array
|
363 |
+
*
|
364 |
+
* @return array
|
365 |
+
*/
|
366 |
+
function array_insert_before( $array, $key, $insert_array ) {
|
367 |
+
$index = array_search( $key, array_keys( $array ) );
|
368 |
+
if ( $index === false ) {
|
369 |
+
return $array;
|
370 |
+
}
|
371 |
+
|
372 |
+
$array = array_slice( $array, 0, $index, true ) +
|
373 |
+
$insert_array +
|
374 |
+
array_slice( $array, $index, count( $array ) - 1, true );
|
375 |
+
|
376 |
+
return $array;
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
+
/**
|
381 |
+
* @since 2.1.0
|
382 |
+
*
|
383 |
+
* @param $var
|
384 |
+
* @return array|string
|
385 |
+
*/
|
386 |
+
function clean_array( $var ) {
|
387 |
+
if ( is_array( $var ) ) {
|
388 |
+
return array_map( array( $this, 'clean_array' ), $var );
|
389 |
+
} else {
|
390 |
+
return is_scalar( $var ) ? sanitize_text_field( $var ) : $var;
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Replace the first match in the string, alternative for the `str_replace()` function
|
397 |
+
*
|
398 |
+
* @param string $search
|
399 |
+
* @param string $replace
|
400 |
+
* @param string $subject
|
401 |
+
*
|
402 |
+
* @return string
|
403 |
+
*/
|
404 |
+
function str_replace_first( $search, $replace, $subject ) {
|
405 |
+
$search = '/' . preg_quote( $search, '/' ) . '/';
|
406 |
+
return preg_replace( $search, $replace, $subject, 1 );
|
407 |
+
}
|
408 |
+
|
409 |
+
}
|
410 |
+
}
|
includes/core/class-access.php
CHANGED
@@ -127,7 +127,6 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
127 |
remove_action( 'pre_get_posts', array( &$this, 'exclude_posts' ), 99 );
|
128 |
remove_filter( 'posts_where', array( &$this, 'exclude_posts_where' ), 10 );
|
129 |
remove_filter( 'wp_count_posts', array( &$this, 'custom_count_posts_handler' ), 99 );
|
130 |
-
remove_filter( 'the_title', array( &$this, 'filter_restricted_post_title' ), 10 );
|
131 |
}
|
132 |
|
133 |
|
@@ -1131,8 +1130,8 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
1131 |
continue;
|
1132 |
} else {
|
1133 |
$restriction_settings = $this->get_post_privacy_settings( $menu_item->object_id );
|
1134 |
-
if ( UM()->options()->get( 'disable_restriction_pre_queries' )
|
1135 |
-
$filtered_items[] = $menu_item;
|
1136 |
continue;
|
1137 |
}
|
1138 |
}
|
@@ -1270,6 +1269,36 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
1270 |
}
|
1271 |
|
1272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1273 |
/**
|
1274 |
* Protect Post Types in query
|
1275 |
* Restrict content new logic
|
@@ -1379,7 +1408,7 @@ if ( ! class_exists( 'um\core\Access' ) ) {
|
|
1379 |
}
|
1380 |
}
|
1381 |
} else {
|
1382 |
-
if ( UM()->options()->get( 'disable_restriction_pre_queries' )
|
1383 |
$filtered_posts[] = $this->maybe_replace_title( $post );
|
1384 |
continue;
|
1385 |
}
|
127 |
remove_action( 'pre_get_posts', array( &$this, 'exclude_posts' ), 99 );
|
128 |
remove_filter( 'posts_where', array( &$this, 'exclude_posts_where' ), 10 );
|
129 |
remove_filter( 'wp_count_posts', array( &$this, 'custom_count_posts_handler' ), 99 );
|
|
|
130 |
}
|
131 |
|
132 |
|
1130 |
continue;
|
1131 |
} else {
|
1132 |
$restriction_settings = $this->get_post_privacy_settings( $menu_item->object_id );
|
1133 |
+
if ( empty( $restriction_settings['_um_access_hide_from_queries'] ) || ! UM()->options()->get( 'disable_restriction_pre_queries' ) ) {
|
1134 |
+
$filtered_items[] = $this->maybe_replace_nav_menu_title( $menu_item );
|
1135 |
continue;
|
1136 |
}
|
1137 |
}
|
1269 |
}
|
1270 |
|
1271 |
|
1272 |
+
/**
|
1273 |
+
* @param \WP_Post $nav_item
|
1274 |
+
*
|
1275 |
+
* @return \WP_Post
|
1276 |
+
*/
|
1277 |
+
function maybe_replace_nav_menu_title( $nav_item ) {
|
1278 |
+
if ( ! UM()->options()->get( 'restricted_post_title_replace' ) ) {
|
1279 |
+
return $nav_item;
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
if ( current_user_can( 'administrator' ) ) {
|
1283 |
+
return $nav_item;
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
if ( ! is_a( $nav_item, '\WP_Post' ) ) {
|
1287 |
+
return $nav_item;
|
1288 |
+
}
|
1289 |
+
|
1290 |
+
$ignore = apply_filters( 'um_ignore_restricted_title', false, $nav_item->ID );
|
1291 |
+
if ( $ignore ) {
|
1292 |
+
return $nav_item;
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
$restricted_global_title = UM()->options()->get( 'restricted_access_post_title' );
|
1296 |
+
$nav_item->title = stripslashes( $restricted_global_title );
|
1297 |
+
|
1298 |
+
return $nav_item;
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
|
1302 |
/**
|
1303 |
* Protect Post Types in query
|
1304 |
* Restrict content new logic
|
1408 |
}
|
1409 |
}
|
1410 |
} else {
|
1411 |
+
if ( empty( $restriction['_um_access_hide_from_queries'] ) || ! UM()->options()->get( 'disable_restriction_pre_queries' ) ) {
|
1412 |
$filtered_posts[] = $this->maybe_replace_title( $post );
|
1413 |
continue;
|
1414 |
}
|
includes/core/class-builtin.php
CHANGED
@@ -1,1917 +1,1917 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\core;
|
3 |
-
|
4 |
-
// Exit if accessed directly
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
if ( ! class_exists( 'um\core\Builtin' ) ) {
|
8 |
-
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Class Builtin
|
12 |
-
* @package um\core
|
13 |
-
*/
|
14 |
-
class Builtin {
|
15 |
-
|
16 |
-
|
17 |
-
/**
|
18 |
-
* @var array
|
19 |
-
*/
|
20 |
-
public $predefined_fields = array();
|
21 |
-
|
22 |
-
|
23 |
-
/**
|
24 |
-
* @var array
|
25 |
-
*/
|
26 |
-
var $all_user_fields = array();
|
27 |
-
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var array
|
31 |
-
*/
|
32 |
-
var $core_fields = array();
|
33 |
-
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Builtin constructor.
|
37 |
-
*/
|
38 |
-
function __construct() {
|
39 |
-
add_action( 'init', array( &$this, 'set_core_fields' ), 1 );
|
40 |
-
add_action( 'init', array( &$this, 'set_predefined_fields' ), 1 );
|
41 |
-
add_action( 'init', array( &$this, 'set_custom_fields' ), 1 );
|
42 |
-
$this->saved_fields = get_option( 'um_fields' );
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
/**
|
47 |
-
* @return array
|
48 |
-
*/
|
49 |
-
function get_all_user_fields() {
|
50 |
-
return apply_filters( 'um_builtin_all_user_fields', $this->all_user_fields );
|
51 |
-
}
|
52 |
-
|
53 |
-
|
54 |
-
/**
|
55 |
-
* Regular or multi-select/options
|
56 |
-
*
|
57 |
-
* @param $field
|
58 |
-
* @param $attrs
|
59 |
-
*
|
60 |
-
* @return bool
|
61 |
-
*/
|
62 |
-
function is_dropdown_field( $field, $attrs ) {
|
63 |
-
|
64 |
-
if ( isset( $attrs['options'] ) ) {
|
65 |
-
return true;
|
66 |
-
}
|
67 |
-
|
68 |
-
$fields = $this->all_user_fields;
|
69 |
-
|
70 |
-
if ( isset( $fields[$field]['options'] ) || ! empty( $fields[$field]['custom_dropdown_options_source'] ) ) {
|
71 |
-
return true;
|
72 |
-
}
|
73 |
-
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Get a field
|
80 |
-
*
|
81 |
-
* @param $field
|
82 |
-
*
|
83 |
-
* @return mixed|string
|
84 |
-
*/
|
85 |
-
function get_a_field( $field ) {
|
86 |
-
$fields = $this->all_user_fields;
|
87 |
-
if ( isset( $fields[ $field ] ) ) {
|
88 |
-
return $fields[ $field ];
|
89 |
-
}
|
90 |
-
return '';
|
91 |
-
}
|
92 |
-
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Get specific fields
|
96 |
-
*
|
97 |
-
* @param $fields
|
98 |
-
*
|
99 |
-
* @return array
|
100 |
-
*/
|
101 |
-
function get_specific_fields( $fields ) {
|
102 |
-
$fields = explode( ',', $fields );
|
103 |
-
$array = array();
|
104 |
-
foreach ( $fields as $field ) {
|
105 |
-
if ( isset( $this->predefined_fields[ $field ] ) ) {
|
106 |
-
$array[ $field ] = $this->predefined_fields[ $field ];
|
107 |
-
}
|
108 |
-
}
|
109 |
-
return $array;
|
110 |
-
}
|
111 |
-
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Get specific field
|
115 |
-
*
|
116 |
-
* @param $fields
|
117 |
-
*
|
118 |
-
* @return array|mixed
|
119 |
-
*/
|
120 |
-
function get_specific_field( $fields ) {
|
121 |
-
$fields = explode( ',', $fields );
|
122 |
-
$array = array();
|
123 |
-
foreach ( $fields as $field ) {
|
124 |
-
if ( isset( $this->predefined_fields[ $field ] ) ) {
|
125 |
-
$array = $this->predefined_fields[ $field ];
|
126 |
-
} elseif ( isset( $this->saved_fields[ $field ] ) ) {
|
127 |
-
$array = $this->saved_fields[ $field ];
|
128 |
-
}
|
129 |
-
}
|
130 |
-
return $array;
|
131 |
-
}
|
132 |
-
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Checks for a unique field error
|
136 |
-
*
|
137 |
-
* @param $key
|
138 |
-
*
|
139 |
-
* @return int|string
|
140 |
-
*/
|
141 |
-
function unique_field_err( $key ) {
|
142 |
-
if ( empty( $key ) ) {
|
143 |
-
return __( 'Please provide a meta key', 'ultimate-member' );
|
144 |
-
}
|
145 |
-
if ( isset( $this->core_fields[ $key ] ) ) {
|
146 |
-
return __( 'Your meta key is a reserved core field and cannot be used', 'ultimate-member' );
|
147 |
-
}
|
148 |
-
if ( isset( $this->predefined_fields[ $key ] ) ) {
|
149 |
-
return __( 'Your meta key is a predefined reserved key and cannot be used', 'ultimate-member' );
|
150 |
-
}
|
151 |
-
if ( isset( $this->saved_fields[ $key ] ) ) {
|
152 |
-
return __( 'Your meta key already exists in your fields list', 'ultimate-member' );
|
153 |
-
}
|
154 |
-
if ( ! UM()->validation()->safe_string( $key ) ) {
|
155 |
-
return __( 'Your meta key contains illegal characters. Please correct it.', 'ultimate-member' );
|
156 |
-
}
|
157 |
-
|
158 |
-
return 0;
|
159 |
-
}
|
160 |
-
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Check date range errors (start date)
|
164 |
-
*
|
165 |
-
* @param $date
|
166 |
-
*
|
167 |
-
* @return int|string
|
168 |
-
*/
|
169 |
-
function date_range_start_err( $date ) {
|
170 |
-
if ( empty( $date ) ) {
|
171 |
-
return __( 'Please provide a date range beginning', 'ultimate-member' );
|
172 |
-
}
|
173 |
-
if ( ! UM()->validation()->validate_date( $date ) ) {
|
174 |
-
return __( 'Please enter a valid start date in the date range', 'ultimate-member' );
|
175 |
-
}
|
176 |
-
|
177 |
-
return 0;
|
178 |
-
}
|
179 |
-
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Check date range errors (end date)
|
183 |
-
*
|
184 |
-
* @param $date
|
185 |
-
* @param $start_date
|
186 |
-
*
|
187 |
-
* @return int|string
|
188 |
-
*/
|
189 |
-
function date_range_end_err( $date, $start_date ) {
|
190 |
-
if ( empty( $date ) ) {
|
191 |
-
return __( 'Please provide a date range end', 'ultimate-member' );
|
192 |
-
}
|
193 |
-
if ( ! UM()->validation()->validate_date( $date ) ) {
|
194 |
-
return __( 'Please enter a valid end date in the date range', 'ultimate-member' );
|
195 |
-
}
|
196 |
-
if ( strtotime( $date ) <= strtotime( $start_date ) ) {
|
197 |
-
return __( 'The end of date range must be greater than the start of date range', 'ultimate-member' );
|
198 |
-
}
|
199 |
-
return 0;
|
200 |
-
}
|
201 |
-
|
202 |
-
|
203 |
-
/**
|
204 |
-
* Get a core field attrs
|
205 |
-
*
|
206 |
-
* @param $type
|
207 |
-
*
|
208 |
-
* @return array|mixed
|
209 |
-
*/
|
210 |
-
function get_core_field_attrs( $type ) {
|
211 |
-
return ( isset( $this->core_fields[ $type ] ) ) ? $this->core_fields[ $type ] : array('');
|
212 |
-
}
|
213 |
-
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Core Fields
|
217 |
-
*/
|
218 |
-
function set_core_fields() {
|
219 |
-
|
220 |
-
$this->core_fields = array(
|
221 |
-
|
222 |
-
'row' => array(
|
223 |
-
'name' => 'Row',
|
224 |
-
'in_fields' => false,
|
225 |
-
'form_only' => true,
|
226 |
-
'conditional_support' => 0,
|
227 |
-
'icon' => 'um-faicon-pencil',
|
228 |
-
'col1' => array('_id','_background','_text_color','_padding','_margin','_border','_borderradius','_borderstyle','_bordercolor'),
|
229 |
-
'col2' => array('_heading','_heading_text','_heading_background_color','_heading_text_color','_icon','_icon_color','_css_class'),
|
230 |
-
),
|
231 |
-
|
232 |
-
'text' => array(
|
233 |
-
'name' => 'Text Box',
|
234 |
-
'col1' => array('_title','_metakey','_help','_default','_min_chars','_visibility'),
|
235 |
-
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max_chars'),
|
236 |
-
'col3' => array('_required','_editable','_icon'),
|
237 |
-
'validate' => array(
|
238 |
-
'_title' => array(
|
239 |
-
'mode' => 'required',
|
240 |
-
'error' => __('You must provide a title','ultimate-member')
|
241 |
-
),
|
242 |
-
'_metakey' => array(
|
243 |
-
'mode' => 'unique',
|
244 |
-
),
|
245 |
-
)
|
246 |
-
),
|
247 |
-
|
248 |
-
'number' => array(
|
249 |
-
'name' => __('Number','ultimate-member'),
|
250 |
-
'col1' => array('_title','_metakey','_help','_default','_min','_visibility'),
|
251 |
-
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate','_max'),
|
252 |
-
'col3' => array('_required','_editable','_icon'),
|
253 |
-
'validate' => array(
|
254 |
-
'_title' => array(
|
255 |
-
'mode' => 'required',
|
256 |
-
'error' => __('You must provide a title','ultimate-member')
|
257 |
-
),
|
258 |
-
'_metakey' => array(
|
259 |
-
'mode' => 'unique',
|
260 |
-
),
|
261 |
-
)
|
262 |
-
),
|
263 |
-
|
264 |
-
'textarea' => array(
|
265 |
-
'name' => 'Textarea',
|
266 |
-
'col1' => array('_title','_metakey','_help','_height','_max_chars','_max_words','_visibility'),
|
267 |
-
'col2' => array('_label','_placeholder','_public','_roles','_default','_html'),
|
268 |
-
'col3' => array('_required','_editable','_icon'),
|
269 |
-
'validate' => array(
|
270 |
-
'_title' => array(
|
271 |
-
'mode' => 'required',
|
272 |
-
'error' => __('You must provide a title','ultimate-member')
|
273 |
-
),
|
274 |
-
'_metakey' => array(
|
275 |
-
'mode' => 'unique',
|
276 |
-
),
|
277 |
-
)
|
278 |
-
),
|
279 |
-
|
280 |
-
'select' => array(
|
281 |
-
'name' => 'Dropdown',
|
282 |
-
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
|
283 |
-
'col2' => array('_label','_placeholder','_public','_roles','_custom_dropdown_options_source','_parent_dropdown_relationship'),
|
284 |
-
'col3' => array('_required','_editable','_icon'),
|
285 |
-
'validate' => array(
|
286 |
-
'_title' => array(
|
287 |
-
'mode' => 'required',
|
288 |
-
'error' => __('You must provide a title','ultimate-member')
|
289 |
-
),
|
290 |
-
'_metakey' => array(
|
291 |
-
'mode' => 'unique',
|
292 |
-
),
|
293 |
-
'_options' => array(
|
294 |
-
'mode' => 'required',
|
295 |
-
'error' => __('You have not added any choices yet.','ultimate-member')
|
296 |
-
),
|
297 |
-
)
|
298 |
-
),
|
299 |
-
|
300 |
-
'multiselect' => array(
|
301 |
-
'name' => 'Multi-Select',
|
302 |
-
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
|
303 |
-
'col2' => array('_label','_placeholder','_public','_roles','_min_selections','_max_selections','_custom_dropdown_options_source'),
|
304 |
-
'col3' => array('_required','_editable','_icon'),
|
305 |
-
'validate' => array(
|
306 |
-
'_title' => array(
|
307 |
-
'mode' => 'required',
|
308 |
-
'error' => __('You must provide a title','ultimate-member')
|
309 |
-
),
|
310 |
-
'_metakey' => array(
|
311 |
-
'mode' => 'unique',
|
312 |
-
),
|
313 |
-
'_options' => array(
|
314 |
-
'mode' => 'required',
|
315 |
-
'error' => __('You have not added any choices yet.','ultimate-member')
|
316 |
-
),
|
317 |
-
)
|
318 |
-
),
|
319 |
-
|
320 |
-
'radio' => array(
|
321 |
-
'name' => 'Radio',
|
322 |
-
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
|
323 |
-
'col2' => array('_label','_public','_roles'),
|
324 |
-
'col3' => array('_required','_editable','_icon'),
|
325 |
-
'validate' => array(
|
326 |
-
'_title' => array(
|
327 |
-
'mode' => 'required',
|
328 |
-
'error' => __('You must provide a title','ultimate-member')
|
329 |
-
),
|
330 |
-
'_metakey' => array(
|
331 |
-
'mode' => 'unique',
|
332 |
-
),
|
333 |
-
'_options' => array(
|
334 |
-
'mode' => 'required',
|
335 |
-
'error' => __('You have not added any choices yet.','ultimate-member')
|
336 |
-
),
|
337 |
-
)
|
338 |
-
),
|
339 |
-
|
340 |
-
'checkbox' => array(
|
341 |
-
'name' => 'Checkbox',
|
342 |
-
'col1' => array('_title','_metakey','_help','_default','_options','_visibility'),
|
343 |
-
'col2' => array('_label','_public','_roles','_max_selections'),
|
344 |
-
'col3' => array('_required','_editable','_icon'),
|
345 |
-
'validate' => array(
|
346 |
-
'_title' => array(
|
347 |
-
'mode' => 'required',
|
348 |
-
'error' => __('You must provide a title','ultimate-member')
|
349 |
-
),
|
350 |
-
'_metakey' => array(
|
351 |
-
'mode' => 'unique',
|
352 |
-
),
|
353 |
-
'_options' => array(
|
354 |
-
'mode' => 'required',
|
355 |
-
'error' => __('You have not added any choices yet.','ultimate-member')
|
356 |
-
),
|
357 |
-
)
|
358 |
-
),
|
359 |
-
|
360 |
-
'url' => array(
|
361 |
-
'name' => 'URL',
|
362 |
-
'col1' => array('_title','_metakey','_help','_default','_url_text','_visibility'),
|
363 |
-
'col2' => array('_label','_placeholder','_url_target','_url_rel','_public','_roles','_validate','_custom_validate'),
|
364 |
-
'col3' => array('_required','_editable','_icon'),
|
365 |
-
'validate' => array(
|
366 |
-
'_title' => array(
|
367 |
-
'mode' => 'required',
|
368 |
-
'error' => __('You must provide a title','ultimate-member')
|
369 |
-
),
|
370 |
-
'_metakey' => array(
|
371 |
-
'mode' => 'unique',
|
372 |
-
),
|
373 |
-
)
|
374 |
-
),
|
375 |
-
|
376 |
-
'password' => array(
|
377 |
-
'name' => 'Password',
|
378 |
-
'col1' => array('_title','_metakey','_help','_min_chars','_max_chars','_visibility'),
|
379 |
-
'col2' => array('_label','_placeholder','_public','_roles','_force_good_pass','_force_confirm_pass','_label_confirm_pass'),
|
380 |
-
'col3' => array('_required','_editable','_icon'),
|
381 |
-
'validate' => array(
|
382 |
-
'_title' => array(
|
383 |
-
'mode' => 'required',
|
384 |
-
'error' => __('You must provide a title','ultimate-member')
|
385 |
-
),
|
386 |
-
'_metakey' => array(
|
387 |
-
'mode' => 'unique',
|
388 |
-
),
|
389 |
-
)
|
390 |
-
),
|
391 |
-
|
392 |
-
'image' => array(
|
393 |
-
'name' => 'Image Upload',
|
394 |
-
'col1' => array('_title','_metakey','_help','_allowed_types','_max_size','_crop','_visibility'),
|
395 |
-
'col2' => array('_label','_public','_roles','_upload_text','_upload_help_text','_button_text'),
|
396 |
-
'col3' => array('_required','_editable','_icon'),
|
397 |
-
'validate' => array(
|
398 |
-
'_title' => array(
|
399 |
-
'mode' => 'required',
|
400 |
-
'error' => __('You must provide a title','ultimate-member')
|
401 |
-
),
|
402 |
-
'_metakey' => array(
|
403 |
-
'mode' => 'unique',
|
404 |
-
),
|
405 |
-
'_max_size' => array(
|
406 |
-
'mode' => 'numeric',
|
407 |
-
'error' => __('Please enter a valid size','ultimate-member')
|
408 |
-
),
|
409 |
-
)
|
410 |
-
),
|
411 |
-
|
412 |
-
'file' => array(
|
413 |
-
'name' => 'File Upload',
|
414 |
-
'col1' => array('_title','_metakey','_help','_allowed_types','_max_size','_visibility'),
|
415 |
-
'col2' => array('_label','_public','_roles','_upload_text','_upload_help_text','_button_text'),
|
416 |
-
'col3' => array('_required','_editable','_icon'),
|
417 |
-
'validate' => array(
|
418 |
-
'_title' => array(
|
419 |
-
'mode' => 'required',
|
420 |
-
'error' => __('You must provide a title','ultimate-member')
|
421 |
-
),
|
422 |
-
'_metakey' => array(
|
423 |
-
'mode' => 'unique',
|
424 |
-
),
|
425 |
-
'_max_size' => array(
|
426 |
-
'mode' => 'numeric',
|
427 |
-
'error' => __( 'Please enter a valid size', 'ultimate-member' )
|
428 |
-
),
|
429 |
-
)
|
430 |
-
),
|
431 |
-
|
432 |
-
'date' => array(
|
433 |
-
'name' => 'Date Picker',
|
434 |
-
'col1' => array( '_title', '_metakey', '_help', '_default', '_range', '_years', '_years_x', '_range_start', '_range_end', '_visibility' ),
|
435 |
-
'col2' => array( '_label', '_placeholder', '_public', '_roles', '_format', '_format_custom', '_pretty_format', '_disabled_weekdays' ),
|
436 |
-
'col3' => array( '_required', '_editable', '_icon' ),
|
437 |
-
'validate' => array(
|
438 |
-
'_title' => array(
|
439 |
-
'mode' => 'required',
|
440 |
-
'error' => __( 'You must provide a title', 'ultimate-member' )
|
441 |
-
),
|
442 |
-
'_metakey' => array(
|
443 |
-
'mode' => 'unique',
|
444 |
-
),
|
445 |
-
'_years' => array(
|
446 |
-
'mode' => 'numeric',
|
447 |
-
'error' => __( 'Number of years is not valid', 'ultimate-member' )
|
448 |
-
),
|
449 |
-
'_range_start' => array(
|
450 |
-
'mode' => 'range-start',
|
451 |
-
),
|
452 |
-
'_range_end' => array(
|
453 |
-
'mode' => 'range-end',
|
454 |
-
),
|
455 |
-
)
|
456 |
-
),
|
457 |
-
|
458 |
-
'time' => array(
|
459 |
-
'name' => 'Time Picker',
|
460 |
-
'col1' => array('_title','_metakey','_help','_format','_visibility'),
|
461 |
-
'col2' => array('_label','_placeholder','_default','_public','_roles','_intervals'),
|
462 |
-
'col3' => array('_required','_editable','_icon'),
|
463 |
-
'validate' => array(
|
464 |
-
'_title' => array(
|
465 |
-
'mode' => 'required',
|
466 |
-
'error' => __( 'You must provide a title', 'ultimate-member' )
|
467 |
-
),
|
468 |
-
'_metakey' => array(
|
469 |
-
'mode' => 'unique',
|
470 |
-
),
|
471 |
-
)
|
472 |
-
),
|
473 |
-
|
474 |
-
'rating' => array(
|
475 |
-
'name' => 'Rating',
|
476 |
-
'col1' => array('_title','_metakey','_help','_visibility'),
|
477 |
-
'col2' => array('_label','_public','_roles','_number','_default'),
|
478 |
-
'col3' => array('_required','_editable','_icon'),
|
479 |
-
'validate' => array(
|
480 |
-
'_title' => array(
|
481 |
-
'mode' => 'required',
|
482 |
-
'error' => __('You must provide a title','ultimate-member')
|
483 |
-
),
|
484 |
-
'_metakey' => array(
|
485 |
-
'mode' => 'unique',
|
486 |
-
),
|
487 |
-
)
|
488 |
-
),
|
489 |
-
|
490 |
-
'block' => array(
|
491 |
-
'name' => 'Content Block',
|
492 |
-
'col1' => array('_title','_visibility'),
|
493 |
-
'col2' => array('_public','_roles'),
|
494 |
-
'col_full' => array('_content'),
|
495 |
-
'mce_content' => true,
|
496 |
-
'validate' => array(
|
497 |
-
'_title' => array(
|
498 |
-
'mode' => 'required',
|
499 |
-
'error' => __('You must provide a title','ultimate-member')
|
500 |
-
),
|
501 |
-
)
|
502 |
-
),
|
503 |
-
|
504 |
-
'shortcode' => array(
|
505 |
-
'name' => 'Shortcode',
|
506 |
-
'col1' => array('_title','_visibility'),
|
507 |
-
'col2' => array('_public','_roles'),
|
508 |
-
'col_full' => array('_content'),
|
509 |
-
'validate' => array(
|
510 |
-
'_title' => array(
|
511 |
-
'mode' => 'required',
|
512 |
-
'error' => __('You must provide a title','ultimate-member')
|
513 |
-
),
|
514 |
-
'_content' => array(
|
515 |
-
'mode' => 'required',
|
516 |
-
'error' => __('You must add a shortcode to the content area','ultimate-member')
|
517 |
-
),
|
518 |
-
)
|
519 |
-
),
|
520 |
-
|
521 |
-
'spacing' => array(
|
522 |
-
'name' => 'Spacing',
|
523 |
-
'col1' => array('_title','_visibility'),
|
524 |
-
'col2' => array('_spacing'),
|
525 |
-
'form_only' => true,
|
526 |
-
'validate' => array(
|
527 |
-
'_title' => array(
|
528 |
-
'mode' => 'required',
|
529 |
-
'error' => __('You must provide a title','ultimate-member')
|
530 |
-
),
|
531 |
-
)
|
532 |
-
),
|
533 |
-
|
534 |
-
'divider' => array(
|
535 |
-
'name' => 'Divider',
|
536 |
-
'col1' => array('_title','_width','_divider_text','_visibility'),
|
537 |
-
'col2' => array('_style','_color','_public','_roles'),
|
538 |
-
'form_only' => true,
|
539 |
-
'validate' => array(
|
540 |
-
'_title' => array(
|
541 |
-
'mode' => 'required',
|
542 |
-
'error' => __('You must provide a title','ultimate-member')
|
543 |
-
),
|
544 |
-
)
|
545 |
-
),
|
546 |
-
|
547 |
-
'googlemap' => array(
|
548 |
-
'name' => 'Google Map',
|
549 |
-
'col1' => array('_title','_metakey','_help','_visibility'),
|
550 |
-
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
|
551 |
-
'col3' => array('_required','_editable','_icon'),
|
552 |
-
'validate' => array(
|
553 |
-
'_title' => array(
|
554 |
-
'mode' => 'required',
|
555 |
-
'error' => __('You must provide a title','ultimate-member')
|
556 |
-
),
|
557 |
-
'_metakey' => array(
|
558 |
-
'mode' => 'unique',
|
559 |
-
),
|
560 |
-
)
|
561 |
-
),
|
562 |
-
|
563 |
-
'youtube_video' => array(
|
564 |
-
'name' => 'YouTube Video',
|
565 |
-
'col1' => array('_title','_metakey','_help','_visibility'),
|
566 |
-
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
|
567 |
-
'col3' => array('_required','_editable','_icon'),
|
568 |
-
'validate' => array(
|
569 |
-
'_title' => array(
|
570 |
-
'mode' => 'required',
|
571 |
-
'error' => __('You must provide a title','ultimate-member')
|
572 |
-
),
|
573 |
-
'_metakey' => array(
|
574 |
-
'mode' => 'unique',
|
575 |
-
),
|
576 |
-
)
|
577 |
-
),
|
578 |
-
|
579 |
-
'vimeo_video' => array(
|
580 |
-
'name' => 'Vimeo Video',
|
581 |
-
'col1' => array('_title','_metakey','_help','_visibility'),
|
582 |
-
'col2' => array('_label','_placeholder','_public','_roles','_validate','_custom_validate'),
|
583 |
-
'col3' => array('_required','_editable','_icon'),
|
584 |
-
'validate' => array(
|
585 |
-
'_title' => array(
|
586 |
-
'mode' => 'required',
|
587 |
-
'error' => __('You must provide a title','ultimate-member')
|
588 |
-
),
|
589 |
-
'_metakey' => array(
|
590 |
-
'mode' => 'unique',
|
591 |
-
|