Version Description
Download this release
Release Info
Developer | nsinelnikov |
Plugin | Ultimate Member – User Profile & Membership Plugin |
Version | 2.2.1 |
Comparing to | |
See all releases |
Code changes from version 2.2.0 to 2.2.1
- assets/dynamic_css/dynamic_global.php +17 -17
- assets/js/um-members.js +1779 -1777
- assets/js/um-members.min.js +1 -1
- assets/js/um-scripts.js +699 -687
- assets/js/um-scripts.min.js +1 -1
- includes/admin/assets/css/um-admin-forms.css +404 -400
- includes/admin/assets/js/um-admin-blocks.js +235 -235
- includes/admin/class-admin.php +1970 -1956
- includes/admin/core/class-admin-builder.php +1228 -1228
- includes/admin/core/class-admin-dragdrop.php +249 -243
- includes/admin/core/class-admin-metabox.php +2427 -2437
- includes/admin/core/class-admin-settings.php +3437 -3428
- includes/admin/templates/access/restrict_content.php +164 -160
- includes/admin/templates/directory/appearance.php +25 -23
- includes/admin/templates/directory/general.php +133 -131
- includes/admin/templates/directory/pagination.php +74 -72
- includes/admin/templates/directory/profile.php +120 -120
- includes/admin/templates/directory/search.php +100 -100
- includes/admin/templates/directory/sorting.php +65 -65
- includes/admin/templates/form/login_customize.php +114 -106
- includes/admin/templates/form/profile_customize.php +159 -211
assets/dynamic_css/dynamic_global.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<style type="text/css">
|
2 |
-
<?php
|
3 |
-
|
4 |
-
if ( isset( $max_width ) && $max_width) {
|
5 |
-
print ".um-$form_id.um {
|
6 |
-
max-width: $max_width;
|
7 |
-
}";
|
8 |
-
}
|
9 |
-
|
10 |
-
if ( isset( $align ) && in_array( $align, array( 'left', 'right' ) ) ) {
|
11 |
-
print ".um-$form_id.um {
|
12 |
-
margin-$align: 0px !important;
|
13 |
-
}";
|
14 |
-
}
|
15 |
-
|
16 |
-
?>
|
17 |
-
</style>
|
1 |
+
<style type="text/css">
|
2 |
+
<?php
|
3 |
+
|
4 |
+
if ( isset( $max_width ) && $max_width ) {
|
5 |
+
print ".um-$form_id.um {
|
6 |
+
max-width: {$max_width};
|
7 |
+
}";
|
8 |
+
}
|
9 |
+
|
10 |
+
if ( isset( $align ) && in_array( $align, array( 'left', 'right' ) ) ) {
|
11 |
+
print ".um-$form_id.um {
|
12 |
+
margin-$align: 0px !important;
|
13 |
+
}";
|
14 |
+
}
|
15 |
+
|
16 |
+
?>
|
17 |
+
</style>
|
assets/js/um-members.js
CHANGED
@@ -1,1777 +1,1779 @@
|
|
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 |
-
if ( ui ) {
|
139 |
-
if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
|
140 |
-
placeholder = placeholder_s.replace( '\{value\}', ui.values[ 0 ] )
|
141 |
-
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
142 |
-
.data('label') );
|
143 |
-
} else {
|
144 |
-
placeholder = placeholder_p.replace( '\{min_range\}', ui.values[ 0 ] )
|
145 |
-
.replace( '\{max_range\}', ui.values[ 1 ] )
|
146 |
-
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
147 |
-
.data('label') );
|
148 |
-
}
|
149 |
-
} else {
|
150 |
-
if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
|
151 |
-
placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
|
152 |
-
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
153 |
-
.data('label') );
|
154 |
-
} else {
|
155 |
-
placeholder = placeholder_p.replace( '\{min_range\}', slider.slider( "values", 0 ) )
|
156 |
-
.replace( '\{max_range\}', slider.slider( "values", 1 ) )
|
157 |
-
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
158 |
-
.data('label') );
|
159 |
-
}
|
160 |
-
}
|
161 |
-
slider.siblings( '.um-slider-range' ).html( placeholder );
|
162 |
-
|
163 |
-
slider.siblings( ".um_range_min" ).val( slider.slider( "values", 0 ) );
|
164 |
-
slider.siblings( ".um_range_max" ).val( slider.slider( "values", 1 ) );
|
165 |
-
}
|
166 |
-
|
167 |
-
|
168 |
-
function um_get_search( directory ) {
|
169 |
-
if ( directory.find('.um-search-line').length ) {
|
170 |
-
return directory.find( '.um-search-line' ).val();
|
171 |
-
} else {
|
172 |
-
return '';
|
173 |
-
}
|
174 |
-
}
|
175 |
-
|
176 |
-
function um_get_sort( directory ) {
|
177 |
-
return directory.data( 'sorting' );
|
178 |
-
}
|
179 |
-
|
180 |
-
function um_get_current_page( directory ) {
|
181 |
-
var page = directory.data( 'page' );
|
182 |
-
if ( ! page || typeof page == 'undefined' ) {
|
183 |
-
page = 1;
|
184 |
-
}
|
185 |
-
return page;
|
186 |
-
}
|
187 |
-
|
188 |
-
function um_time_convert( time, range ) {
|
189 |
-
var hours = Math.floor( time / 60 );
|
190 |
-
var minutes = time % 60;
|
191 |
-
|
192 |
-
if ( minutes >= 60 ) {
|
193 |
-
minutes = 0;
|
194 |
-
hours = hours + 1;
|
195 |
-
|
196 |
-
if ( hours >= 24 ) {
|
197 |
-
hours = 0;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
if ( minutes < 10 ) {
|
202 |
-
minutes = '0' + minutes;
|
203 |
-
}
|
204 |
-
|
205 |
-
return hours + ":" + minutes;
|
206 |
-
}
|
207 |
-
|
208 |
-
function um_ajax_get_members( directory, args ) {
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Operates with the next data:
|
212 |
-
*
|
213 |
-
* 1) Page - getting from directory data 'page'
|
214 |
-
* 2) Sort - getting from 'um-member-directory-sorting-options' field value
|
215 |
-
* 3) Search - getting from 'um-search-line' field value
|
216 |
-
* 4) Filters - getting from URL data by 'um_get_data_for_directory' function
|
217 |
-
*
|
218 |
-
*/
|
219 |
-
|
220 |
-
var hash = um_members_get_hash( directory );
|
221 |
-
|
222 |
-
var allow = wp.hooks.applyFilters( 'um_member_directory_get_members_allow', true, hash, directory );
|
223 |
-
if ( ! allow ) {
|
224 |
-
setTimeout( um_ajax_get_members, 600, directory, args );
|
225 |
-
return;
|
226 |
-
}
|
227 |
-
|
228 |
-
var page = um_get_current_page( directory );
|
229 |
-
var search = um_get_search( directory );
|
230 |
-
var sorting = um_get_sort( directory );
|
231 |
-
|
232 |
-
var local_date = new Date();
|
233 |
-
var gmt_hours = -local_date.getTimezoneOffset() / 60;
|
234 |
-
|
235 |
-
var request = {
|
236 |
-
directory_id: hash,
|
237 |
-
page: page,
|
238 |
-
search: search,
|
239 |
-
sorting: sorting,
|
240 |
-
gmt_offset: gmt_hours,
|
241 |
-
post_refferer: directory.data('base-post'),
|
242 |
-
nonce: um_scripts.nonce
|
243 |
-
};
|
244 |
-
|
245 |
-
if ( directory.find('.um-search-filter').length ) {
|
246 |
-
directory.find('.um-search-filter').each( function() {
|
247 |
-
var filter = jQuery(this);
|
248 |
-
|
249 |
-
if ( filter.find( '.um-slider' ).length ) {
|
250 |
-
var filter_name = filter.find( '.um-slider' ).data('field_name');
|
251 |
-
|
252 |
-
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
253 |
-
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
254 |
-
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined' ) {
|
255 |
-
request[ filter_name ] = [ value_from, value_to ];
|
256 |
-
}
|
257 |
-
} else if ( filter.find( '.um-datepicker-filter' ).length ) {
|
258 |
-
var filter_name = filter.find( '.um-datepicker-filter' ).data('filter_name');
|
259 |
-
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
260 |
-
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
261 |
-
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined') {
|
262 |
-
request[ filter_name ] = [ value_from, value_to ];
|
263 |
-
}
|
264 |
-
} else if ( filter.find( '.um-timepicker-filter' ).length ) {
|
265 |
-
var filter_name = filter.find( '.um-timepicker-filter' ).data('filter_name');
|
266 |
-
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
267 |
-
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
268 |
-
|
269 |
-
if ( typeof value_from != 'undefined' ) {
|
270 |
-
var value_from = value_from.split(':');
|
271 |
-
var hours = value_from[0]*1;
|
272 |
-
if ( hours < 10 ) {
|
273 |
-
hours = '0' + hours;
|
274 |
-
}
|
275 |
-
|
276 |
-
var minutes = value_from[1]*1;
|
277 |
-
if ( minutes < 10 ) {
|
278 |
-
minutes = '0' + minutes;
|
279 |
-
}
|
280 |
-
|
281 |
-
value_from = hours + ':' + minutes + ':00';
|
282 |
-
}
|
283 |
-
if ( typeof value_to != 'undefined' ) {
|
284 |
-
var val_to = value_to.split(':');
|
285 |
-
var minutes = val_to[1]*1;
|
286 |
-
|
287 |
-
var hours = val_to[0]*1;
|
288 |
-
if ( hours < 10 ) {
|
289 |
-
hours = '0' + hours;
|
290 |
-
}
|
291 |
-
|
292 |
-
if ( minutes < 10 ) {
|
293 |
-
minutes = '0' + minutes;
|
294 |
-
}
|
295 |
-
|
296 |
-
value_to = hours + ':' + minutes + ':59';
|
297 |
-
}
|
298 |
-
|
299 |
-
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined' ) {
|
300 |
-
request[ filter_name ] = [ value_from, value_to ];
|
301 |
-
}
|
302 |
-
} else if ( filter.find( 'select' ).length ) {
|
303 |
-
var filter_name = filter.find('select').attr('name');
|
304 |
-
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
305 |
-
if ( typeof value != 'undefined' ) {
|
306 |
-
request[ filter_name ] = value.split( '||' );
|
307 |
-
}
|
308 |
-
} else if ( filter.hasClass( 'um-text-filter-type' ) && filter.find('input[type="text"]').length ) {
|
309 |
-
var filter_name = filter.find('input[type="text"]').attr('name');
|
310 |
-
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
311 |
-
if ( typeof value != 'undefined' ) {
|
312 |
-
request[ filter_name ] = value;
|
313 |
-
}
|
314 |
-
} else {
|
315 |
-
request = wp.hooks.applyFilters( 'um_member_directory_custom_filter_handler', request, filter, directory );
|
316 |
-
}
|
317 |
-
});
|
318 |
-
}
|
319 |
-
|
320 |
-
request = wp.hooks.applyFilters( 'um_member_directory_filter_request', request );
|
321 |
-
|
322 |
-
wp.ajax.send( 'um_get_members', {
|
323 |
-
data: request,
|
324 |
-
success: function( answer ) {
|
325 |
-
//set last data hard for using on layouts reloading
|
326 |
-
um_member_directory_last_data[ hash ] = answer;
|
327 |
-
|
328 |
-
um_build_template( directory, answer );
|
329 |
-
|
330 |
-
var pagination_template = wp.template( 'um-members-pagination' );
|
331 |
-
directory.find('.um-members-pagination-box').html( pagination_template( answer ) );
|
332 |
-
|
333 |
-
directory.data( 'total_pages', answer.pagination.total_pages );
|
334 |
-
|
335 |
-
if ( answer.pagination.total_pages ) {
|
336 |
-
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
337 |
-
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
338 |
-
} else {
|
339 |
-
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
340 |
-
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
341 |
-
}
|
342 |
-
|
343 |
-
//args.directory = directory;
|
344 |
-
wp.hooks.doAction( 'um_member_directory_loaded', directory, answer );
|
345 |
-
//jQuery( document ).trigger('um_members_rendered', [ directory, answer ] );
|
346 |
-
|
347 |
-
um_init_new_dropdown();
|
348 |
-
|
349 |
-
um_members_hide_preloader( directory );
|
350 |
-
},
|
351 |
-
error: function( data ) {
|
352 |
-
console.log( data );
|
353 |
-
|
354 |
-
um_members_hide_preloader( directory );
|
355 |
-
}
|
356 |
-
});
|
357 |
-
}
|
358 |
-
|
359 |
-
|
360 |
-
function um_build_template( directory, data ) {
|
361 |
-
var layout = directory.data('view_type');
|
362 |
-
var template = wp.template( 'um-member-' + layout + '-' + um_members_get_hash( directory ) );
|
363 |
-
|
364 |
-
directory.find('.um-members-grid, .um-members-list').remove();
|
365 |
-
directory.find('.um-members-wrapper').prepend( template( data.users ) );
|
366 |
-
|
367 |
-
var header_template = wp.template( 'um-members-header' );
|
368 |
-
directory.find('.um-members-intro').remove();
|
369 |
-
|
370 |
-
var generate_header = wp.hooks.applyFilters( 'um_member_directory_generate_header', false, directory );
|
371 |
-
|
372 |
-
if ( ( typeof data.is_search != 'undefined' && data.is_search ) || generate_header ) {
|
373 |
-
directory.find('.um-members-wrapper').prepend( header_template( data ) );
|
374 |
-
}
|
375 |
-
|
376 |
-
directory.addClass('um-loaded');
|
377 |
-
|
378 |
-
if ( directory.find('.um-members.um-members-grid').length ) {
|
379 |
-
UM_Member_Grid( directory.find('.um-members.um-members-grid') );
|
380 |
-
}
|
381 |
-
|
382 |
-
jQuery( document ).trigger( 'um_build_template', [ directory, data ] );
|
383 |
-
jQuery( window ).trigger( 'resize' );
|
384 |
-
|
385 |
-
init_tipsy();
|
386 |
-
}
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
function UM_Member_Grid( container ) {
|
391 |
-
if ( container.find( '.um-member' ).length ) {
|
392 |
-
container.imagesLoaded( function() {
|
393 |
-
|
394 |
-
var masonry_args = wp.hooks.applyFilters( 'um_member_directory_grid_masonry_attrs', {
|
395 |
-
itemSelector: '.um-member',
|
396 |
-
columnWidth: '.um-member',
|
397 |
-
gutter: '.um-gutter-sizer'
|
398 |
-
}, container );
|
399 |
-
|
400 |
-
var $grid = container.masonry( masonry_args );
|
401 |
-
|
402 |
-
$grid.on( 'layoutComplete', function( event, laidOutItems ) {
|
403 |
-
jQuery( document ).trigger( "um_grid_initialized", [ event, laidOutItems ] );
|
404 |
-
});
|
405 |
-
});
|
406 |
-
}
|
407 |
-
}
|
408 |
-
|
409 |
-
|
410 |
-
function um_get_filters_data( directory ) {
|
411 |
-
var filters_data = [];
|
412 |
-
|
413 |
-
directory.find('.um-search-filter').each( function() {
|
414 |
-
|
415 |
-
var filter = jQuery(this);
|
416 |
-
var filter_name,
|
417 |
-
filter_title;
|
418 |
-
|
419 |
-
var filter_type;
|
420 |
-
if ( filter.find('input.um-datepicker-filter').length ) {
|
421 |
-
filter_type = 'datepicker';
|
422 |
-
|
423 |
-
filter.find('input.um-datepicker-filter').each( function() {
|
424 |
-
var range = jQuery(this).data('range');
|
425 |
-
if ( range === 'to' ) {
|
426 |
-
return;
|
427 |
-
}
|
428 |
-
|
429 |
-
var filter_name = jQuery(this).data('filter_name');
|
430 |
-
|
431 |
-
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
432 |
-
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
433 |
-
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
434 |
-
return;
|
435 |
-
}
|
436 |
-
|
437 |
-
var from_val = jQuery(this).val();
|
438 |
-
var to_val = directory.find('input.um-datepicker-filter[data-range="to"][data-filter_name="' + filter_name + '"]').val();
|
439 |
-
|
440 |
-
var value;
|
441 |
-
if ( from_val === to_val ) {
|
442 |
-
value = to_val;
|
443 |
-
} else if ( from_val !== '' && to_val !== '' ) {
|
444 |
-
value = from_val + ' - ' + to_val;
|
445 |
-
} else if ( from_val === '' ) {
|
446 |
-
value = 'before ' + to_val;
|
447 |
-
} else if ( to_val === '' ) {
|
448 |
-
value = 'since ' + from_val;
|
449 |
-
}
|
450 |
-
|
451 |
-
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} );
|
452 |
-
});
|
453 |
-
|
454 |
-
} else if( filter.find('input.um-timepicker-filter').length ) {
|
455 |
-
filter_type = 'timepicker';
|
456 |
-
|
457 |
-
filter.find('input.um-timepicker-filter').each( function() {
|
458 |
-
var range = jQuery(this).data('range');
|
459 |
-
if ( range === 'to' ) {
|
460 |
-
return;
|
461 |
-
}
|
462 |
-
|
463 |
-
var filter_name = jQuery(this).data('filter_name');
|
464 |
-
|
465 |
-
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
466 |
-
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
467 |
-
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
468 |
-
return;
|
469 |
-
}
|
470 |
-
|
471 |
-
var from_val = jQuery(this).val();
|
472 |
-
var to_val = directory.find('input.um-timepicker-filter[data-range="to"][data-filter_name="' + filter_name + '"]').val();
|
473 |
-
|
474 |
-
var value;
|
475 |
-
if ( from_val === to_val ) {
|
476 |
-
value = to_val;
|
477 |
-
} else if ( from_val !== '' && to_val !== '' ) {
|
478 |
-
value = from_val + ' - ' + to_val;
|
479 |
-
} else if ( from_val === '' ) {
|
480 |
-
value = 'before ' + to_val;
|
481 |
-
} else if ( to_val === '' ) {
|
482 |
-
value = 'since ' + from_val;
|
483 |
-
}
|
484 |
-
|
485 |
-
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} );
|
486 |
-
});
|
487 |
-
} else if( filter.find('select').length ) {
|
488 |
-
|
489 |
-
filter_type = 'select';
|
490 |
-
filter_name = filter.find('select').attr('name');
|
491 |
-
filter_title = filter.find('select').data('placeholder');
|
492 |
-
|
493 |
-
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
494 |
-
if ( typeof filter_value == 'undefined' ) {
|
495 |
-
filter_value = [];
|
496 |
-
} else {
|
497 |
-
filter_value = filter_value.split( '||' );
|
498 |
-
}
|
499 |
-
|
500 |
-
jQuery.each( filter_value, function(i) {
|
501 |
-
var filter_value_title = filter.find('select option[value="' + filter_value[ i ] + '"]').data('value_label');
|
502 |
-
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':filter_value[ i ], 'type':filter_type} );
|
503 |
-
});
|
504 |
-
|
505 |
-
} else if( filter.hasClass('um-text-filter-type') && filter.find('input[type="text"]').length ) {
|
506 |
-
|
507 |
-
filter_type = 'text';
|
508 |
-
filter_name = filter.find('input[type="text"]').attr('name');
|
509 |
-
filter_title = filter.find('input[type="text"]').attr('placeholder');
|
510 |
-
|
511 |
-
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
512 |
-
if ( typeof filter_value == 'undefined' ) {
|
513 |
-
filter_value = '';
|
514 |
-
}
|
515 |
-
|
516 |
-
if ( filter_value != '' ) {
|
517 |
-
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value, 'value':filter_value, 'type':filter_type} );
|
518 |
-
}
|
519 |
-
|
520 |
-
} else if( filter.find('div.ui-slider').length ) {
|
521 |
-
filter_type = 'slider';
|
522 |
-
|
523 |
-
filter_name = filter.find('div.ui-slider').data( 'field_name' );
|
524 |
-
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
525 |
-
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
526 |
-
|
527 |
-
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
528 |
-
return;
|
529 |
-
}
|
530 |
-
|
531 |
-
var filter_value_title;
|
532 |
-
if ( filter_value_from === filter_value_to ) {
|
533 |
-
filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-s' ).replace( '\{value\}', filter_value_from )
|
534 |
-
.replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
|
535 |
-
} else {
|
536 |
-
filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-p' ).replace( '\{min_range\}', filter_value_from )
|
537 |
-
.replace( '\{max_range\}', filter_value_to )
|
538 |
-
.replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
|
539 |
-
}
|
540 |
-
|
541 |
-
filter_title = filter.find('div.um-slider-range').data('label');
|
542 |
-
|
543 |
-
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
|
544 |
-
} else {
|
545 |
-
|
546 |
-
filters_data = wp.hooks.applyFilters( 'um_member_directory_get_filter_data', filters_data, directory, filter );
|
547 |
-
|
548 |
-
}
|
549 |
-
});
|
550 |
-
|
551 |
-
return filters_data;
|
552 |
-
}
|
553 |
-
|
554 |
-
|
555 |
-
function um_change_tag( directory ) {
|
556 |
-
var filters_data = um_get_filters_data( directory );
|
557 |
-
|
558 |
-
directory.find('.um-members-filter-tag').remove();
|
559 |
-
|
560 |
-
var filtered_line = directory.find('.um-filtered-line');
|
561 |
-
if ( filtered_line.length ) {
|
562 |
-
var filters_template = wp.template( 'um-members-filtered-line' );
|
563 |
-
filtered_line.prepend( filters_template( {'filters': filters_data} ) );
|
564 |
-
|
565 |
-
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
566 |
-
directory.find('.um-clear-filters').hide();
|
567 |
-
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').addClass( 'um-header-row-invisible' );
|
568 |
-
} else {
|
569 |
-
directory.find('.um-clear-filters').show();
|
570 |
-
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
|
571 |
-
}
|
572 |
-
}
|
573 |
-
|
574 |
-
|
575 |
-
}
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
function um_run_search( directory ) {
|
580 |
-
if ( um_is_directory_busy( directory ) ) {
|
581 |
-
return;
|
582 |
-
}
|
583 |
-
um_members_show_preloader( directory );
|
584 |
-
|
585 |
-
var pre_search = um_get_data_for_directory( directory, 'search' );
|
586 |
-
|
587 |
-
var search = directory.find('.um-search-line').val();
|
588 |
-
if ( search === pre_search || ( search === '' && typeof pre_search == 'undefined' ) ) {
|
589 |
-
um_members_hide_preloader( directory );
|
590 |
-
return;
|
591 |
-
}
|
592 |
-
|
593 |
-
directory.data( 'general_search', search );
|
594 |
-
um_set_url_from_data( directory, 'search', search );
|
595 |
-
|
596 |
-
//set 1st page after search
|
597 |
-
directory.data( 'page', 1 );
|
598 |
-
um_set_url_from_data( directory, 'page', '' );
|
599 |
-
|
600 |
-
|
601 |
-
var ignore_after_search = false;
|
602 |
-
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
603 |
-
|
604 |
-
if ( ! ignore_after_search ) {
|
605 |
-
var show_after_search = directory.data('must-search');
|
606 |
-
if ( show_after_search === 1 ) {
|
607 |
-
search = um_get_search( directory );
|
608 |
-
if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
|
609 |
-
directory.data( 'searched', 0 );
|
610 |
-
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
611 |
-
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
612 |
-
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
613 |
-
|
614 |
-
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
615 |
-
|
616 |
-
um_members_hide_preloader( directory );
|
617 |
-
return;
|
618 |
-
}
|
619 |
-
}
|
620 |
-
}
|
621 |
-
|
622 |
-
directory.data( 'searched', 1 );
|
623 |
-
|
624 |
-
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
625 |
-
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
626 |
-
|
627 |
-
um_ajax_get_members( directory );
|
628 |
-
}
|
629 |
-
|
630 |
-
|
631 |
-
jQuery(document.body).ready( function() {
|
632 |
-
|
633 |
-
|
634 |
-
jQuery( '.um-directory .um-search-filter select' ).each( function() {
|
635 |
-
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
636 |
-
jQuery(this).prop('disabled', true);
|
637 |
-
}
|
638 |
-
|
639 |
-
var obj = jQuery(this);
|
640 |
-
obj.select2('destroy').select2({
|
641 |
-
dropdownParent: obj.parent()
|
642 |
-
});
|
643 |
-
});
|
644 |
-
|
645 |
-
/**
|
646 |
-
* Change View Type Handlers
|
647 |
-
*/
|
648 |
-
|
649 |
-
|
650 |
-
//UI for change view type button
|
651 |
-
jQuery( document.body ).on( 'mouseover', '.um-directory .um-member-directory-view-type', function() {
|
652 |
-
if ( jQuery(this).hasClass('um-disabled') ) {
|
653 |
-
return;
|
654 |
-
}
|
655 |
-
|
656 |
-
var $obj = jQuery(this).find('.um-member-directory-view-type-a:visible');
|
657 |
-
|
658 |
-
$obj.hide();
|
659 |
-
|
660 |
-
if ( $obj.next().length ) {
|
661 |
-
$obj.next().show().tipsy('show');
|
662 |
-
} else {
|
663 |
-
jQuery(this).find( '.um-member-directory-view-type-a:first' ).show().tipsy('show');
|
664 |
-
}
|
665 |
-
}).on( 'mouseout', '.um-directory .um-member-directory-view-type', function() {
|
666 |
-
if ( jQuery(this).hasClass('um-disabled') ) {
|
667 |
-
return;
|
668 |
-
}
|
669 |
-
|
670 |
-
jQuery(this).find('.um-member-directory-view-type-a').hide().tipsy('hide');
|
671 |
-
jQuery(this).find('.um-member-directory-view-type-a[data-type="' + jQuery(this).parents( '.um-directory' ).data('view_type') + '"]').show();
|
672 |
-
});
|
673 |
-
|
674 |
-
//change layout handler
|
675 |
-
jQuery( document.body ).on( 'click', '.um-directory .um-member-directory-view-type-a', function() {
|
676 |
-
var directory = jQuery(this).parents('.um-directory');
|
677 |
-
if ( um_is_directory_busy( directory ) ) {
|
678 |
-
return false;
|
679 |
-
}
|
680 |
-
|
681 |
-
var $this = jQuery(this);
|
682 |
-
var views = $this.parents('.um-member-directory-view-type');
|
683 |
-
|
684 |
-
if ( views.hasClass('um-disabled') ) {
|
685 |
-
return;
|
686 |
-
}
|
687 |
-
|
688 |
-
um_members_show_preloader( directory );
|
689 |
-
|
690 |
-
var $obj = views.find('.um-member-directory-view-type-a:visible');
|
691 |
-
|
692 |
-
$obj.hide();
|
693 |
-
|
694 |
-
if ( $obj.next().length ) {
|
695 |
-
$obj.next().show().tipsy('show');
|
696 |
-
} else {
|
697 |
-
views.find( '.um-member-directory-view-type-a:first' ).show().tipsy('show');
|
698 |
-
}
|
699 |
-
|
700 |
-
var data = um_member_directory_last_data[ um_members_get_hash( directory ) ];
|
701 |
-
if ( data !== null ) {
|
702 |
-
var layout = $this.data('type');
|
703 |
-
|
704 |
-
um_set_url_from_data( directory, 'view_type', layout );
|
705 |
-
directory.data( 'view_type', layout );
|
706 |
-
|
707 |
-
um_build_template( directory, data );
|
708 |
-
|
709 |
-
um_init_new_dropdown();
|
710 |
-
}
|
711 |
-
um_members_hide_preloader( directory );
|
712 |
-
});
|
713 |
-
|
714 |
-
|
715 |
-
/**
|
716 |
-
* END: Change View Type Handlers
|
717 |
-
*/
|
718 |
-
|
719 |
-
|
720 |
-
/**
|
721 |
-
* General Search
|
722 |
-
*/
|
723 |
-
|
724 |
-
|
725 |
-
//searching
|
726 |
-
jQuery( document.body ).on( 'click', '.um-directory .um-do-search', function() {
|
727 |
-
var directory = jQuery(this).parents('.um-directory');
|
728 |
-
um_run_search( directory );
|
729 |
-
});
|
730 |
-
|
731 |
-
|
732 |
-
//make search on Enter click
|
733 |
-
jQuery( document.body ).on( 'keypress', '.um-directory .um-search-line', function(e) {
|
734 |
-
if ( e.which === 13 ) {
|
735 |
-
var directory = jQuery(this).parents('.um-directory');
|
736 |
-
um_run_search( directory );
|
737 |
-
}
|
738 |
-
});
|
739 |
-
|
740 |
-
|
741 |
-
/**
|
742 |
-
* END: General Search
|
743 |
-
*/
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
/**
|
748 |
-
* Sorting
|
749 |
-
*/
|
750 |
-
|
751 |
-
jQuery( document.body ).on( 'click', '.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a', function() {
|
752 |
-
if ( jQuery( this ).data('selected') === 1 ) {
|
753 |
-
return;
|
754 |
-
}
|
755 |
-
|
756 |
-
var directory_hash = jQuery(this).data('directory-hash');
|
757 |
-
var directory = jQuery('.um-directory[data-hash="' + directory_hash + '"]');
|
758 |
-
|
759 |
-
if ( um_is_directory_busy( directory ) ) {
|
760 |
-
return;
|
761 |
-
}
|
762 |
-
|
763 |
-
um_members_show_preloader( directory );
|
764 |
-
|
765 |
-
var sorting_label = jQuery( this ).html();
|
766 |
-
var sort = jQuery(this).data('value');
|
767 |
-
|
768 |
-
directory.data( 'sorting', sort );
|
769 |
-
um_set_url_from_data( directory, 'sort', sort );
|
770 |
-
|
771 |
-
um_ajax_get_members( directory );
|
772 |
-
|
773 |
-
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);
|
774 |
-
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);
|
775 |
-
directory.find('.um-member-directory-sorting-a').find('> a').html( sorting_label );
|
776 |
-
});
|
777 |
-
|
778 |
-
/**
|
779 |
-
* END: Sorting
|
780 |
-
*/
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
/**
|
785 |
-
* Pagination
|
786 |
-
*/
|
787 |
-
|
788 |
-
|
789 |
-
jQuery( document.body ).on( 'click', '.um-directory .pagi:not(.current)', function() {
|
790 |
-
if ( jQuery(this).hasClass('disabled') ) {
|
791 |
-
return;
|
792 |
-
}
|
793 |
-
|
794 |
-
var directory = jQuery(this).parents('.um-directory');
|
795 |
-
if ( um_is_directory_busy( directory ) ) {
|
796 |
-
return;
|
797 |
-
}
|
798 |
-
|
799 |
-
um_members_show_preloader( directory );
|
800 |
-
|
801 |
-
var page;
|
802 |
-
if ( 'first' === jQuery(this).data('page') ) {
|
803 |
-
page = 1;
|
804 |
-
} else if ( 'prev' === jQuery(this).data('page') ) {
|
805 |
-
page = directory.data( 'page' )*1 - 1;
|
806 |
-
} else if ( 'next' === jQuery(this).data('page') ) {
|
807 |
-
page = directory.data( 'page' )*1 + 1;
|
808 |
-
} else if ( 'last' === jQuery(this).data('page') ) {
|
809 |
-
page = parseInt( directory.data( 'total_pages' ) );
|
810 |
-
} else {
|
811 |
-
page = parseInt( jQuery(this).data('page') );
|
812 |
-
}
|
813 |
-
|
814 |
-
if ( page === 1 ) {
|
815 |
-
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass('disabled');
|
816 |
-
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
817 |
-
} else if ( page === parseInt( directory.data( 'total_pages' ) ) ) {
|
818 |
-
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass('disabled');
|
819 |
-
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass('disabled');
|
820 |
-
} else {
|
821 |
-
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
822 |
-
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass('disabled');
|
823 |
-
}
|
824 |
-
|
825 |
-
directory.find('.pagi').removeClass('current');
|
826 |
-
directory.find('.pagi[data-page="' + page + '"]').addClass('current');
|
827 |
-
|
828 |
-
directory.data( 'page', page );
|
829 |
-
if ( page === 1 ) {
|
830 |
-
um_set_url_from_data( directory, 'page', '' );
|
831 |
-
} else {
|
832 |
-
um_set_url_from_data( directory, 'page', page );
|
833 |
-
}
|
834 |
-
|
835 |
-
um_ajax_get_members( directory );
|
836 |
-
});
|
837 |
-
|
838 |
-
|
839 |
-
//mobile pagination
|
840 |
-
jQuery( document.body ).on( 'change', '.um-directory .um-members-pagi-dropdown', function() {
|
841 |
-
var directory = jQuery(this).parents('.um-directory');
|
842 |
-
|
843 |
-
if ( um_is_directory_busy( directory ) ) {
|
844 |
-
return;
|
845 |
-
}
|
846 |
-
|
847 |
-
um_members_show_preloader( directory );
|
848 |
-
|
849 |
-
var page = jQuery(this).val();
|
850 |
-
|
851 |
-
directory.find('.pagi').removeClass('current');
|
852 |
-
directory.find('.pagi[data-page="' + page + '"]').addClass('current');
|
853 |
-
|
854 |
-
directory.data( 'page', page );
|
855 |
-
if ( page === 1 ) {
|
856 |
-
um_set_url_from_data( directory, 'page', '' );
|
857 |
-
} else {
|
858 |
-
um_set_url_from_data( directory, 'page', page );
|
859 |
-
}
|
860 |
-
|
861 |
-
um_ajax_get_members( directory );
|
862 |
-
});
|
863 |
-
|
864 |
-
|
865 |
-
/**
|
866 |
-
* END: Pagination
|
867 |
-
*/
|
868 |
-
|
869 |
-
|
870 |
-
/**
|
871 |
-
* Profile Cards actions
|
872 |
-
*/
|
873 |
-
|
874 |
-
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-list .um-member-more a', function(e){
|
875 |
-
e.preventDefault();
|
876 |
-
|
877 |
-
var block = jQuery(this).parents('.um-member');
|
878 |
-
|
879 |
-
block.find('.um-member-more').hide();
|
880 |
-
block.find('.um-member-meta-main').slideDown();
|
881 |
-
block.find('.um-member-less').fadeIn();
|
882 |
-
|
883 |
-
return false;
|
884 |
-
});
|
885 |
-
|
886 |
-
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-list .um-member-less a', function(e){
|
887 |
-
e.preventDefault();
|
888 |
-
|
889 |
-
var block = jQuery(this).parents('.um-member');
|
890 |
-
|
891 |
-
block.find('.um-member-less').hide();
|
892 |
-
block.find('.um-member-meta-main').slideUp();
|
893 |
-
block.find('.um-member-more').fadeIn();
|
894 |
-
|
895 |
-
return false;
|
896 |
-
});
|
897 |
-
|
898 |
-
|
899 |
-
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-grid .um-member-more a', function(e){
|
900 |
-
e.preventDefault();
|
901 |
-
|
902 |
-
var block = jQuery(this).parents('.um-member');
|
903 |
-
var container = jQuery(this).parents('.um-members');
|
904 |
-
block.find('.um-member-more').hide();
|
905 |
-
block.find('.um-member-meta').slideDown( function(){ UM_Member_Grid( container ) } );
|
906 |
-
block.find('.um-member-less').fadeIn( );
|
907 |
-
|
908 |
-
setTimeout(function(){ UM_Member_Grid( container ) }, 100);
|
909 |
-
|
910 |
-
return false;
|
911 |
-
});
|
912 |
-
|
913 |
-
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-grid .um-member-less a', function(e){
|
914 |
-
e.preventDefault();
|
915 |
-
|
916 |
-
var block = jQuery(this).parents('.um-member');
|
917 |
-
var container = jQuery(this).parents('.um-members');
|
918 |
-
block.find('.um-member-less').hide();
|
919 |
-
block.find('.um-member-meta').slideUp( function() {
|
920 |
-
block.find('.um-member-more').fadeIn();
|
921 |
-
UM_Member_Grid( container );
|
922 |
-
});
|
923 |
-
|
924 |
-
return false;
|
925 |
-
});
|
926 |
-
|
927 |
-
/**
|
928 |
-
* END: Profile Cards actions
|
929 |
-
*/
|
930 |
-
|
931 |
-
|
932 |
-
//filters controls
|
933 |
-
jQuery('.um-member-directory-filters-a').on( 'click', function() {
|
934 |
-
var obj = jQuery(this);
|
935 |
-
var search_bar = obj.parents('.um-directory').find('.um-search');
|
936 |
-
|
937 |
-
if ( search_bar.is( ':visible' ) ) {
|
938 |
-
search_bar.slideUp( 250, function(){
|
939 |
-
obj.toggleClass('um-member-directory-filters-visible');
|
940 |
-
search_bar.parents('.um-member-directory-header-row').toggleClass('um-header-row-invisible');
|
941 |
-
});
|
942 |
-
} else {
|
943 |
-
search_bar.slideDown({
|
944 |
-
duration: 250,
|
945 |
-
start: function() {
|
946 |
-
jQuery(this).css({
|
947 |
-
display: "grid"
|
948 |
-
});
|
949 |
-
obj.toggleClass('um-member-directory-filters-visible');
|
950 |
-
search_bar.parents('.um-member-directory-header-row').toggleClass('um-header-row-invisible');
|
951 |
-
}
|
952 |
-
} );
|
953 |
-
}
|
954 |
-
});
|
955 |
-
|
956 |
-
|
957 |
-
//filtration process
|
958 |
-
jQuery( document.body ).on( 'change', '.um-directory .um-search-filter select', function() {
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
var
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
current_value =
|
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 |
-
|
1009 |
-
directory.
|
1010 |
-
|
1011 |
-
|
1012 |
-
//
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
var
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
directory.
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
var
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
directory.
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
var
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
|
1110 |
-
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
current_value =
|
1117 |
-
}
|
1118 |
-
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
$slider.slider( '
|
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 |
-
directory.find('.um-clear-filters').
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
directory.
|
1202 |
-
directory.find(
|
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 |
-
var
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
current_value =
|
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 |
-
$slider.slider( '
|
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 |
-
directory.
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
directory.find('.um-clear-filters').
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
directory.
|
1328 |
-
directory.find(
|
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 |
-
var
|
1373 |
-
|
1374 |
-
var
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
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 |
-
directory.
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
var
|
1429 |
-
|
1430 |
-
|
1431 |
-
var
|
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 |
-
var
|
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 |
-
directory.
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
var $
|
1498 |
-
var $
|
1499 |
-
|
1500 |
-
var
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
var
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
var
|
1519 |
-
|
1520 |
-
|
1521 |
-
var
|
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 |
-
var
|
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 |
-
jQuery( '#' + elem_filter_name + '
|
1580 |
-
}
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
directory.
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
var $
|
1604 |
-
var $
|
1605 |
-
|
1606 |
-
var
|
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 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
page =
|
1667 |
-
}
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
sort_dropdown.find('
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
directory.
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
var
|
1702 |
-
|
1703 |
-
var $
|
1704 |
-
|
1705 |
-
var
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
$picker.
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
var
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
|
1736 |
-
|
1737 |
-
var
|
1738 |
-
|
1739 |
-
var $
|
1740 |
-
|
1741 |
-
var
|
1742 |
-
|
1743 |
-
|
1744 |
-
|
1745 |
-
|
1746 |
-
$picker.
|
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 |
-
});
|
|
|
|
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 |
+
if ( ui ) {
|
139 |
+
if ( ui.values[ 0 ] === ui.values[ 1 ] ) {
|
140 |
+
placeholder = placeholder_s.replace( '\{value\}', ui.values[ 0 ] )
|
141 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
142 |
+
.data('label') );
|
143 |
+
} else {
|
144 |
+
placeholder = placeholder_p.replace( '\{min_range\}', ui.values[ 0 ] )
|
145 |
+
.replace( '\{max_range\}', ui.values[ 1 ] )
|
146 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
147 |
+
.data('label') );
|
148 |
+
}
|
149 |
+
} else {
|
150 |
+
if ( slider.slider( "values", 0 ) === slider.slider( "values", 1 ) ) {
|
151 |
+
placeholder = placeholder_s.replace( '\{value\}', slider.slider( "values", 0 ) )
|
152 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
153 |
+
.data('label') );
|
154 |
+
} else {
|
155 |
+
placeholder = placeholder_p.replace( '\{min_range\}', slider.slider( "values", 0 ) )
|
156 |
+
.replace( '\{max_range\}', slider.slider( "values", 1 ) )
|
157 |
+
.replace( '\{field_label\}', slider.siblings( '.um-slider-range' )
|
158 |
+
.data('label') );
|
159 |
+
}
|
160 |
+
}
|
161 |
+
slider.siblings( '.um-slider-range' ).html( placeholder );
|
162 |
+
|
163 |
+
slider.siblings( ".um_range_min" ).val( slider.slider( "values", 0 ) );
|
164 |
+
slider.siblings( ".um_range_max" ).val( slider.slider( "values", 1 ) );
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
+
function um_get_search( directory ) {
|
169 |
+
if ( directory.find('.um-search-line').length ) {
|
170 |
+
return directory.find( '.um-search-line' ).val();
|
171 |
+
} else {
|
172 |
+
return '';
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
function um_get_sort( directory ) {
|
177 |
+
return directory.data( 'sorting' );
|
178 |
+
}
|
179 |
+
|
180 |
+
function um_get_current_page( directory ) {
|
181 |
+
var page = directory.data( 'page' );
|
182 |
+
if ( ! page || typeof page == 'undefined' ) {
|
183 |
+
page = 1;
|
184 |
+
}
|
185 |
+
return page;
|
186 |
+
}
|
187 |
+
|
188 |
+
function um_time_convert( time, range ) {
|
189 |
+
var hours = Math.floor( time / 60 );
|
190 |
+
var minutes = time % 60;
|
191 |
+
|
192 |
+
if ( minutes >= 60 ) {
|
193 |
+
minutes = 0;
|
194 |
+
hours = hours + 1;
|
195 |
+
|
196 |
+
if ( hours >= 24 ) {
|
197 |
+
hours = 0;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
if ( minutes < 10 ) {
|
202 |
+
minutes = '0' + minutes;
|
203 |
+
}
|
204 |
+
|
205 |
+
return hours + ":" + minutes;
|
206 |
+
}
|
207 |
+
|
208 |
+
function um_ajax_get_members( directory, args ) {
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Operates with the next data:
|
212 |
+
*
|
213 |
+
* 1) Page - getting from directory data 'page'
|
214 |
+
* 2) Sort - getting from 'um-member-directory-sorting-options' field value
|
215 |
+
* 3) Search - getting from 'um-search-line' field value
|
216 |
+
* 4) Filters - getting from URL data by 'um_get_data_for_directory' function
|
217 |
+
*
|
218 |
+
*/
|
219 |
+
|
220 |
+
var hash = um_members_get_hash( directory );
|
221 |
+
|
222 |
+
var allow = wp.hooks.applyFilters( 'um_member_directory_get_members_allow', true, hash, directory );
|
223 |
+
if ( ! allow ) {
|
224 |
+
setTimeout( um_ajax_get_members, 600, directory, args );
|
225 |
+
return;
|
226 |
+
}
|
227 |
+
|
228 |
+
var page = um_get_current_page( directory );
|
229 |
+
var search = um_get_search( directory );
|
230 |
+
var sorting = um_get_sort( directory );
|
231 |
+
|
232 |
+
var local_date = new Date();
|
233 |
+
var gmt_hours = -local_date.getTimezoneOffset() / 60;
|
234 |
+
|
235 |
+
var request = {
|
236 |
+
directory_id: hash,
|
237 |
+
page: page,
|
238 |
+
search: search,
|
239 |
+
sorting: sorting,
|
240 |
+
gmt_offset: gmt_hours,
|
241 |
+
post_refferer: directory.data('base-post'),
|
242 |
+
nonce: um_scripts.nonce
|
243 |
+
};
|
244 |
+
|
245 |
+
if ( directory.find('.um-search-filter').length ) {
|
246 |
+
directory.find('.um-search-filter').each( function() {
|
247 |
+
var filter = jQuery(this);
|
248 |
+
|
249 |
+
if ( filter.find( '.um-slider' ).length ) {
|
250 |
+
var filter_name = filter.find( '.um-slider' ).data('field_name');
|
251 |
+
|
252 |
+
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
253 |
+
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
254 |
+
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined' ) {
|
255 |
+
request[ filter_name ] = [ value_from, value_to ];
|
256 |
+
}
|
257 |
+
} else if ( filter.find( '.um-datepicker-filter' ).length ) {
|
258 |
+
var filter_name = filter.find( '.um-datepicker-filter' ).data('filter_name');
|
259 |
+
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
260 |
+
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
261 |
+
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined') {
|
262 |
+
request[ filter_name ] = [ value_from, value_to ];
|
263 |
+
}
|
264 |
+
} else if ( filter.find( '.um-timepicker-filter' ).length ) {
|
265 |
+
var filter_name = filter.find( '.um-timepicker-filter' ).data('filter_name');
|
266 |
+
var value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
267 |
+
var value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
268 |
+
|
269 |
+
if ( typeof value_from != 'undefined' ) {
|
270 |
+
var value_from = value_from.split(':');
|
271 |
+
var hours = value_from[0]*1;
|
272 |
+
if ( hours < 10 ) {
|
273 |
+
hours = '0' + hours;
|
274 |
+
}
|
275 |
+
|
276 |
+
var minutes = value_from[1]*1;
|
277 |
+
if ( minutes < 10 ) {
|
278 |
+
minutes = '0' + minutes;
|
279 |
+
}
|
280 |
+
|
281 |
+
value_from = hours + ':' + minutes + ':00';
|
282 |
+
}
|
283 |
+
if ( typeof value_to != 'undefined' ) {
|
284 |
+
var val_to = value_to.split(':');
|
285 |
+
var minutes = val_to[1]*1;
|
286 |
+
|
287 |
+
var hours = val_to[0]*1;
|
288 |
+
if ( hours < 10 ) {
|
289 |
+
hours = '0' + hours;
|
290 |
+
}
|
291 |
+
|
292 |
+
if ( minutes < 10 ) {
|
293 |
+
minutes = '0' + minutes;
|
294 |
+
}
|
295 |
+
|
296 |
+
value_to = hours + ':' + minutes + ':59';
|
297 |
+
}
|
298 |
+
|
299 |
+
if ( typeof value_from != 'undefined' || typeof value_to != 'undefined' ) {
|
300 |
+
request[ filter_name ] = [ value_from, value_to ];
|
301 |
+
}
|
302 |
+
} else if ( filter.find( 'select' ).length ) {
|
303 |
+
var filter_name = filter.find('select').attr('name');
|
304 |
+
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
305 |
+
if ( typeof value != 'undefined' ) {
|
306 |
+
request[ filter_name ] = value.split( '||' );
|
307 |
+
}
|
308 |
+
} else if ( filter.hasClass( 'um-text-filter-type' ) && filter.find('input[type="text"]').length ) {
|
309 |
+
var filter_name = filter.find('input[type="text"]').attr('name');
|
310 |
+
var value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
311 |
+
if ( typeof value != 'undefined' ) {
|
312 |
+
request[ filter_name ] = value;
|
313 |
+
}
|
314 |
+
} else {
|
315 |
+
request = wp.hooks.applyFilters( 'um_member_directory_custom_filter_handler', request, filter, directory );
|
316 |
+
}
|
317 |
+
});
|
318 |
+
}
|
319 |
+
|
320 |
+
request = wp.hooks.applyFilters( 'um_member_directory_filter_request', request );
|
321 |
+
|
322 |
+
wp.ajax.send( 'um_get_members', {
|
323 |
+
data: request,
|
324 |
+
success: function( answer ) {
|
325 |
+
//set last data hard for using on layouts reloading
|
326 |
+
um_member_directory_last_data[ hash ] = answer;
|
327 |
+
|
328 |
+
um_build_template( directory, answer );
|
329 |
+
|
330 |
+
var pagination_template = wp.template( 'um-members-pagination' );
|
331 |
+
directory.find('.um-members-pagination-box').html( pagination_template( answer ) );
|
332 |
+
|
333 |
+
directory.data( 'total_pages', answer.pagination.total_pages );
|
334 |
+
|
335 |
+
if ( answer.pagination.total_pages ) {
|
336 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
337 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
338 |
+
} else {
|
339 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
340 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
341 |
+
}
|
342 |
+
|
343 |
+
//args.directory = directory;
|
344 |
+
wp.hooks.doAction( 'um_member_directory_loaded', directory, answer );
|
345 |
+
//jQuery( document ).trigger('um_members_rendered', [ directory, answer ] );
|
346 |
+
|
347 |
+
um_init_new_dropdown();
|
348 |
+
|
349 |
+
um_members_hide_preloader( directory );
|
350 |
+
},
|
351 |
+
error: function( data ) {
|
352 |
+
console.log( data );
|
353 |
+
|
354 |
+
um_members_hide_preloader( directory );
|
355 |
+
}
|
356 |
+
});
|
357 |
+
}
|
358 |
+
|
359 |
+
|
360 |
+
function um_build_template( directory, data ) {
|
361 |
+
var layout = directory.data('view_type');
|
362 |
+
var template = wp.template( 'um-member-' + layout + '-' + um_members_get_hash( directory ) );
|
363 |
+
|
364 |
+
directory.find('.um-members-grid, .um-members-list').remove();
|
365 |
+
directory.find('.um-members-wrapper').prepend( template( data.users ) );
|
366 |
+
|
367 |
+
var header_template = wp.template( 'um-members-header' );
|
368 |
+
directory.find('.um-members-intro').remove();
|
369 |
+
|
370 |
+
var generate_header = wp.hooks.applyFilters( 'um_member_directory_generate_header', false, directory );
|
371 |
+
|
372 |
+
if ( ( typeof data.is_search != 'undefined' && data.is_search ) || generate_header ) {
|
373 |
+
directory.find('.um-members-wrapper').prepend( header_template( data ) );
|
374 |
+
}
|
375 |
+
|
376 |
+
directory.addClass('um-loaded');
|
377 |
+
|
378 |
+
if ( directory.find('.um-members.um-members-grid').length ) {
|
379 |
+
UM_Member_Grid( directory.find('.um-members.um-members-grid') );
|
380 |
+
}
|
381 |
+
|
382 |
+
jQuery( document ).trigger( 'um_build_template', [ directory, data ] );
|
383 |
+
jQuery( window ).trigger( 'resize' );
|
384 |
+
|
385 |
+
init_tipsy();
|
386 |
+
}
|
387 |
+
|
388 |
+
|
389 |
+
|
390 |
+
function UM_Member_Grid( container ) {
|
391 |
+
if ( container.find( '.um-member' ).length ) {
|
392 |
+
container.imagesLoaded( function() {
|
393 |
+
|
394 |
+
var masonry_args = wp.hooks.applyFilters( 'um_member_directory_grid_masonry_attrs', {
|
395 |
+
itemSelector: '.um-member',
|
396 |
+
columnWidth: '.um-member',
|
397 |
+
gutter: '.um-gutter-sizer'
|
398 |
+
}, container );
|
399 |
+
|
400 |
+
var $grid = container.masonry( masonry_args );
|
401 |
+
|
402 |
+
$grid.on( 'layoutComplete', function( event, laidOutItems ) {
|
403 |
+
jQuery( document ).trigger( "um_grid_initialized", [ event, laidOutItems ] );
|
404 |
+
});
|
405 |
+
});
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
+
|
410 |
+
function um_get_filters_data( directory ) {
|
411 |
+
var filters_data = [];
|
412 |
+
|
413 |
+
directory.find('.um-search-filter').each( function() {
|
414 |
+
|
415 |
+
var filter = jQuery(this);
|
416 |
+
var filter_name,
|
417 |
+
filter_title;
|
418 |
+
|
419 |
+
var filter_type;
|
420 |
+
if ( filter.find('input.um-datepicker-filter').length ) {
|
421 |
+
filter_type = 'datepicker';
|
422 |
+
|
423 |
+
filter.find('input.um-datepicker-filter').each( function() {
|
424 |
+
var range = jQuery(this).data('range');
|
425 |
+
if ( range === 'to' ) {
|
426 |
+
return;
|
427 |
+
}
|
428 |
+
|
429 |
+
var filter_name = jQuery(this).data('filter_name');
|
430 |
+
|
431 |
+
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
432 |
+
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
433 |
+
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
434 |
+
return;
|
435 |
+
}
|
436 |
+
|
437 |
+
var from_val = jQuery(this).val();
|
438 |
+
var to_val = directory.find('input.um-datepicker-filter[data-range="to"][data-filter_name="' + filter_name + '"]').val();
|
439 |
+
|
440 |
+
var value;
|
441 |
+
if ( from_val === to_val ) {
|
442 |
+
value = to_val;
|
443 |
+
} else if ( from_val !== '' && to_val !== '' ) {
|
444 |
+
value = from_val + ' - ' + to_val;
|
445 |
+
} else if ( from_val === '' ) {
|
446 |
+
value = 'before ' + to_val;
|
447 |
+
} else if ( to_val === '' ) {
|
448 |
+
value = 'since ' + from_val;
|
449 |
+
}
|
450 |
+
|
451 |
+
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} );
|
452 |
+
});
|
453 |
+
|
454 |
+
} else if( filter.find('input.um-timepicker-filter').length ) {
|
455 |
+
filter_type = 'timepicker';
|
456 |
+
|
457 |
+
filter.find('input.um-timepicker-filter').each( function() {
|
458 |
+
var range = jQuery(this).data('range');
|
459 |
+
if ( range === 'to' ) {
|
460 |
+
return;
|
461 |
+
}
|
462 |
+
|
463 |
+
var filter_name = jQuery(this).data('filter_name');
|
464 |
+
|
465 |
+
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
466 |
+
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
467 |
+
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
468 |
+
return;
|
469 |
+
}
|
470 |
+
|
471 |
+
var from_val = jQuery(this).val();
|
472 |
+
var to_val = directory.find('input.um-timepicker-filter[data-range="to"][data-filter_name="' + filter_name + '"]').val();
|
473 |
+
|
474 |
+
var value;
|
475 |
+
if ( from_val === to_val ) {
|
476 |
+
value = to_val;
|
477 |
+
} else if ( from_val !== '' && to_val !== '' ) {
|
478 |
+
value = from_val + ' - ' + to_val;
|
479 |
+
} else if ( from_val === '' ) {
|
480 |
+
value = 'before ' + to_val;
|
481 |
+
} else if ( to_val === '' ) {
|
482 |
+
value = 'since ' + from_val;
|
483 |
+
}
|
484 |
+
|
485 |
+
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} );
|
486 |
+
});
|
487 |
+
} else if( filter.find('select').length ) {
|
488 |
+
|
489 |
+
filter_type = 'select';
|
490 |
+
filter_name = filter.find('select').attr('name');
|
491 |
+
filter_title = filter.find('select').data('placeholder');
|
492 |
+
|
493 |
+
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
494 |
+
if ( typeof filter_value == 'undefined' ) {
|
495 |
+
filter_value = [];
|
496 |
+
} else {
|
497 |
+
filter_value = filter_value.split( '||' );
|
498 |
+
}
|
499 |
+
|
500 |
+
jQuery.each( filter_value, function(i) {
|
501 |
+
var filter_value_title = filter.find('select option[value="' + filter_value[ i ] + '"]').data('value_label');
|
502 |
+
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':filter_value[ i ], 'type':filter_type} );
|
503 |
+
});
|
504 |
+
|
505 |
+
} else if( filter.hasClass('um-text-filter-type') && filter.find('input[type="text"]').length ) {
|
506 |
+
|
507 |
+
filter_type = 'text';
|
508 |
+
filter_name = filter.find('input[type="text"]').attr('name');
|
509 |
+
filter_title = filter.find('input[type="text"]').attr('placeholder');
|
510 |
+
|
511 |
+
var filter_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
512 |
+
if ( typeof filter_value == 'undefined' ) {
|
513 |
+
filter_value = '';
|
514 |
+
}
|
515 |
+
|
516 |
+
if ( filter_value != '' ) {
|
517 |
+
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value, 'value':filter_value, 'type':filter_type} );
|
518 |
+
}
|
519 |
+
|
520 |
+
} else if( filter.find('div.ui-slider').length ) {
|
521 |
+
filter_type = 'slider';
|
522 |
+
|
523 |
+
filter_name = filter.find('div.ui-slider').data( 'field_name' );
|
524 |
+
var filter_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
525 |
+
var filter_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
526 |
+
|
527 |
+
if ( typeof filter_value_from === 'undefined' && typeof filter_value_to === 'undefined' ) {
|
528 |
+
return;
|
529 |
+
}
|
530 |
+
|
531 |
+
var filter_value_title;
|
532 |
+
if ( filter_value_from === filter_value_to ) {
|
533 |
+
filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-s' ).replace( '\{value\}', filter_value_from )
|
534 |
+
.replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
|
535 |
+
} else {
|
536 |
+
filter_value_title = filter.find('div.um-slider-range').data( 'placeholder-p' ).replace( '\{min_range\}', filter_value_from )
|
537 |
+
.replace( '\{max_range\}', filter_value_to )
|
538 |
+
.replace( '\{field_label\}', filter.find('div.um-slider-range').data('label') );
|
539 |
+
}
|
540 |
+
|
541 |
+
filter_title = filter.find('div.um-slider-range').data('label');
|
542 |
+
|
543 |
+
filters_data.push( {'name':filter_name, 'label':filter_title, 'value_label':filter_value_title, 'value':[filter_value_from, filter_value_to], 'type':filter_type} );
|
544 |
+
} else {
|
545 |
+
|
546 |
+
filters_data = wp.hooks.applyFilters( 'um_member_directory_get_filter_data', filters_data, directory, filter );
|
547 |
+
|
548 |
+
}
|
549 |
+
});
|
550 |
+
|
551 |
+
return filters_data;
|
552 |
+
}
|
553 |
+
|
554 |
+
|
555 |
+
function um_change_tag( directory ) {
|
556 |
+
var filters_data = um_get_filters_data( directory );
|
557 |
+
|
558 |
+
directory.find('.um-members-filter-tag').remove();
|
559 |
+
|
560 |
+
var filtered_line = directory.find('.um-filtered-line');
|
561 |
+
if ( filtered_line.length ) {
|
562 |
+
var filters_template = wp.template( 'um-members-filtered-line' );
|
563 |
+
filtered_line.prepend( filters_template( {'filters': filters_data} ) );
|
564 |
+
|
565 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
566 |
+
directory.find('.um-clear-filters').hide();
|
567 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').addClass( 'um-header-row-invisible' );
|
568 |
+
} else {
|
569 |
+
directory.find('.um-clear-filters').show();
|
570 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
|
571 |
+
}
|
572 |
+
}
|
573 |
+
|
574 |
+
|
575 |
+
}
|
576 |
+
|
577 |
+
|
578 |
+
|
579 |
+
function um_run_search( directory ) {
|
580 |
+
if ( um_is_directory_busy( directory ) ) {
|
581 |
+
return;
|
582 |
+
}
|
583 |
+
um_members_show_preloader( directory );
|
584 |
+
|
585 |
+
var pre_search = um_get_data_for_directory( directory, 'search' );
|
586 |
+
|
587 |
+
var search = um_sanitize_value( directory.find('.um-search-line').val() );
|
588 |
+
if ( search === pre_search || ( search === '' && typeof pre_search == 'undefined' ) ) {
|
589 |
+
um_members_hide_preloader( directory );
|
590 |
+
return;
|
591 |
+
}
|
592 |
+
|
593 |
+
directory.data( 'general_search', search );
|
594 |
+
um_set_url_from_data( directory, 'search', search );
|
595 |
+
|
596 |
+
//set 1st page after search
|
597 |
+
directory.data( 'page', 1 );
|
598 |
+
um_set_url_from_data( directory, 'page', '' );
|
599 |
+
|
600 |
+
|
601 |
+
var ignore_after_search = false;
|
602 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
603 |
+
|
604 |
+
if ( ! ignore_after_search ) {
|
605 |
+
var show_after_search = directory.data('must-search');
|
606 |
+
if ( show_after_search === 1 ) {
|
607 |
+
search = um_get_search( directory );
|
608 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
|
609 |
+
directory.data( 'searched', 0 );
|
610 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
611 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
612 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
613 |
+
|
614 |
+
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
615 |
+
|
616 |
+
um_members_hide_preloader( directory );
|
617 |
+
return;
|
618 |
+
}
|
619 |
+
}
|
620 |
+
}
|
621 |
+
|
622 |
+
directory.data( 'searched', 1 );
|
623 |
+
|
624 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
625 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
626 |
+
|
627 |
+
um_ajax_get_members( directory );
|
628 |
+
}
|
629 |
+
|
630 |
+
|
631 |
+
jQuery(document.body).ready( function() {
|
632 |
+
|
633 |
+
|
634 |
+
jQuery( '.um-directory .um-search-filter select' ).each( function() {
|
635 |
+
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
636 |
+
jQuery(this).prop('disabled', true);
|
637 |
+
}
|
638 |
+
|
639 |
+
var obj = jQuery(this);
|
640 |
+
obj.select2('destroy').select2({
|
641 |
+
dropdownParent: obj.parent()
|
642 |
+
});
|
643 |
+
});
|
644 |
+
|
645 |
+
/**
|
646 |
+
* Change View Type Handlers
|
647 |
+
*/
|
648 |
+
|
649 |
+
|
650 |
+
//UI for change view type button
|
651 |
+
jQuery( document.body ).on( 'mouseover', '.um-directory .um-member-directory-view-type', function() {
|
652 |
+
if ( jQuery(this).hasClass('um-disabled') ) {
|
653 |
+
return;
|
654 |
+
}
|
655 |
+
|
656 |
+
var $obj = jQuery(this).find('.um-member-directory-view-type-a:visible');
|
657 |
+
|
658 |
+
$obj.hide();
|
659 |
+
|
660 |
+
if ( $obj.next().length ) {
|
661 |
+
$obj.next().show().tipsy('show');
|
662 |
+
} else {
|
663 |
+
jQuery(this).find( '.um-member-directory-view-type-a:first' ).show().tipsy('show');
|
664 |
+
}
|
665 |
+
}).on( 'mouseout', '.um-directory .um-member-directory-view-type', function() {
|
666 |
+
if ( jQuery(this).hasClass('um-disabled') ) {
|
667 |
+
return;
|
668 |
+
}
|
669 |
+
|
670 |
+
jQuery(this).find('.um-member-directory-view-type-a').hide().tipsy('hide');
|
671 |
+
jQuery(this).find('.um-member-directory-view-type-a[data-type="' + jQuery(this).parents( '.um-directory' ).data('view_type') + '"]').show();
|
672 |
+
});
|
673 |
+
|
674 |
+
//change layout handler
|
675 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-member-directory-view-type-a', function() {
|
676 |
+
var directory = jQuery(this).parents('.um-directory');
|
677 |
+
if ( um_is_directory_busy( directory ) ) {
|
678 |
+
return false;
|
679 |
+
}
|
680 |
+
|
681 |
+
var $this = jQuery(this);
|
682 |
+
var views = $this.parents('.um-member-directory-view-type');
|
683 |
+
|
684 |
+
if ( views.hasClass('um-disabled') ) {
|
685 |
+
return;
|
686 |
+
}
|
687 |
+
|
688 |
+
um_members_show_preloader( directory );
|
689 |
+
|
690 |
+
var $obj = views.find('.um-member-directory-view-type-a:visible');
|
691 |
+
|
692 |
+
$obj.hide();
|
693 |
+
|
694 |
+
if ( $obj.next().length ) {
|
695 |
+
$obj.next().show().tipsy('show');
|
696 |
+
} else {
|
697 |
+
views.find( '.um-member-directory-view-type-a:first' ).show().tipsy('show');
|
698 |
+
}
|
699 |
+
|
700 |
+
var data = um_member_directory_last_data[ um_members_get_hash( directory ) ];
|
701 |
+
if ( data !== null ) {
|
702 |
+
var layout = $this.data('type');
|
703 |
+
|
704 |
+
um_set_url_from_data( directory, 'view_type', layout );
|
705 |
+
directory.data( 'view_type', layout );
|
706 |
+
|
707 |
+
um_build_template( directory, data );
|
708 |
+
|
709 |
+
um_init_new_dropdown();
|
710 |
+
}
|
711 |
+
um_members_hide_preloader( directory );
|
712 |
+
});
|
713 |
+
|
714 |
+
|
715 |
+
/**
|
716 |
+
* END: Change View Type Handlers
|
717 |
+
*/
|
718 |
+
|
719 |
+
|
720 |
+
/**
|
721 |
+
* General Search
|
722 |
+
*/
|
723 |
+
|
724 |
+
|
725 |
+
//searching
|
726 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-do-search', function() {
|
727 |
+
var directory = jQuery(this).parents('.um-directory');
|
728 |
+
um_run_search( directory );
|
729 |
+
});
|
730 |
+
|
731 |
+
|
732 |
+
//make search on Enter click
|
733 |
+
jQuery( document.body ).on( 'keypress', '.um-directory .um-search-line', function(e) {
|
734 |
+
if ( e.which === 13 ) {
|
735 |
+
var directory = jQuery(this).parents('.um-directory');
|
736 |
+
um_run_search( directory );
|
737 |
+
}
|
738 |
+
});
|
739 |
+
|
740 |
+
|
741 |
+
/**
|
742 |
+
* END: General Search
|
743 |
+
*/
|
744 |
+
|
745 |
+
|
746 |
+
|
747 |
+
/**
|
748 |
+
* Sorting
|
749 |
+
*/
|
750 |
+
|
751 |
+
jQuery( document.body ).on( 'click', '.um-new-dropdown[data-element=".um-member-directory-sorting-a"] li a', function() {
|
752 |
+
if ( jQuery( this ).data('selected') === 1 ) {
|
753 |
+
return;
|
754 |
+
}
|
755 |
+
|
756 |
+
var directory_hash = jQuery(this).data('directory-hash');
|
757 |
+
var directory = jQuery('.um-directory[data-hash="' + directory_hash + '"]');
|
758 |
+
|
759 |
+
if ( um_is_directory_busy( directory ) ) {
|
760 |
+
return;
|
761 |
+
}
|
762 |
+
|
763 |
+
um_members_show_preloader( directory );
|
764 |
+
|
765 |
+
var sorting_label = jQuery( this ).html();
|
766 |
+
var sort = jQuery(this).data('value');
|
767 |
+
|
768 |
+
directory.data( 'sorting', sort );
|
769 |
+
um_set_url_from_data( directory, 'sort', sort );
|
770 |
+
|
771 |
+
um_ajax_get_members( directory );
|
772 |
+
|
773 |
+
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);
|
774 |
+
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);
|
775 |
+
directory.find('.um-member-directory-sorting-a').find('> a').html( sorting_label );
|
776 |
+
});
|
777 |
+
|
778 |
+
/**
|
779 |
+
* END: Sorting
|
780 |
+
*/
|
781 |
+
|
782 |
+
|
783 |
+
|
784 |
+
/**
|
785 |
+
* Pagination
|
786 |
+
*/
|
787 |
+
|
788 |
+
|
789 |
+
jQuery( document.body ).on( 'click', '.um-directory .pagi:not(.current)', function() {
|
790 |
+
if ( jQuery(this).hasClass('disabled') ) {
|
791 |
+
return;
|
792 |
+
}
|
793 |
+
|
794 |
+
var directory = jQuery(this).parents('.um-directory');
|
795 |
+
if ( um_is_directory_busy( directory ) ) {
|
796 |
+
return;
|
797 |
+
}
|
798 |
+
|
799 |
+
um_members_show_preloader( directory );
|
800 |
+
|
801 |
+
var page;
|
802 |
+
if ( 'first' === jQuery(this).data('page') ) {
|
803 |
+
page = 1;
|
804 |
+
} else if ( 'prev' === jQuery(this).data('page') ) {
|
805 |
+
page = directory.data( 'page' )*1 - 1;
|
806 |
+
} else if ( 'next' === jQuery(this).data('page') ) {
|
807 |
+
page = directory.data( 'page' )*1 + 1;
|
808 |
+
} else if ( 'last' === jQuery(this).data('page') ) {
|
809 |
+
page = parseInt( directory.data( 'total_pages' ) );
|
810 |
+
} else {
|
811 |
+
page = parseInt( jQuery(this).data('page') );
|
812 |
+
}
|
813 |
+
|
814 |
+
if ( page === 1 ) {
|
815 |
+
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').addClass('disabled');
|
816 |
+
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
817 |
+
} else if ( page === parseInt( directory.data( 'total_pages' ) ) ) {
|
818 |
+
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').addClass('disabled');
|
819 |
+
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass('disabled');
|
820 |
+
} else {
|
821 |
+
directory.find('.pagi[data-page="prev"], .pagi[data-page="last"]').removeClass('disabled');
|
822 |
+
directory.find('.pagi[data-page="first"], .pagi[data-page="prev"]').removeClass('disabled');
|
823 |
+
}
|
824 |
+
|
825 |
+
directory.find('.pagi').removeClass('current');
|
826 |
+
directory.find('.pagi[data-page="' + page + '"]').addClass('current');
|
827 |
+
|
828 |
+
directory.data( 'page', page );
|
829 |
+
if ( page === 1 ) {
|
830 |
+
um_set_url_from_data( directory, 'page', '' );
|
831 |
+
} else {
|
832 |
+
um_set_url_from_data( directory, 'page', page );
|
833 |
+
}
|
834 |
+
|
835 |
+
um_ajax_get_members( directory );
|
836 |
+
});
|
837 |
+
|
838 |
+
|
839 |
+
//mobile pagination
|
840 |
+
jQuery( document.body ).on( 'change', '.um-directory .um-members-pagi-dropdown', function() {
|
841 |
+
var directory = jQuery(this).parents('.um-directory');
|
842 |
+
|
843 |
+
if ( um_is_directory_busy( directory ) ) {
|
844 |
+
return;
|
845 |
+
}
|
846 |
+
|
847 |
+
um_members_show_preloader( directory );
|
848 |
+
|
849 |
+
var page = jQuery(this).val();
|
850 |
+
|
851 |
+
directory.find('.pagi').removeClass('current');
|
852 |
+
directory.find('.pagi[data-page="' + page + '"]').addClass('current');
|
853 |
+
|
854 |
+
directory.data( 'page', page );
|
855 |
+
if ( page === 1 ) {
|
856 |
+
um_set_url_from_data( directory, 'page', '' );
|
857 |
+
} else {
|
858 |
+
um_set_url_from_data( directory, 'page', page );
|
859 |
+
}
|
860 |
+
|
861 |
+
um_ajax_get_members( directory );
|
862 |
+
});
|
863 |
+
|
864 |
+
|
865 |
+
/**
|
866 |
+
* END: Pagination
|
867 |
+
*/
|
868 |
+
|
869 |
+
|
870 |
+
/**
|
871 |
+
* Profile Cards actions
|
872 |
+
*/
|
873 |
+
|
874 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-list .um-member-more a', function(e){
|
875 |
+
e.preventDefault();
|
876 |
+
|
877 |
+
var block = jQuery(this).parents('.um-member');
|
878 |
+
|
879 |
+
block.find('.um-member-more').hide();
|
880 |
+
block.find('.um-member-meta-main').slideDown();
|
881 |
+
block.find('.um-member-less').fadeIn();
|
882 |
+
|
883 |
+
return false;
|
884 |
+
});
|
885 |
+
|
886 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-list .um-member-less a', function(e){
|
887 |
+
e.preventDefault();
|
888 |
+
|
889 |
+
var block = jQuery(this).parents('.um-member');
|
890 |
+
|
891 |
+
block.find('.um-member-less').hide();
|
892 |
+
block.find('.um-member-meta-main').slideUp();
|
893 |
+
block.find('.um-member-more').fadeIn();
|
894 |
+
|
895 |
+
return false;
|
896 |
+
});
|
897 |
+
|
898 |
+
|
899 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-grid .um-member-more a', function(e){
|
900 |
+
e.preventDefault();
|
901 |
+
|
902 |
+
var block = jQuery(this).parents('.um-member');
|
903 |
+
var container = jQuery(this).parents('.um-members');
|
904 |
+
block.find('.um-member-more').hide();
|
905 |
+
block.find('.um-member-meta').slideDown( function(){ UM_Member_Grid( container ) } );
|
906 |
+
block.find('.um-member-less').fadeIn( );
|
907 |
+
|
908 |
+
setTimeout(function(){ UM_Member_Grid( container ) }, 100);
|
909 |
+
|
910 |
+
return false;
|
911 |
+
});
|
912 |
+
|
913 |
+
jQuery( document.body ).on('click', '.um-directory .um-members.um-members-grid .um-member-less a', function(e){
|
914 |
+
e.preventDefault();
|
915 |
+
|
916 |
+
var block = jQuery(this).parents('.um-member');
|
917 |
+
var container = jQuery(this).parents('.um-members');
|
918 |
+
block.find('.um-member-less').hide();
|
919 |
+
block.find('.um-member-meta').slideUp( function() {
|
920 |
+
block.find('.um-member-more').fadeIn();
|
921 |
+
UM_Member_Grid( container );
|
922 |
+
});
|
923 |
+
|
924 |
+
return false;
|
925 |
+
});
|
926 |
+
|
927 |
+
/**
|
928 |
+
* END: Profile Cards actions
|
929 |
+
*/
|
930 |
+
|
931 |
+
|
932 |
+
//filters controls
|
933 |
+
jQuery('.um-member-directory-filters-a').on( 'click', function() {
|
934 |
+
var obj = jQuery(this);
|
935 |
+
var search_bar = obj.parents('.um-directory').find('.um-search');
|
936 |
+
|
937 |
+
if ( search_bar.is( ':visible' ) ) {
|
938 |
+
search_bar.slideUp( 250, function(){
|
939 |
+
obj.toggleClass('um-member-directory-filters-visible');
|
940 |
+
search_bar.parents('.um-member-directory-header-row').toggleClass('um-header-row-invisible');
|
941 |
+
});
|
942 |
+
} else {
|
943 |
+
search_bar.slideDown({
|
944 |
+
duration: 250,
|
945 |
+
start: function() {
|
946 |
+
jQuery(this).css({
|
947 |
+
display: "grid"
|
948 |
+
});
|
949 |
+
obj.toggleClass('um-member-directory-filters-visible');
|
950 |
+
search_bar.parents('.um-member-directory-header-row').toggleClass('um-header-row-invisible');
|
951 |
+
}
|
952 |
+
} );
|
953 |
+
}
|
954 |
+
});
|
955 |
+
|
956 |
+
|
957 |
+
//filtration process
|
958 |
+
jQuery( document.body ).on( 'change', '.um-directory .um-search-filter select', function() {
|
959 |
+
var selected_val = um_sanitize_value( jQuery(this).val() );
|
960 |
+
|
961 |
+
if ( selected_val === '' ) {
|
962 |
+
return;
|
963 |
+
}
|
964 |
+
|
965 |
+
var directory = jQuery(this).parents('.um-directory');
|
966 |
+
|
967 |
+
if ( um_is_directory_busy( directory ) ) {
|
968 |
+
return;
|
969 |
+
}
|
970 |
+
|
971 |
+
um_members_show_preloader( directory );
|
972 |
+
|
973 |
+
var filter_name = jQuery(this).prop('name');
|
974 |
+
|
975 |
+
var current_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
976 |
+
if ( typeof current_value == 'undefined' ) {
|
977 |
+
current_value = [];
|
978 |
+
} else {
|
979 |
+
current_value = current_value.split( '||' );
|
980 |
+
}
|
981 |
+
|
982 |
+
if ( -1 === jQuery.inArray( selected_val, current_value ) ) {
|
983 |
+
current_value.push( selected_val );
|
984 |
+
current_value = current_value.join( '||' );
|
985 |
+
|
986 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
987 |
+
|
988 |
+
//set 1st page after filtration
|
989 |
+
directory.data( 'page', 1 );
|
990 |
+
um_set_url_from_data( directory, 'page', '' );
|
991 |
+
}
|
992 |
+
|
993 |
+
//disable options and disable select if all options are disabled
|
994 |
+
jQuery(this).find('option[value="' + selected_val + '"]').prop('disabled', true).hide();
|
995 |
+
if ( jQuery(this).find('option:not(:disabled)').length === 1 ) {
|
996 |
+
jQuery(this).prop('disabled', true);
|
997 |
+
}
|
998 |
+
|
999 |
+
var obj = jQuery(this);
|
1000 |
+
obj.select2('destroy').select2({
|
1001 |
+
dropdownParent: obj.parent()
|
1002 |
+
});
|
1003 |
+
obj.val('').trigger( 'change' );
|
1004 |
+
|
1005 |
+
um_ajax_get_members( directory );
|
1006 |
+
|
1007 |
+
um_change_tag( directory );
|
1008 |
+
|
1009 |
+
directory.data( 'searched', 1 );
|
1010 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1011 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1012 |
+
// if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
1013 |
+
// jQuery(this).trigger('change');
|
1014 |
+
// }
|
1015 |
+
});
|
1016 |
+
|
1017 |
+
|
1018 |
+
jQuery( document.body ).on( 'blur', '.um-directory .um-search-filter.um-text-filter-type input[type="text"]', function() {
|
1019 |
+
var directory = jQuery(this).parents('.um-directory');
|
1020 |
+
|
1021 |
+
if ( um_is_directory_busy( directory ) ) {
|
1022 |
+
return;
|
1023 |
+
}
|
1024 |
+
|
1025 |
+
var current_value = um_sanitize_value( jQuery(this).val() );
|
1026 |
+
var filter_name = jQuery(this).prop('name');
|
1027 |
+
var url_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1028 |
+
|
1029 |
+
if ( typeof url_value == 'undefined' ) {
|
1030 |
+
url_value = '';
|
1031 |
+
}
|
1032 |
+
|
1033 |
+
if ( current_value === url_value ) {
|
1034 |
+
return;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
um_members_show_preloader( directory );
|
1038 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1039 |
+
|
1040 |
+
//set 1st page after filtration
|
1041 |
+
directory.data( 'page', 1 );
|
1042 |
+
um_set_url_from_data( directory, 'page', '' );
|
1043 |
+
|
1044 |
+
um_ajax_get_members( directory );
|
1045 |
+
|
1046 |
+
um_change_tag( directory );
|
1047 |
+
|
1048 |
+
directory.data( 'searched', 1 );
|
1049 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1050 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1051 |
+
});
|
1052 |
+
|
1053 |
+
|
1054 |
+
//make search on Enter click
|
1055 |
+
jQuery( document.body ).on( 'keypress', '.um-directory .um-search-filter.um-text-filter-type input[type="text"]', function(e) {
|
1056 |
+
if ( e.which === 13 ) {
|
1057 |
+
var directory = jQuery(this).parents('.um-directory');
|
1058 |
+
|
1059 |
+
if ( um_is_directory_busy( directory ) ) {
|
1060 |
+
return;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
var current_value = um_sanitize_value( jQuery(this).val() );
|
1064 |
+
var filter_name = jQuery(this).prop('name');
|
1065 |
+
var url_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1066 |
+
|
1067 |
+
if ( typeof url_value == 'undefined' ) {
|
1068 |
+
url_value = '';
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
if ( current_value === url_value ) {
|
1072 |
+
return;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
um_members_show_preloader( directory );
|
1076 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1077 |
+
|
1078 |
+
//set 1st page after filtration
|
1079 |
+
directory.data( 'page', 1 );
|
1080 |
+
um_set_url_from_data( directory, 'page', '' );
|
1081 |
+
|
1082 |
+
um_ajax_get_members( directory );
|
1083 |
+
|
1084 |
+
um_change_tag( directory );
|
1085 |
+
|
1086 |
+
directory.data( 'searched', 1 );
|
1087 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1088 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1089 |
+
}
|
1090 |
+
});
|
1091 |
+
|
1092 |
+
|
1093 |
+
|
1094 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-members-filter-remove', function() {
|
1095 |
+
var directory = jQuery(this).parents('.um-directory');
|
1096 |
+
|
1097 |
+
if ( um_is_directory_busy(directory) || ! directory ) {
|
1098 |
+
return;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
um_members_show_preloader( directory );
|
1102 |
+
|
1103 |
+
var removeItem = jQuery(this).data('value');
|
1104 |
+
var filter_name = jQuery(this).data('name');
|
1105 |
+
|
1106 |
+
var type = jQuery(this).data('type');
|
1107 |
+
if ( type === 'text' ) {
|
1108 |
+
um_set_url_from_data( directory, 'filter_' + filter_name,'' );
|
1109 |
+
|
1110 |
+
jQuery( '.um-search-filter input[name="' + filter_name + '"]' ).val('');
|
1111 |
+
|
1112 |
+
} else if ( type === 'select' ) {
|
1113 |
+
|
1114 |
+
var current_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1115 |
+
if ( typeof current_value == 'undefined' ) {
|
1116 |
+
current_value = [];
|
1117 |
+
} else {
|
1118 |
+
current_value = current_value.split( '||' );
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
if ( -1 !== jQuery.inArray( removeItem.toString(), current_value ) ) {
|
1122 |
+
current_value = jQuery.grep( current_value, function( value ) {
|
1123 |
+
return value !== removeItem.toString();
|
1124 |
+
});
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
if ( ! current_value.length ) {
|
1128 |
+
current_value = '';
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1132 |
+
|
1133 |
+
var select = jQuery( '.um-search-filter select[name="' + filter_name + '"]' );
|
1134 |
+
select.find('option[value="' + removeItem + '"]').prop('disabled', false).show();
|
1135 |
+
|
1136 |
+
//disable options and disable select if all options are disabled
|
1137 |
+
if ( select.find('option:not(:disabled)').length > 1 ) {
|
1138 |
+
select.prop('disabled', false);
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
select.select2('destroy').select2({
|
1142 |
+
dropdownParent: select.parent()
|
1143 |
+
});
|
1144 |
+
|
1145 |
+
if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
1146 |
+
select.trigger('change');
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
} else if ( type === 'slider' ) {
|
1150 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1151 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1152 |
+
|
1153 |
+
|
1154 |
+
var $slider = jQuery( '.um-search-filter #' + filter_name + '_min' ).siblings('.um-slider');
|
1155 |
+
var options = $slider.slider( 'option' );
|
1156 |
+
|
1157 |
+
$slider.slider( 'values', [ options.min, options.max ] );
|
1158 |
+
|
1159 |
+
jQuery( '.um-search-filter #' + filter_name + '_min' ).val('');
|
1160 |
+
jQuery( '.um-search-filter #' + filter_name + '_max' ).val('');
|
1161 |
+
|
1162 |
+
um_set_range_label( $slider );
|
1163 |
+
} else if ( type === 'datepicker' ) {
|
1164 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1165 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1166 |
+
|
1167 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1168 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1169 |
+
} else if ( type === 'timepicker' ) {
|
1170 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1171 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1172 |
+
|
1173 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1174 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1175 |
+
} else {
|
1176 |
+
wp.hooks.doAction( 'um_member_directory_filter_remove', type, directory, filter_name, removeItem );
|
1177 |
+
}
|
1178 |
+
|
1179 |
+
|
1180 |
+
//set 1st page after filtration
|
1181 |
+
directory.data( 'page', 1 );
|
1182 |
+
um_set_url_from_data( directory, 'page', '' );
|
1183 |
+
|
1184 |
+
jQuery(this).tipsy('hide');
|
1185 |
+
jQuery(this).parents('.um-members-filter-tag').remove();
|
1186 |
+
|
1187 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
1188 |
+
directory.find('.um-clear-filters').hide();
|
1189 |
+
} else {
|
1190 |
+
directory.find('.um-clear-filters').show();
|
1191 |
+
}
|
1192 |
+
|
1193 |
+
var ignore_after_search = false;
|
1194 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1195 |
+
|
1196 |
+
if ( ! ignore_after_search ) {
|
1197 |
+
var show_after_search = directory.data('must-search');
|
1198 |
+
if ( show_after_search === 1 ) {
|
1199 |
+
var search = um_get_search( directory );
|
1200 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 && ! search ) {
|
1201 |
+
directory.data( 'searched', 0 );
|
1202 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
1203 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
1204 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
1205 |
+
|
1206 |
+
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
1207 |
+
|
1208 |
+
um_members_hide_preloader( directory );
|
1209 |
+
return;
|
1210 |
+
}
|
1211 |
+
}
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1215 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1216 |
+
|
1217 |
+
um_ajax_get_members( directory );
|
1218 |
+
});
|
1219 |
+
|
1220 |
+
|
1221 |
+
jQuery( document.body ).on( 'click', '.um-directory .um-clear-filters-a', function() {
|
1222 |
+
var directory = jQuery(this).parents('.um-directory');
|
1223 |
+
if ( um_is_directory_busy( directory ) ) {
|
1224 |
+
return;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
um_members_show_preloader( directory );
|
1228 |
+
|
1229 |
+
directory.find( '.um-members-filter-remove' ).each( function() {
|
1230 |
+
var removeItem = jQuery(this).data('value');
|
1231 |
+
var filter_name = jQuery(this).data('name');
|
1232 |
+
|
1233 |
+
var type = jQuery(this).data('type');
|
1234 |
+
if ( type === 'text' ) {
|
1235 |
+
um_set_url_from_data( directory, 'filter_' + filter_name,'' );
|
1236 |
+
|
1237 |
+
jQuery( '.um-search-filter input[name="' + filter_name + '"]' ).val('');
|
1238 |
+
|
1239 |
+
} else if ( type === 'select' ) {
|
1240 |
+
|
1241 |
+
var current_value = um_get_data_for_directory( directory, 'filter_' + filter_name );
|
1242 |
+
if ( typeof current_value == 'undefined' ) {
|
1243 |
+
current_value = [];
|
1244 |
+
} else {
|
1245 |
+
current_value = current_value.split( '||' );
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
if ( -1 !== jQuery.inArray( removeItem.toString(), current_value ) ) {
|
1249 |
+
current_value = jQuery.grep( current_value, function( value ) {
|
1250 |
+
return value !== removeItem.toString();
|
1251 |
+
});
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
if ( ! current_value.length ) {
|
1255 |
+
current_value = '';
|
1256 |
+
}
|
1257 |
+
|
1258 |
+
um_set_url_from_data( directory, 'filter_' + filter_name, current_value );
|
1259 |
+
|
1260 |
+
var select = jQuery( '.um-search-filter select[name="' + filter_name + '"]' );
|
1261 |
+
select.find('option[value="' + removeItem + '"]').prop('disabled', false).show();
|
1262 |
+
|
1263 |
+
//disable options and disable select if all options are disabled
|
1264 |
+
if ( select.find('option:not(:disabled)').length > 1 ) {
|
1265 |
+
select.prop('disabled', false);
|
1266 |
+
}
|
1267 |
+
select.select2('destroy').select2({
|
1268 |
+
dropdownParent: select.parent()
|
1269 |
+
});
|
1270 |
+
|
1271 |
+
if ( directory.find( '.um-search-filter select[data-um-parent="' + filter_name + '"]' ).length > 0 ) {
|
1272 |
+
select.trigger('change');
|
1273 |
+
}
|
1274 |
+
|
1275 |
+
} else if ( type === 'slider' ) {
|
1276 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1277 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1278 |
+
|
1279 |
+
var $slider = jQuery( '.um-search-filter #' + filter_name + '_min' ).siblings('.um-slider');
|
1280 |
+
var options = $slider.slider( 'option' );
|
1281 |
+
|
1282 |
+
$slider.slider( 'values', [ options.min, options.max ] );
|
1283 |
+
|
1284 |
+
jQuery( '.um-search-filter #' + filter_name + '_min' ).val('');
|
1285 |
+
jQuery( '.um-search-filter #' + filter_name + '_max' ).val('');
|
1286 |
+
|
1287 |
+
um_set_range_label( $slider );
|
1288 |
+
} else if ( type === 'datepicker' ) {
|
1289 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1290 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1291 |
+
|
1292 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1293 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1294 |
+
} else if ( type === 'timepicker' ) {
|
1295 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from','' );
|
1296 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', '' );
|
1297 |
+
|
1298 |
+
jQuery( '.um-search-filter #' + filter_name + '_from' ).val('');
|
1299 |
+
jQuery( '.um-search-filter #' + filter_name + '_to' ).val('');
|
1300 |
+
} else {
|
1301 |
+
wp.hooks.doAction( 'um_member_directory_clear_filters', type, directory, filter_name, removeItem );
|
1302 |
+
}
|
1303 |
+
});
|
1304 |
+
|
1305 |
+
//set 1st page after filtration
|
1306 |
+
directory.data( 'page', 1 );
|
1307 |
+
um_set_url_from_data( directory, 'page', '' );
|
1308 |
+
directory.find('.um-members-filter-tag').remove();
|
1309 |
+
|
1310 |
+
//jQuery(this).hide();
|
1311 |
+
if ( directory.find( '.um-members-filter-remove' ).length === 0 ) {
|
1312 |
+
directory.find('.um-clear-filters').hide();
|
1313 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').addClass( 'um-header-row-invisible' );
|
1314 |
+
} else {
|
1315 |
+
directory.find('.um-clear-filters').show();
|
1316 |
+
directory.find('.um-clear-filters').parents('.um-member-directory-header-row').removeClass( 'um-header-row-invisible' );
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
var ignore_after_search = false;
|
1320 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1321 |
+
|
1322 |
+
if ( ! ignore_after_search ) {
|
1323 |
+
var show_after_search = directory.data('must-search');
|
1324 |
+
if ( show_after_search === 1 ) {
|
1325 |
+
var search = um_get_search( directory );
|
1326 |
+
if ( ! search ) {
|
1327 |
+
directory.data( 'searched', 0 );
|
1328 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
1329 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', true );
|
1330 |
+
directory.find( '.um-member-directory-view-type' ).addClass( 'um-disabled' );
|
1331 |
+
|
1332 |
+
wp.hooks.doAction( 'um_member_directory_clear_not_searched', directory );
|
1333 |
+
|
1334 |
+
um_members_hide_preloader( directory );
|
1335 |
+
return;
|
1336 |
+
}
|
1337 |
+
}
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1341 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1342 |
+
|
1343 |
+
um_ajax_get_members( directory );
|
1344 |
+
});
|
1345 |
+
|
1346 |
+
|
1347 |
+
/**
|
1348 |
+
* First Page Loading
|
1349 |
+
*/
|
1350 |
+
|
1351 |
+
wp.hooks.doAction( 'um_member_directory_on_first_pages_loading' );
|
1352 |
+
|
1353 |
+
//Init Directories
|
1354 |
+
jQuery( '.um-directory' ).each( function() {
|
1355 |
+
var directory = jQuery(this);
|
1356 |
+
var hash = um_members_get_hash( directory );
|
1357 |
+
|
1358 |
+
um_member_directories.push( hash );
|
1359 |
+
|
1360 |
+
// slideup/slidedown animation fix for grid filters bar
|
1361 |
+
if ( directory.find('.um-search').length ) {
|
1362 |
+
if ( ! directory.find('.um-search').is(':visible') ) {
|
1363 |
+
directory.find('.um-search').css({
|
1364 |
+
display: "grid"
|
1365 |
+
}).slideUp( 1 );
|
1366 |
+
}
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
//slider filter
|
1370 |
+
directory.find('.um-slider').each( function() {
|
1371 |
+
var slider = jQuery( this );
|
1372 |
+
var directory = slider.parents('.um-directory');
|
1373 |
+
|
1374 |
+
var filter_name = slider.data('field_name');
|
1375 |
+
|
1376 |
+
var min_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1377 |
+
var max_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1378 |
+
if ( typeof min_default_value == 'undefined' ) {
|
1379 |
+
min_default_value = parseInt( slider.data('min') );
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
if ( typeof max_default_value == 'undefined' ) {
|
1383 |
+
max_default_value = parseInt( slider.data('max') );
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
var default_value = [ min_default_value, max_default_value ];
|
1387 |
+
|
1388 |
+
slider.slider({
|
1389 |
+
range: true,
|
1390 |
+
min: parseInt( slider.data('min') ),
|
1391 |
+
max: parseInt( slider.data('max') ),
|
1392 |
+
values: default_value,
|
1393 |
+
create: function( event, ui ) {
|
1394 |
+
//console.log( ui );
|
1395 |
+
},
|
1396 |
+
step: 1,
|
1397 |
+
slide: function( event, ui ) {
|
1398 |
+
um_set_range_label( jQuery( this ), ui );
|
1399 |
+
},
|
1400 |
+
stop: function( event, ui ) {
|
1401 |
+
if ( ! um_is_directory_busy( directory ) ) {
|
1402 |
+
|
1403 |
+
um_members_show_preloader( directory );
|
1404 |
+
|
1405 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', ui.values[0] );
|
1406 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', ui.values[1] );
|
1407 |
+
|
1408 |
+
//set 1st page after filtration
|
1409 |
+
directory.data( 'page', 1 );
|
1410 |
+
um_set_url_from_data( directory, 'page', '' );
|
1411 |
+
um_ajax_get_members( directory );
|
1412 |
+
|
1413 |
+
um_change_tag( directory );
|
1414 |
+
|
1415 |
+
directory.data( 'searched', 1 );
|
1416 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1417 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1418 |
+
}
|
1419 |
+
}
|
1420 |
+
});
|
1421 |
+
|
1422 |
+
um_set_range_label( slider );
|
1423 |
+
});
|
1424 |
+
|
1425 |
+
|
1426 |
+
//datepicker filter
|
1427 |
+
directory.find('.um-datepicker-filter').each( function() {
|
1428 |
+
var elem = jQuery(this);
|
1429 |
+
|
1430 |
+
var min = new Date( elem.data('date_min')*1000 );
|
1431 |
+
var max = new Date( elem.data('date_max')*1000 );
|
1432 |
+
|
1433 |
+
var $input = elem.pickadate({
|
1434 |
+
selectYears: true,
|
1435 |
+
min: min,
|
1436 |
+
max: max,
|
1437 |
+
formatSubmit: 'yyyy/mm/dd',
|
1438 |
+
hiddenName: true,
|
1439 |
+
onOpen: function() {
|
1440 |
+
elem.blur();
|
1441 |
+
},
|
1442 |
+
onClose: function() {
|
1443 |
+
elem.blur();
|
1444 |
+
},
|
1445 |
+
onSet: function( context ) {
|
1446 |
+
|
1447 |
+
if ( ! context.select ) {
|
1448 |
+
return;
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
var directory = elem.parents('.um-directory');
|
1452 |
+
|
1453 |
+
if ( um_is_directory_busy( directory ) ) {
|
1454 |
+
return;
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
um_members_show_preloader( directory );
|
1458 |
+
|
1459 |
+
var filter_name = elem.data( 'filter_name' );
|
1460 |
+
var range = elem.data( 'range' );
|
1461 |
+
|
1462 |
+
var current_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1463 |
+
var current_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1464 |
+
if ( typeof current_value_from === "undefined" ) {
|
1465 |
+
current_value_from = min / 1000;
|
1466 |
+
}
|
1467 |
+
if ( typeof current_value_to === "undefined" ) {
|
1468 |
+
current_value_to = max / 1000;
|
1469 |
+
}
|
1470 |
+
|
1471 |
+
var select_val = context.select / 1000;
|
1472 |
+
var change_val = elem.val();
|
1473 |
+
|
1474 |
+
if ( range === 'from' ) {
|
1475 |
+
current_value_from = select_val;
|
1476 |
+
} else if ( range === 'to' ) {
|
1477 |
+
current_value_to = select_val;
|
1478 |
+
}
|
1479 |
+
|
1480 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', current_value_from );
|
1481 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', current_value_to );
|
1482 |
+
|
1483 |
+
//set 1st page after filtration
|
1484 |
+
directory.data( 'page', 1 );
|
1485 |
+
um_set_url_from_data( directory, 'page', '' );
|
1486 |
+
|
1487 |
+
um_ajax_get_members( directory );
|
1488 |
+
|
1489 |
+
um_change_tag( directory );
|
1490 |
+
|
1491 |
+
directory.data( 'searched', 1 );
|
1492 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1493 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1494 |
+
}
|
1495 |
+
});
|
1496 |
+
|
1497 |
+
var $picker = $input.pickadate('picker');
|
1498 |
+
var $fname = elem.data('filter_name');
|
1499 |
+
var $frange = elem.data('range');
|
1500 |
+
var $directory = elem.parents('.um-directory');
|
1501 |
+
|
1502 |
+
var query_value = um_get_data_for_directory( $directory, 'filter_' + $fname + '_' + $frange );
|
1503 |
+
if ( typeof query_value !== 'undefined' ) {
|
1504 |
+
$picker.set( 'select', query_value*1000 );
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
});
|
1508 |
+
|
1509 |
+
|
1510 |
+
//timepicker filter
|
1511 |
+
directory.find('.um-timepicker-filter').each( function() {
|
1512 |
+
var elem = jQuery(this);
|
1513 |
+
var elemID = elem.attr('id');
|
1514 |
+
var elem_filter_name = elem.data('filter_name');
|
1515 |
+
|
1516 |
+
//using arrays formatted as [HOUR,MINUTE]
|
1517 |
+
var min = elem.attr('data-min');
|
1518 |
+
var max = elem.attr('data-max');
|
1519 |
+
|
1520 |
+
var picker_min = min.split(':');
|
1521 |
+
var picker_max = max.split(':');
|
1522 |
+
|
1523 |
+
var $input = elem.pickatime({
|
1524 |
+
format: elem.data('format'),
|
1525 |
+
interval: parseInt( elem.data('intervals') ),
|
1526 |
+
min: [picker_min[0],picker_min[1]],
|
1527 |
+
max: [picker_max[0],picker_max[1]],
|
1528 |
+
formatSubmit: 'HH:i',
|
1529 |
+
hiddenName: true,
|
1530 |
+
onOpen: function() { elem.blur(); },
|
1531 |
+
onClose: function() { elem.blur(); },
|
1532 |
+
onSet: function( context ) {
|
1533 |
+
|
1534 |
+
if ( ! context.select ) {
|
1535 |
+
return;
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
var directory = elem.parents('.um-directory');
|
1539 |
+
|
1540 |
+
if ( um_is_directory_busy( directory ) ) {
|
1541 |
+
return;
|
1542 |
+
}
|
1543 |
+
|
1544 |
+
um_members_show_preloader( directory );
|
1545 |
+
|
1546 |
+
var filter_name = elem.data( 'filter_name' );
|
1547 |
+
var range = elem.data( 'range' );
|
1548 |
+
|
1549 |
+
var current_value_from = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1550 |
+
var current_value_to = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1551 |
+
if ( typeof current_value_from === "undefined" ) {
|
1552 |
+
current_value_from = min;
|
1553 |
+
}
|
1554 |
+
if ( typeof current_value_to === "undefined" ) {
|
1555 |
+
current_value_to = max;
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
if ( typeof context.select !== 'undefined' ) {
|
1559 |
+
var select_val = um_time_convert( context.select, range );
|
1560 |
+
|
1561 |
+
//var select_val = context.select / 60;
|
1562 |
+
|
1563 |
+
if ( range === 'from' ) {
|
1564 |
+
current_value_from = select_val;
|
1565 |
+
} else if ( range === 'to' ) {
|
1566 |
+
current_value_to = select_val;
|
1567 |
+
}
|
1568 |
+
} else {
|
1569 |
+
if ( range === 'from' ) {
|
1570 |
+
current_value_from = min;
|
1571 |
+
} else if ( range === 'to' ) {
|
1572 |
+
current_value_to = max;
|
1573 |
+
}
|
1574 |
+
}
|
1575 |
+
|
1576 |
+
var time = jQuery( '#' + elemID ).val();
|
1577 |
+
|
1578 |
+
if ( elem.data('range') === 'from' ) {
|
1579 |
+
jQuery( '#' + elem_filter_name + '_to' ).pickatime('picker').set('min', time);
|
1580 |
+
} else {
|
1581 |
+
jQuery( '#' + elem_filter_name + '_from').pickatime('picker').set('max', time);
|
1582 |
+
}
|
1583 |
+
|
1584 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_from', current_value_from );
|
1585 |
+
um_set_url_from_data( directory, 'filter_' + filter_name + '_to', current_value_to );
|
1586 |
+
|
1587 |
+
//set 1st page after filtration
|
1588 |
+
directory.data( 'page', 1 );
|
1589 |
+
um_set_url_from_data( directory, 'page', '' );
|
1590 |
+
|
1591 |
+
um_ajax_get_members( directory );
|
1592 |
+
|
1593 |
+
um_change_tag( directory );
|
1594 |
+
|
1595 |
+
directory.data( 'searched', 1 );
|
1596 |
+
directory.find( '.um-member-directory-sorting-options' ).prop( 'disabled', false );
|
1597 |
+
directory.find( '.um-member-directory-view-type' ).removeClass( 'um-disabled' );
|
1598 |
+
|
1599 |
+
}
|
1600 |
+
});
|
1601 |
+
|
1602 |
+
// first loading timepicker select
|
1603 |
+
var $picker = $input.pickatime('picker');
|
1604 |
+
var $fname = elem.data('filter_name');
|
1605 |
+
var $frange = elem.data('range');
|
1606 |
+
var $directory = elem.parents('.um-directory');
|
1607 |
+
|
1608 |
+
var query_value = um_get_data_for_directory( $directory, 'filter_' + $fname + '_' + $frange );
|
1609 |
+
if ( typeof query_value !== 'undefined' ) {
|
1610 |
+
var arr = query_value.split(':');
|
1611 |
+
$picker.set( 'select', arr[0]*60 + arr[1]*1 );
|
1612 |
+
}
|
1613 |
+
|
1614 |
+
});
|
1615 |
+
|
1616 |
+
wp.hooks.doAction( 'um_member_directory_on_init', directory, hash );
|
1617 |
+
|
1618 |
+
var ignore_after_search = false;
|
1619 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1620 |
+
|
1621 |
+
if ( ! ignore_after_search ) {
|
1622 |
+
var show_after_search = directory.data('must-search');
|
1623 |
+
if ( show_after_search === 1 ) {
|
1624 |
+
var search = um_get_search( directory );
|
1625 |
+
var filters_data = um_get_filters_data( directory );
|
1626 |
+
if ( ! filters_data.length && ! search ) {
|
1627 |
+
return;
|
1628 |
+
}
|
1629 |
+
}
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
var prevent_default = wp.hooks.applyFilters( 'um_member_directory_prevent_default_first_loading', false, directory, hash );
|
1633 |
+
|
1634 |
+
if ( ! prevent_default ) {
|
1635 |
+
um_members_show_preloader( directory );
|
1636 |
+
um_ajax_get_members( directory, {first_load:true} );
|
1637 |
+
um_change_tag( directory );
|
1638 |
+
}
|
1639 |
+
});
|
1640 |
+
|
1641 |
+
|
1642 |
+
//history events when back/forward and change window.location.hash
|
1643 |
+
window.addEventListener( "popstate", function(e) {
|
1644 |
+
jQuery( '.um-directory' ).each( function() {
|
1645 |
+
var directory = jQuery(this);
|
1646 |
+
var hash = um_members_get_hash( directory );
|
1647 |
+
um_member_directories.push( hash );
|
1648 |
+
|
1649 |
+
um_members_show_preloader( directory );
|
1650 |
+
|
1651 |
+
// clear layout and header
|
1652 |
+
directory.find('.um-members-grid, .um-members-list, .um-members-intro').remove();
|
1653 |
+
|
1654 |
+
// set search from history
|
1655 |
+
if ( directory.find( '.um-member-directory-search-line' ).length ) {
|
1656 |
+
var search = um_get_data_for_directory( directory, 'search' );
|
1657 |
+
if ( typeof search == 'undefined' ) {
|
1658 |
+
search = '';
|
1659 |
+
}
|
1660 |
+
directory.data( 'general_search', search );
|
1661 |
+
directory.find('.um-search-line').val( search );
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
var page = um_get_data_for_directory( directory, 'page' );
|
1665 |
+
if ( typeof page == 'undefined' ) {
|
1666 |
+
page = 1;
|
1667 |
+
} else if ( page > directory.data( 'total_pages' ) ) {
|
1668 |
+
page = directory.data( 'total_pages' );
|
1669 |
+
}
|
1670 |
+
|
1671 |
+
directory.data( 'page', page ).attr( 'data-page', page );
|
1672 |
+
|
1673 |
+
//sorting from history
|
1674 |
+
if ( directory.find( '.um-member-directory-sorting' ).length ) {
|
1675 |
+
var sort = um_get_data_for_directory( directory, 'sort' );
|
1676 |
+
if ( typeof sort == 'undefined' ) {
|
1677 |
+
sort = directory.find( '.um-new-dropdown[data-element=".um-member-directory-sorting-a"]' ).find('a[data-default="1"]').data('value');
|
1678 |
+
}
|
1679 |
+
directory.data( 'sorting', sort );
|
1680 |
+
|
1681 |
+
var sort_dropdown = directory.find( '.um-new-dropdown[data-element=".um-member-directory-sorting-a"]' );
|
1682 |
+
sort_dropdown.find('a').data('selected', 0).prop('data-selected', 0).attr('data-selected', 0);
|
1683 |
+
sort_dropdown.find('a[data-value="' + sort + '"]').data('selected', 1).prop('data-selected', 1).attr('data-selected', 1);
|
1684 |
+
directory.find('.um-member-directory-sorting-a').find('> a').html( sort_dropdown.find('a[data-value="' + sort + '"]').html() );
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
//view type from history
|
1688 |
+
if ( directory.find( '.um-member-directory-view-type' ).length ) {
|
1689 |
+
var layout = um_get_data_for_directory( directory, 'view_type' );
|
1690 |
+
if ( typeof layout == 'undefined' ) {
|
1691 |
+
layout = directory.find( '.um-member-directory-view-type-a[data-default="1"]' ).data('type');
|
1692 |
+
}
|
1693 |
+
directory.data( 'view_type', layout );
|
1694 |
+
|
1695 |
+
directory.find('.um-member-directory-view-type .um-member-directory-view-type-a').hide();
|
1696 |
+
directory.find('.um-member-directory-view-type .um-member-directory-view-type-a[data-type="' + layout + '"]').show();
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
//datepicker filter
|
1700 |
+
directory.find('.um-datepicker-filter').each( function() {
|
1701 |
+
var elem = jQuery(this);
|
1702 |
+
|
1703 |
+
var $picker = elem.pickadate('picker');
|
1704 |
+
var $fname = elem.data('filter_name');
|
1705 |
+
var $frange = elem.data('range');
|
1706 |
+
|
1707 |
+
var query_value = um_get_data_for_directory( directory, 'filter_' + $fname + '_' + $frange );
|
1708 |
+
if ( typeof query_value !== 'undefined' ) {
|
1709 |
+
$picker.set( 'select', query_value*1000 );
|
1710 |
+
} else {
|
1711 |
+
$picker.clear();
|
1712 |
+
}
|
1713 |
+
});
|
1714 |
+
|
1715 |
+
directory.find('.um-slider').each( function() {
|
1716 |
+
var slider = jQuery( this );
|
1717 |
+
var filter_name = slider.data('field_name');
|
1718 |
+
|
1719 |
+
var min_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_from' );
|
1720 |
+
var max_default_value = um_get_data_for_directory( directory, 'filter_' + filter_name + '_to' );
|
1721 |
+
if ( typeof min_default_value == 'undefined' ) {
|
1722 |
+
min_default_value = slider.data('min');
|
1723 |
+
}
|
1724 |
+
min_default_value = parseInt( min_default_value );
|
1725 |
+
|
1726 |
+
if ( typeof max_default_value == 'undefined' ) {
|
1727 |
+
max_default_value = slider.data('max');
|
1728 |
+
}
|
1729 |
+
max_default_value = parseInt( max_default_value );
|
1730 |
+
|
1731 |
+
slider.slider( 'values', [min_default_value, max_default_value] );
|
1732 |
+
um_set_range_label( slider );
|
1733 |
+
});
|
1734 |
+
|
1735 |
+
//timepicker filter
|
1736 |
+
directory.find('.um-timepicker-filter').each( function() {
|
1737 |
+
var elem = jQuery(this);
|
1738 |
+
|
1739 |
+
var $picker = elem.pickatime('picker');
|
1740 |
+
var $fname = elem.data('filter_name');
|
1741 |
+
var $frange = elem.data('range');
|
1742 |
+
|
1743 |
+
var query_value = um_get_data_for_directory( directory, 'filter_' + $fname + '_' + $frange );
|
1744 |
+
if ( typeof query_value !== 'undefined' ) {
|
1745 |
+
var arr = query_value.split(':');
|
1746 |
+
$picker.set( 'select', arr[0]*60 );
|
1747 |
+
} else {
|
1748 |
+
$picker.clear();
|
1749 |
+
}
|
1750 |
+
});
|
1751 |
+
|
1752 |
+
var ignore_after_search = false;
|
1753 |
+
ignore_after_search = wp.hooks.applyFilters( 'um_member_directory_ignore_after_search', ignore_after_search, directory );
|
1754 |
+
|
1755 |
+
if ( ! ignore_after_search ) {
|
1756 |
+
var show_after_search = directory.data('must-search');
|
1757 |
+
if ( show_after_search === 1 ) {
|
1758 |
+
var search = um_get_search( directory );
|
1759 |
+
var filters_data = um_get_filters_data( directory );
|
1760 |
+
if ( ! filters_data.length && ! search ) {
|
1761 |
+
directory.data( 'searched', 0 );
|
1762 |
+
um_members_hide_preloader( directory );
|
1763 |
+
return;
|
1764 |
+
} else {
|
1765 |
+
directory.data( 'searched', 1 );
|
1766 |
+
}
|
1767 |
+
}
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
var prevent_default = wp.hooks.applyFilters( 'um_member_directory_prevent_default_first_loading', false, directory, hash );
|
1771 |
+
|
1772 |
+
if ( ! prevent_default ) {
|
1773 |
+
um_ajax_get_members( directory );
|
1774 |
+
um_change_tag( directory );
|
1775 |
+
}
|
1776 |
+
});
|
1777 |
+
});
|
1778 |
+
|
1779 |
+
});
|
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))&&(_[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))&&(_[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.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=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(){if(""!==jQuery(this).val()){var e=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(e)){um_members_show_preloader(e);var r=jQuery(this).prop("name"),t=um_get_data_for_directory(e,"filter_"+r);t=void 0===t?[]:t.split("||"),-1===jQuery.inArray(jQuery(this).val(),t)&&(t.push(jQuery(this).val()),um_set_url_from_data(e,"filter_"+r,t=t.join("||")),e.data("page",1),um_set_url_from_data(e,"page","")),jQuery(this).find('option[value="'+jQuery(this).val()+'"]').prop("disabled",!0).hide(),1===jQuery(this).find("option:not(:disabled)").length&&jQuery(this).prop("disabled",!0);var a=jQuery(this);a.select2("destroy").select2({dropdownParent:a.parent()}),a.val("").trigger("change"),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("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=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=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.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=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))&&(_[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))&&(_[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.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=um_sanitize_value(jQuery(this).val());if(""!==e){var r=jQuery(this).parents(".um-directory");if(!um_is_directory_busy(r)){um_members_show_preloader(r);var t=jQuery(this).prop("name"),a=um_get_data_for_directory(r,"filter_"+t);a=void 0===a?[]:a.split("||"),-1===jQuery.inArray(e,a)&&(a.push(e),um_set_url_from_data(r,"filter_"+t,a=a.join("||")),r.data("page",1),um_set_url_from_data(r,"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 i=jQuery(this);i.select2("destroy").select2({dropdownParent:i.parent()}),i.val("").trigger("change"),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("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.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))})})});
|
assets/js/um-scripts.js
CHANGED
@@ -1,687 +1,699 @@
|
|
1 |
-
function
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
var
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
var
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
}
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
}
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
var
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
obj
|
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 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
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 |
-
jQuery(this).
|
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 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
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 |
-
|
432 |
-
|
433 |
-
|
434 |
-
}
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
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 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
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 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
if (
|
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 |
-
|
686 |
-
|
687 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function um_sanitize_value( value, el ) {
|
2 |
+
var element = document.createElement( 'div' );
|
3 |
+
element.innerText = value;
|
4 |
+
var sanitized_value = element.innerHTML;
|
5 |
+
if ( el ) {
|
6 |
+
jQuery( el ).val( sanitized_value );
|
7 |
+
}
|
8 |
+
|
9 |
+
return sanitized_value;
|
10 |
+
}
|
11 |
+
|
12 |
+
|
13 |
+
function um_init_datetimepicker() {
|
14 |
+
jQuery('.um-datepicker:not(.picker__input)').each(function(){
|
15 |
+
var elem = jQuery(this);
|
16 |
+
|
17 |
+
var disable = false;
|
18 |
+
if ( typeof elem.attr('data-disabled_weekdays') != 'undefined' && elem.attr('data-disabled_weekdays') !== '' ) {
|
19 |
+
disable = JSON.parse( elem.attr('data-disabled_weekdays') );
|
20 |
+
}
|
21 |
+
|
22 |
+
var years_n = null;
|
23 |
+
if ( typeof elem.attr('data-years') != 'undefined' ) {
|
24 |
+
years_n = elem.attr('data-years');
|
25 |
+
}
|
26 |
+
|
27 |
+
var minRange = elem.attr('data-date_min');
|
28 |
+
var maxRange = elem.attr('data-date_max');
|
29 |
+
|
30 |
+
var minSplit = [], maxSplit = [];
|
31 |
+
if ( typeof minRange != 'undefined' ) {
|
32 |
+
minSplit = minRange.split(",");
|
33 |
+
}
|
34 |
+
if ( typeof maxRange != 'undefined' ) {
|
35 |
+
maxSplit = maxRange.split(",");
|
36 |
+
}
|
37 |
+
|
38 |
+
var min = minSplit.length ? new Date(minSplit) : null;
|
39 |
+
var max = minSplit.length ? new Date(maxSplit) : null;
|
40 |
+
|
41 |
+
// fix min date for safari
|
42 |
+
if ( min && min.toString() == 'Invalid Date' && minSplit.length == 3 ) {
|
43 |
+
var minDateString = minSplit[1] + '/' + minSplit[2] + '/' + minSplit[0];
|
44 |
+
min = new Date(Date.parse(minDateString));
|
45 |
+
}
|
46 |
+
|
47 |
+
// fix max date for safari
|
48 |
+
if ( max && max.toString() == 'Invalid Date' && maxSplit.length == 3 ) {
|
49 |
+
var maxDateString = maxSplit[1] + '/' + maxSplit[2] + '/' + maxSplit[0];
|
50 |
+
max = new Date(Date.parse(maxDateString));
|
51 |
+
}
|
52 |
+
|
53 |
+
var data = {
|
54 |
+
disable: disable,
|
55 |
+
format: elem.attr( 'data-format' ),
|
56 |
+
formatSubmit: 'yyyy/mm/dd',
|
57 |
+
hiddenName: true,
|
58 |
+
onOpen: function() { elem.blur(); },
|
59 |
+
onClose: function() { elem.blur(); }
|
60 |
+
};
|
61 |
+
|
62 |
+
if ( years_n !== null ) {
|
63 |
+
data.selectYears = years_n;
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( min !== null ) {
|
67 |
+
data.min = min;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( max !== null ) {
|
71 |
+
data.max = max;
|
72 |
+
}
|
73 |
+
|
74 |
+
elem.pickadate( data );
|
75 |
+
});
|
76 |
+
|
77 |
+
jQuery('.um-timepicker:not(.picker__input)').each(function(){
|
78 |
+
var elem = jQuery(this);
|
79 |
+
|
80 |
+
elem.pickatime({
|
81 |
+
format: elem.attr('data-format'),
|
82 |
+
interval: parseInt( elem.attr('data-intervals') ),
|
83 |
+
formatSubmit: 'HH:i',
|
84 |
+
hiddenName: true,
|
85 |
+
onOpen: function() { elem.blur(); },
|
86 |
+
onClose: function() { elem.blur(); }
|
87 |
+
});
|
88 |
+
});
|
89 |
+
}
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
function init_tipsy() {
|
94 |
+
if ( typeof( jQuery.fn.tipsy ) === 'function' ) {
|
95 |
+
jQuery('.um-tip-n').tipsy({gravity: 'n', opacity: 1, live: 'a.live', offset: 3 });
|
96 |
+
jQuery('.um-tip-w').tipsy({gravity: 'w', opacity: 1, live: 'a.live', offset: 3 });
|
97 |
+
jQuery('.um-tip-e').tipsy({gravity: 'e', opacity: 1, live: 'a.live', offset: 3 });
|
98 |
+
jQuery('.um-tip-s').tipsy({gravity: 's', opacity: 1, live: 'a.live', offset: 3 });
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
jQuery(document).ready(function() {
|
103 |
+
|
104 |
+
jQuery( document.body ).on('click', '.um-dropdown a.real_url', function() {
|
105 |
+
window.location = jQuery(this).attr('href');
|
106 |
+
});
|
107 |
+
|
108 |
+
jQuery( document.body ).on( 'click', '.um-trigger-menu-on-click', function() {
|
109 |
+
var menu = jQuery(this).find('.um-dropdown');
|
110 |
+
UM.dropdown.show( menu );
|
111 |
+
return false;
|
112 |
+
});
|
113 |
+
|
114 |
+
jQuery( document.body ).on('click', '.um-dropdown-hide', function() {
|
115 |
+
UM.dropdown.hideAll();
|
116 |
+
return false;
|
117 |
+
});
|
118 |
+
|
119 |
+
jQuery( document.body ).on('click', 'a.um-manual-trigger', function() {
|
120 |
+
var child = jQuery(this).attr('data-child');
|
121 |
+
var parent = jQuery(this).attr('data-parent');
|
122 |
+
jQuery(this).parents( parent ).find( child ).trigger('click');
|
123 |
+
UM.dropdown.hideAll();
|
124 |
+
return false;
|
125 |
+
});
|
126 |
+
|
127 |
+
jQuery('.um-s1,.um-s2').css({'display':'block'});
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Unselect empty option if something is selected
|
131 |
+
*
|
132 |
+
* @since 2.1.16
|
133 |
+
* @param {object} e
|
134 |
+
* @returns {undefined}
|
135 |
+
*/
|
136 |
+
function unselectEmptyOption( e ) {
|
137 |
+
var $element = jQuery( e.currentTarget );
|
138 |
+
var $selected = $element.find(':selected');
|
139 |
+
|
140 |
+
if ( $selected.length > 1 ) {
|
141 |
+
$selected.each( function ( i, option ) {
|
142 |
+
if ( option.value === '' ) {
|
143 |
+
option.selected = false;
|
144 |
+
$element.trigger( 'change' );
|
145 |
+
}
|
146 |
+
});
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
if ( typeof( jQuery.fn.select2 ) === 'function' ) {
|
151 |
+
jQuery(".um-s1").each( function( e ) {
|
152 |
+
var obj = jQuery(this);
|
153 |
+
|
154 |
+
obj.select2({
|
155 |
+
allowClear: true,
|
156 |
+
dropdownParent: obj.parent()
|
157 |
+
}).on( 'change', unselectEmptyOption );
|
158 |
+
} );
|
159 |
+
|
160 |
+
jQuery(".um-s2").each( function( e ) {
|
161 |
+
var obj = jQuery(this);
|
162 |
+
|
163 |
+
obj.select2({
|
164 |
+
allowClear: false,
|
165 |
+
minimumResultsForSearch: 10,
|
166 |
+
dropdownParent: obj.parent()
|
167 |
+
}).on( 'change', unselectEmptyOption );
|
168 |
+
} );
|
169 |
+
|
170 |
+
jQuery(".um-s3").each( function( e ) {
|
171 |
+
var obj = jQuery(this);
|
172 |
+
|
173 |
+
obj.select2({
|
174 |
+
allowClear: false,
|
175 |
+
minimumResultsForSearch: -1,
|
176 |
+
dropdownParent: obj.parent()
|
177 |
+
}).on( 'change', unselectEmptyOption );
|
178 |
+
} );
|
179 |
+
}
|
180 |
+
|
181 |
+
init_tipsy();
|
182 |
+
|
183 |
+
if ( typeof( jQuery.fn.um_raty ) === 'function' ) {
|
184 |
+
jQuery('.um-rating').um_raty({
|
185 |
+
half: false,
|
186 |
+
starType: 'i',
|
187 |
+
number: function() {
|
188 |
+
return jQuery(this).attr('data-number');
|
189 |
+
},
|
190 |
+
score: function() {
|
191 |
+
return jQuery(this).attr('data-score');
|
192 |
+
},
|
193 |
+
scoreName: function() {
|
194 |
+
return jQuery(this).attr('data-key');
|
195 |
+
},
|
196 |
+
hints: false,
|
197 |
+
click: function( score, evt ) {
|
198 |
+
um_live_field = this.id;
|
199 |
+
um_live_value = score;
|
200 |
+
um_apply_conditions( jQuery(this), false );
|
201 |
+
}
|
202 |
+
});
|
203 |
+
|
204 |
+
jQuery('.um-rating-readonly').um_raty({
|
205 |
+
half: false,
|
206 |
+
starType: 'i',
|
207 |
+
number: function() {
|
208 |
+
return jQuery(this).attr('data-number');
|
209 |
+
},
|
210 |
+
score: function() {
|
211 |
+
return jQuery(this).attr('data-score');
|
212 |
+
},
|
213 |
+
scoreName: function() {
|
214 |
+
return jQuery(this).attr('data-key');
|
215 |
+
},
|
216 |
+
hints: false,
|
217 |
+
readOnly: true
|
218 |
+
});
|
219 |
+
}
|
220 |
+
|
221 |
+
jQuery(document).on('change', '.um-field-area input[type="radio"]', function() {
|
222 |
+
var field = jQuery(this).parents('.um-field-area');
|
223 |
+
var this_field = jQuery(this).parents('label');
|
224 |
+
field.find('.um-field-radio').removeClass('active');
|
225 |
+
field.find('.um-field-radio').find('i').removeAttr('class').addClass('um-icon-android-radio-button-off');
|
226 |
+
this_field.addClass('active');
|
227 |
+
this_field.find('i').removeAttr('class').addClass('um-icon-android-radio-button-on');
|
228 |
+
});
|
229 |
+
|
230 |
+
jQuery(document).on('change', '.um-field-area input[type="checkbox"]', function() {
|
231 |
+
var this_field = jQuery(this).parents('label');
|
232 |
+
if ( this_field.hasClass('active') ) {
|
233 |
+
this_field.removeClass('active');
|
234 |
+
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline-blank');
|
235 |
+
} else {
|
236 |
+
this_field.addClass('active');
|
237 |
+
this_field.find('i').removeAttr('class').addClass('um-icon-android-checkbox-outline');
|
238 |
+
}
|
239 |
+
});
|
240 |
+
|
241 |
+
|
242 |
+
um_init_datetimepicker();
|
243 |
+
|
244 |
+
jQuery(document).on('click', '.um .um-single-image-preview a.cancel', function( e ) {
|
245 |
+
e.preventDefault();
|
246 |
+
var parent = jQuery(this).parents('.um-field');
|
247 |
+
|
248 |
+
var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
|
249 |
+
|
250 |
+
var src = jQuery(this).parents('.um-field').find('.um-single-image-preview img').attr('src');
|
251 |
+
var mode = parent.data('mode');
|
252 |
+
|
253 |
+
var args = {
|
254 |
+
data: {
|
255 |
+
mode: mode,
|
256 |
+
filename: filename,
|
257 |
+
src: src,
|
258 |
+
nonce: um_scripts.nonce
|
259 |
+
},
|
260 |
+
success: function() {
|
261 |
+
parent.find('.um-single-image-preview img').attr( 'src', '' );
|
262 |
+
parent.find('.um-single-image-preview').hide();
|
263 |
+
parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
|
264 |
+
parent.find('input[type="hidden"]').val( 'empty_file' );
|
265 |
+
}
|
266 |
+
};
|
267 |
+
|
268 |
+
if ( mode !== 'register' ) {
|
269 |
+
args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
|
270 |
+
}
|
271 |
+
|
272 |
+
wp.ajax.send( 'um_remove_file', args );
|
273 |
+
|
274 |
+
return false;
|
275 |
+
});
|
276 |
+
|
277 |
+
jQuery(document).on('click', '.um .um-single-file-preview a.cancel', function( e ) {
|
278 |
+
e.preventDefault();
|
279 |
+
var parent = jQuery(this).parents('.um-field');
|
280 |
+
var filename = parent.find( 'input[type="hidden"]#' + parent.data('key') + '-' + jQuery(this).parents('form').find('input[type="hidden"][name="form_id"]').val() ).val();
|
281 |
+
var src = jQuery(this).parents('.um-field').find('.um-single-fileinfo a').attr('href');
|
282 |
+
var mode = parent.data('mode');
|
283 |
+
|
284 |
+
var args = {
|
285 |
+
data: {
|
286 |
+
mode: mode,
|
287 |
+
filename: filename,
|
288 |
+
src: src,
|
289 |
+
nonce: um_scripts.nonce
|
290 |
+
},
|
291 |
+
success: function() {
|
292 |
+
parent.find('.um-single-file-preview').hide();
|
293 |
+
parent.find('.um-btn-auto-width').html( parent.data('upload-label') );
|
294 |
+
parent.find('input[type=hidden]').val( 'empty_file' );
|
295 |
+
}
|
296 |
+
};
|
297 |
+
|
298 |
+
if ( mode !== 'register' ) {
|
299 |
+
args.data.user_id = jQuery(this).parents('form' ).find( '#user_id' ).val();
|
300 |
+
}
|
301 |
+
|
302 |
+
wp.ajax.send( 'um_remove_file', args );
|
303 |
+
|
304 |
+
return false;
|
305 |
+
});
|
306 |
+
|
307 |
+
jQuery(document).on('click', '.um-field-group-head:not(.disabled)', function() {
|
308 |
+
var field = jQuery(this).parents('.um-field-group');
|
309 |
+
var limit = field.data('max_entries');
|
310 |
+
|
311 |
+
if ( field.find('.um-field-group-body').is(':hidden')){
|
312 |
+
field.find('.um-field-group-body').show();
|
313 |
+
} else {
|
314 |
+
field.find('.um-field-group-body:first').clone().appendTo( field );
|
315 |
+
}
|
316 |
+
|
317 |
+
var increase_id = 0;
|
318 |
+
field.find('.um-field-group-body').each(function(){
|
319 |
+
increase_id++;
|
320 |
+
jQuery(this).find('input').each(function(){
|
321 |
+
var input = jQuery(this);
|
322 |
+
input.attr('id', input.data('key') + '-' + increase_id );
|
323 |
+
input.attr('name', input.data('key') + '-' + increase_id );
|
324 |
+
input.parent().parent().find('label').attr('for', input.data('key') + '-' + increase_id );
|
325 |
+
});
|
326 |
+
});
|
327 |
+
|
328 |
+
if ( limit > 0 && field.find('.um-field-group-body').length == limit ) {
|
329 |
+
|
330 |
+
jQuery(this).addClass('disabled');
|
331 |
+
|
332 |
+
}
|
333 |
+
});
|
334 |
+
|
335 |
+
jQuery(document).on('click', '.um-field-group-cancel', function( e ) {
|
336 |
+
e.preventDefault();
|
337 |
+
var field = jQuery(this).parents('.um-field-group');
|
338 |
+
|
339 |
+
var limit = field.data('max_entries');
|
340 |
+
|
341 |
+
if ( field.find('.um-field-group-body').length > 1 ) {
|
342 |
+
jQuery(this).parents('.um-field-group-body').remove();
|
343 |
+
} else {
|
344 |
+
jQuery(this).parents('.um-field-group-body').hide();
|
345 |
+
}
|
346 |
+
|
347 |
+
if ( limit > 0 && field.find('.um-field-group-body').length < limit ) {
|
348 |
+
field.find('.um-field-group-head').removeClass('disabled');
|
349 |
+
}
|
350 |
+
|
351 |
+
return false;
|
352 |
+
});
|
353 |
+
|
354 |
+
|
355 |
+
jQuery( document.body ).on( 'click', '.um-ajax-paginate', function( e ) {
|
356 |
+
e.preventDefault();
|
357 |
+
|
358 |
+
var obj = jQuery(this);
|
359 |
+
var parent = obj.parent();
|
360 |
+
parent.addClass( 'loading' );
|
361 |
+
|
362 |
+
var pages = obj.data('pages')*1;
|
363 |
+
var next_page = obj.data('page')*1 + 1;
|
364 |
+
|
365 |
+
var hook = obj.data('hook');
|
366 |
+
|
367 |
+
if ( 'um_load_posts' === hook ) {
|
368 |
+
|
369 |
+
jQuery.ajax({
|
370 |
+
url: wp.ajax.settings.url,
|
371 |
+
type: 'post',
|
372 |
+
data: {
|
373 |
+
action: 'um_ajax_paginate_posts',
|
374 |
+
author: jQuery(this).data('author'),
|
375 |
+
page: next_page,
|
376 |
+
nonce: um_scripts.nonce
|
377 |
+
},
|
378 |
+
complete: function() {
|
379 |
+
parent.removeClass( 'loading' );
|
380 |
+
},
|
381 |
+
success: function( data ) {
|
382 |
+
parent.before( data );
|
383 |
+
if ( next_page === pages ) {
|
384 |
+
parent.remove();
|
385 |
+
} else {
|
386 |
+
obj.data( 'page', next_page );
|
387 |
+
}
|
388 |
+
}
|
389 |
+
});
|
390 |
+
} else if ( 'um_load_comments' === hook ) {
|
391 |
+
|
392 |
+
jQuery.ajax({
|
393 |
+
url: wp.ajax.settings.url,
|
394 |
+
type: 'post',
|
395 |
+
data: {
|
396 |
+
action: 'um_ajax_paginate_comments',
|
397 |
+
user_id: jQuery(this).data('user_id'),
|
398 |
+
page: next_page,
|
399 |
+
nonce: um_scripts.nonce
|
400 |
+
},
|
401 |
+
complete: function() {
|
402 |
+
parent.removeClass( 'loading' );
|
403 |
+
},
|
404 |
+
success: function( data ) {
|
405 |
+
parent.before( data );
|
406 |
+
if ( next_page === pages ) {
|
407 |
+
parent.remove();
|
408 |
+
} else {
|
409 |
+
obj.data( 'page', next_page );
|
410 |
+
}
|
411 |
+
}
|
412 |
+
});
|
413 |
+
} else {
|
414 |
+
var args = jQuery(this).data('args');
|
415 |
+
var container = jQuery(this).parents('.um').find('.um-ajax-items');
|
416 |
+
|
417 |
+
jQuery.ajax({
|
418 |
+
url: wp.ajax.settings.url,
|
419 |
+
type: 'post',
|
420 |
+
data: {
|
421 |
+
action: 'um_ajax_paginate',
|
422 |
+
hook: hook,
|
423 |
+
args: args,
|
424 |
+
nonce: um_scripts.nonce
|
425 |
+
},
|
426 |
+
complete: function() {
|
427 |
+
parent.removeClass( 'loading' );
|
428 |
+
},
|
429 |
+
success: function(data){
|
430 |
+
parent.remove();
|
431 |
+
container.append( data );
|
432 |
+
}
|
433 |
+
});
|
434 |
+
}
|
435 |
+
});
|
436 |
+
|
437 |
+
|
438 |
+
jQuery(document).on('click', '.um-ajax-action', function( e ) {
|
439 |
+
e.preventDefault();
|
440 |
+
var hook = jQuery(this).data('hook');
|
441 |
+
var user_id = jQuery(this).data('user_id');
|
442 |
+
var arguments = jQuery(this).data('arguments');
|
443 |
+
|
444 |
+
if ( jQuery(this).data('js-remove') ){
|
445 |
+
jQuery(this).parents('.'+jQuery(this).data('js-remove')).fadeOut('fast');
|
446 |
+
}
|
447 |
+
|
448 |
+
jQuery.ajax({
|
449 |
+
url: wp.ajax.settings.url,
|
450 |
+
type: 'post',
|
451 |
+
data: {
|
452 |
+
action: 'um_muted_action',
|
453 |
+
hook: hook,
|
454 |
+
user_id: user_id,
|
455 |
+
arguments: arguments,
|
456 |
+
nonce: um_scripts.nonce
|
457 |
+
},
|
458 |
+
success: function(data){
|
459 |
+
|
460 |
+
}
|
461 |
+
});
|
462 |
+
return false;
|
463 |
+
});
|
464 |
+
|
465 |
+
jQuery( document.body ).on('click', '#um-search-button', function() {
|
466 |
+
var action = jQuery(this).parents('.um-search-form').data('members_page');
|
467 |
+
|
468 |
+
var search_keys = [];
|
469 |
+
jQuery(this).parents('.um-search-form').find('input[name="um-search-keys[]"]').each( function() {
|
470 |
+
search_keys.push( jQuery(this).val() );
|
471 |
+
});
|
472 |
+
|
473 |
+
var search = jQuery(this).parents('.um-search-form').find('.um-search-field').val();
|
474 |
+
|
475 |
+
var url;
|
476 |
+
if ( search === '' ) {
|
477 |
+
url = action;
|
478 |
+
} else {
|
479 |
+
var query = '?';
|
480 |
+
for ( var i = 0; i < search_keys.length; i++ ) {
|
481 |
+
query += search_keys[i] + '=' + search;
|
482 |
+
if ( i !== search_keys.length - 1 ) {
|
483 |
+
query += '&';
|
484 |
+
}
|
485 |
+
}
|
486 |
+
|
487 |
+
url = action + query;
|
488 |
+
}
|
489 |
+
window.location = url;
|
490 |
+
});
|
491 |
+
|
492 |
+
//make search on Enter click
|
493 |
+
jQuery( document.body ).on( 'keypress', '.um-search-field', function(e) {
|
494 |
+
if ( e.which === 13 ) {
|
495 |
+
var action = jQuery(this).parents('.um-search-form').data('members_page');
|
496 |
+
|
497 |
+
var search_keys = [];
|
498 |
+
jQuery(this).parents('.um-search-form').find('input[name="um-search-keys[]"]').each( function() {
|
499 |
+
search_keys.push( jQuery(this).val() );
|
500 |
+
});
|
501 |
+
|
502 |
+
var search = jQuery(this).val();
|
503 |
+
|
504 |
+
var url;
|
505 |
+
if ( search === '' ) {
|
506 |
+
url = action;
|
507 |
+
} else {
|
508 |
+
var query = '?';
|
509 |
+
for ( var i = 0; i < search_keys.length; i++ ) {
|
510 |
+
query += search_keys[i] + '=' + search;
|
511 |
+
if ( i !== search_keys.length - 1 ) {
|
512 |
+
query += '&';
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
url = action + query;
|
517 |
+
}
|
518 |
+
window.location = url;
|
519 |
+
}
|
520 |
+
});
|
521 |
+
|
522 |
+
jQuery('.um-form input[class="um-button"][type="submit"]').prop('disabled', false);
|
523 |
+
|
524 |
+
jQuery(document).one('click', '.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)', function() {
|
525 |
+
jQuery(this).attr('disabled','disabled');
|
526 |
+
jQuery(this).parents('form').trigger('submit');
|
527 |
+
});
|
528 |
+
|
529 |
+
|
530 |
+
var um_select_options_cache = {};
|
531 |
+
|
532 |
+
/**
|
533 |
+
* Find all select fields with parent select fields
|
534 |
+
*/
|
535 |
+
jQuery('select[data-um-parent]').each( function() {
|
536 |
+
|
537 |
+
var me = jQuery(this);
|
538 |
+
var parent_option = me.data('um-parent');
|
539 |
+
var um_ajax_source = me.data('um-ajax-source');
|
540 |
+
|
541 |
+
me.attr('data-um-init-field', true );
|
542 |
+
|
543 |
+
jQuery(document).on('change','select[name="' + parent_option + '"]',function() {
|
544 |
+
var parent = jQuery(this);
|
545 |
+
var form_id = parent.closest( 'form' ).find( 'input[type="hidden"][name="form_id"]' ).val();
|
546 |
+
|
547 |
+
var arr_key;
|
548 |
+
if ( me.attr( 'data-member-directory' ) === 'yes' ) {
|
549 |
+
var directory = parent.parents('.um-directory');
|
550 |
+
arr_key = um_get_data_for_directory( directory, 'filter_' + parent_option );
|
551 |
+
if ( typeof arr_key != 'undefined' ) {
|
552 |
+
arr_key = arr_key.split('||');
|
553 |
+
} else {
|
554 |
+
arr_key = '';
|
555 |
+
}
|
556 |
+
} else {
|
557 |
+
arr_key = parent.val();
|
558 |
+
}
|
559 |
+
|
560 |
+
if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] !== 'object' ) {
|
561 |
+
|
562 |
+
if ( typeof( me.um_wait ) === 'undefined' || me.um_wait === false ) {
|
563 |
+
me.um_wait = true;
|
564 |
+
} else {
|
565 |
+
return;
|
566 |
+
}
|
567 |
+
|
568 |
+
jQuery.ajax({
|
569 |
+
url: wp.ajax.settings.url,
|
570 |
+
type: 'post',
|
571 |
+
data: {
|
572 |
+
action: 'um_select_options',
|
573 |
+
parent_option_name: parent_option,
|
574 |
+
parent_option: arr_key,
|
575 |
+
child_callback: um_ajax_source,
|
576 |
+
child_name: me.attr('name'),
|
577 |
+
members_directory: me.attr('data-member-directory'),
|
578 |
+
form_id: form_id,
|
579 |
+
nonce: um_scripts.nonce
|
580 |
+
},
|
581 |
+
success: function( data ) {
|
582 |
+
if ( data.status === 'success' && arr_key !== '' ) {
|
583 |
+
um_select_options_cache[ arr_key ] = data;
|
584 |
+
um_field_populate_child_options( me, data, arr_key );
|
585 |
+
}
|
586 |
+
|
587 |
+
if ( typeof data.debug !== 'undefined' ) {
|
588 |
+
console.log( data );
|
589 |
+
}
|
590 |
+
|
591 |
+
me.um_wait = false;
|
592 |
+
},
|
593 |
+
error: function( e ) {
|
594 |
+
console.log( e );
|
595 |
+
me.um_wait = false;
|
596 |
+
}
|
597 |
+
});
|
598 |
+
|
599 |
+
}
|
600 |
+
|
601 |
+
if ( typeof arr_key != 'undefined' && arr_key !== '' && typeof um_select_options_cache[ arr_key ] == 'object' ) {
|
602 |
+
setTimeout( um_field_populate_child_options, 10, me, um_select_options_cache[ arr_key ], arr_key );
|
603 |
+
}
|
604 |
+
|
605 |
+
if ( typeof arr_key != 'undefined' || arr_key === '' ) {
|
606 |
+
me.find('option[value!=""]').remove();
|
607 |
+
me.val('').trigger('change');
|
608 |
+
}
|
609 |
+
|
610 |
+
});
|
611 |
+
|
612 |
+
jQuery('select[name="' + parent_option + '"]').trigger('change');
|
613 |
+
|
614 |
+
});
|
615 |
+
|
616 |
+
|
617 |
+
/**
|
618 |
+
* Populates child options and cache ajax response
|
619 |
+
*
|
620 |
+
* @param me
|
621 |
+
* @param data
|
622 |
+
* @param arr_key
|
623 |
+
*/
|
624 |
+
function um_field_populate_child_options( me, data, arr_key ) {
|
625 |
+
var directory = me.parents('.um-directory');
|
626 |
+
var child_name = me.attr('name');
|
627 |
+
me.find('option[value!=""]').remove();
|
628 |
+
|
629 |
+
if ( ! me.hasClass('um-child-option-disabled') ) {
|
630 |
+
me.prop('disabled', false);
|
631 |
+
}
|
632 |
+
|
633 |
+
var arr_items = [],
|
634 |
+
search_get = '';
|
635 |
+
|
636 |
+
if ( data.post.members_directory === 'yes' ) {
|
637 |
+
arr_items.push({id: '', text: '', selected: 1});
|
638 |
+
}
|
639 |
+
jQuery.each( data.items, function(k,v){
|
640 |
+
arr_items.push({id: k, text: v, selected: (v === search_get)});
|
641 |
+
});
|
642 |
+
|
643 |
+
me.select2('destroy');
|
644 |
+
me.select2({
|
645 |
+
data: arr_items,
|
646 |
+
allowClear: true,
|
647 |
+
minimumResultsForSearch: 10
|
648 |
+
});
|
649 |
+
|
650 |
+
if ( data.post.members_directory === 'yes' ) {
|
651 |
+
me.find('option').each( function() {
|
652 |
+
if ( jQuery(this).html() !== '' ) {
|
653 |
+
jQuery(this).data( 'value_label', jQuery(this).html() ).attr( 'data-value_label', jQuery(this).html() );
|
654 |
+
}
|
655 |
+
});
|
656 |
+
|
657 |
+
var current_filter_val = um_get_data_for_directory( directory, 'filter_' + child_name );
|
658 |
+
if ( typeof current_filter_val !== 'undefined' ) {
|
659 |
+
current_filter_val = current_filter_val.split('||');
|
660 |
+
|
661 |
+
var temp_filter_val = [];
|
662 |
+
jQuery.each( current_filter_val, function(i) {
|
663 |
+
if ( me.find('option[value="' + current_filter_val[ i ] + '"]').length ) {
|
664 |
+
temp_filter_val.push( current_filter_val[ i ] );
|
665 |
+
}
|
666 |
+
me.find('option[value="' + current_filter_val[ i ] + '"]').prop('disabled', true).hide();
|
667 |
+
if ( me.find('option:not(:disabled)').length === 1 ) {
|
668 |
+
me.prop('disabled', true);
|
669 |
+
}
|
670 |
+
|
671 |
+
me.select2('destroy').select2();
|
672 |
+
me.val('').trigger( 'change' );
|
673 |
+
});
|
674 |
+
|
675 |
+
temp_filter_val = temp_filter_val.join('||');
|
676 |
+
if ( current_filter_val !== temp_filter_val ) {
|
677 |
+
um_set_url_from_data( directory, 'filter_' + child_name, temp_filter_val );
|
678 |
+
um_ajax_get_members( directory );
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
um_change_tag( directory );
|
683 |
+
}
|
684 |
+
|
685 |
+
if ( data.post.members_directory !== 'yes' ) {
|
686 |
+
if ( typeof data.field.default !== 'undefined' && ! me.data('um-original-value') ) {
|
687 |
+
me.val( data.field.default ).trigger('change');
|
688 |
+
} else if ( me.data('um-original-value') !== '' ) {
|
689 |
+
me.val( me.data('um-original-value') ).trigger('change');
|
690 |
+
}
|
691 |
+
|
692 |
+
if ( data.field.editable == 0 ) {
|
693 |
+
me.addClass('um-child-option-disabled');
|
694 |
+
me.attr('disabled','disabled');
|
695 |
+
}
|
696 |
+
}
|
697 |
+
}
|
698 |
+
|
699 |
+
});
|
assets/js/um-scripts.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){var e=jQuery(this),t=!1;void 0!==e.attr("data-disabled_weekdays")&&""!==e.attr("data-disabled_weekdays")&&(t=JSON.parse(e.attr("data-disabled_weekdays")));var a=null;void 0!==e.attr("data-years")&&(a=e.attr("data-years"));var i=e.attr("data-date_min"),r=e.attr("data-date_max"),n=[],u=[];void 0!==i&&(n=i.split(",")),void 0!==r&&(u=r.split(","));var o=n.length?new Date(n):null,d=n.length?new Date(u):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}if(d&&"Invalid Date"==d.toString()&&3==u.length){var l=u[1]+"/"+u[2]+"/"+u[0];d=new Date(Date.parse(l))}var c={disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}};null!==a&&(c.selectYears=a),null!==o&&(c.min=o),null!==d&&(c.max=d),e.pickadate(c)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){var e=jQuery(this);e.pickatime({format:e.attr("data-format"),interval:parseInt(e.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){function a(e){var a=jQuery(e.currentTarget),t=a.find(":selected");1<t.length&&t.each(function(e,t){""===t.value&&(t.selected=!1,a.trigger("change"))})}jQuery(document.body).on("click",".um-dropdown a.real_url",function(){window.location=jQuery(this).attr("href")}),jQuery(document.body).on("click",".um-trigger-menu-on-click",function(){var e=jQuery(this).find(".um-dropdown");return UM.dropdown.show(e),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM.dropdown.hideAll(),!1}),jQuery(document.body).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");return jQuery(this).parents(t).find(e).trigger("click"),UM.dropdown.hideAll(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").each(function(e){var t=jQuery(this);t.select2({allowClear:!0,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s2").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:10,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s3").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:-1,dropdownParent:t.parent()}).on("change",a)})),init_tipsy(),"function"==typeof jQuery.fn.um_raty&&(jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){um_live_field=this.id,um_live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0})),jQuery(document).on("change",'.um-field-area input[type="radio"]',function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",'.um-field-area input[type="checkbox"]',function(){var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),um_init_datetimepicker(),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e);var a=0;e.find(".um-field-group-body").each(function(){a++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+a),e.attr("name",e.data("key")+"-"+a),e.parent().parent().find("label").attr("for",e.data("key")+"-"+a)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=t.parent();a.addClass("loading");var i=1*t.data("pages"),r=1*t.data("page")+1,n=t.data("hook");if("um_load_posts"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r==i?a.remove():t.data("page",r)}});else if("um_load_comments"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_comments",user_id:jQuery(this).data("user_id"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r==i?a.remove():t.data("page",r)}});else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:n,args:u,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments,nonce:um_scripts.nonce},success:function(e){}}),!1}),jQuery(document.body).on("click","#um-search-button",function(){var e=jQuery(this).parents(".um-search-form").data("members_page"),t=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){t.push(jQuery(this).val())});var a,i=jQuery(this).parents(".um-search-form").find(".um-search-field").val();if(""===i)a=e;else{for(var r="?",n=0;n<t.length;n++)r+=t[n]+"="+i,n!==t.length-1&&(r+="&");a=e+r}window.location=a}),jQuery(document.body).on("keypress",".um-search-field",function(e){if(13===e.which){var t=jQuery(this).parents(".um-search-form").data("members_page"),a=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())});var i,r=jQuery(this).val();if(""===r)i=t;else{for(var n="?",u=0;u<a.length;u++)n+=a[u]+"="+r,u!==a.length-1&&(n+="&");i=t+n}window.location=i}}),jQuery('.um-form input[class="um-button"][type="submit"]').prop("disabled",!1),jQuery(document).one("click",'.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)',function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").trigger("submit")});var o={};function d(t,e,a){var i=t.parents(".um-directory"),r=t.attr("name");t.find('option[value!=""]').remove(),t.hasClass("um-child-option-disabled")||t.prop("disabled",!1);var n=[];if("yes"===e.post.members_directory&&n.push({id:"",text:"",selected:1}),jQuery.each(e.items,function(e,t){n.push({id:e,text:t,selected:""===t})}),t.select2("destroy"),t.select2({data:n,allowClear:!0,minimumResultsForSearch:10}),"yes"===e.post.members_directory){t.find("option").each(function(){""!==jQuery(this).html()&&jQuery(this).data("value_label",jQuery(this).html()).attr("data-value_label",jQuery(this).html())});var u=um_get_data_for_directory(i,"filter_"+r);if(void 0!==u){u=u.split("||");var o=[];jQuery.each(u,function(e){t.find('option[value="'+u[e]+'"]').length&&o.push(u[e]),t.find('option[value="'+u[e]+'"]').prop("disabled",!0).hide(),1===t.find("option:not(:disabled)").length&&t.prop("disabled",!0),t.select2("destroy").select2(),t.val("").trigger("change")}),o=o.join("||"),u!==o&&(um_set_url_from_data(i,"filter_"+r,o),um_ajax_get_members(i))}um_change_tag(i)}"yes"!==e.post.members_directory&&(void 0===e.field.default||t.data("um-original-value")?""!==t.data("um-original-value")&&t.val(t.data("um-original-value")).trigger("change"):t.val(e.field.default).trigger("change"),0==e.field.editable&&(t.addClass("um-child-option-disabled"),t.attr("disabled","disabled")))}jQuery("select[data-um-parent]").each(function(){var r=jQuery(this),n=r.data("um-parent"),u=r.data("um-ajax-source");r.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+n+'"]',function(){var t,e=jQuery(this),a=e.closest("form").find('input[type="hidden"][name="form_id"]').val();if("yes"===r.attr("data-member-directory")){var i=e.parents(".um-directory");t=void 0!==(t=um_get_data_for_directory(i,"filter_"+n))?t.split("||"):""}else t=e.val();if(void 0!==t&&""!==t&&"object"!=typeof o[t]){if(void 0!==r.um_wait&&!1!==r.um_wait)return;r.um_wait=!0,jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:n,parent_option:t,child_callback:u,child_name:r.attr("name"),members_directory:r.attr("data-member-directory"),form_id:a,nonce:um_scripts.nonce},success:function(e){"success"===e.status&&""!==t&&(o[t]=e,d(r,e,t)),void 0!==e.debug&&console.log(e),r.um_wait=!1},error:function(e){console.log(e),r.um_wait=!1}})}void 0!==t&&""!==t&&"object"==typeof o[t]&&setTimeout(d,10,r,o[t],t),void 0===t&&""!==t||(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
|
1 |
+
function um_sanitize_value(e,t){var a=document.createElement("div");a.innerText=e;var i=a.innerHTML;return t&&jQuery(t).val(i),i}function um_init_datetimepicker(){jQuery(".um-datepicker:not(.picker__input)").each(function(){var e=jQuery(this),t=!1;void 0!==e.attr("data-disabled_weekdays")&&""!==e.attr("data-disabled_weekdays")&&(t=JSON.parse(e.attr("data-disabled_weekdays")));var a=null;void 0!==e.attr("data-years")&&(a=e.attr("data-years"));var i=e.attr("data-date_min"),r=e.attr("data-date_max"),n=[],u=[];void 0!==i&&(n=i.split(",")),void 0!==r&&(u=r.split(","));var o=n.length?new Date(n):null,d=n.length?new Date(u):null;if(o&&"Invalid Date"==o.toString()&&3==n.length){var s=n[1]+"/"+n[2]+"/"+n[0];o=new Date(Date.parse(s))}if(d&&"Invalid Date"==d.toString()&&3==u.length){var l=u[1]+"/"+u[2]+"/"+u[0];d=new Date(Date.parse(l))}var c={disable:t,format:e.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}};null!==a&&(c.selectYears=a),null!==o&&(c.min=o),null!==d&&(c.max=d),e.pickadate(c)}),jQuery(".um-timepicker:not(.picker__input)").each(function(){var e=jQuery(this);e.pickatime({format:e.attr("data-format"),interval:parseInt(e.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){e.blur()},onClose:function(){e.blur()}})})}function init_tipsy(){"function"==typeof jQuery.fn.tipsy&&(jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}))}jQuery(document).ready(function(){function a(e){var a=jQuery(e.currentTarget),t=a.find(":selected");1<t.length&&t.each(function(e,t){""===t.value&&(t.selected=!1,a.trigger("change"))})}jQuery(document.body).on("click",".um-dropdown a.real_url",function(){window.location=jQuery(this).attr("href")}),jQuery(document.body).on("click",".um-trigger-menu-on-click",function(){var e=jQuery(this).find(".um-dropdown");return UM.dropdown.show(e),!1}),jQuery(document.body).on("click",".um-dropdown-hide",function(){return UM.dropdown.hideAll(),!1}),jQuery(document.body).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");return jQuery(this).parents(t).find(e).trigger("click"),UM.dropdown.hideAll(),!1}),jQuery(".um-s1,.um-s2").css({display:"block"}),"function"==typeof jQuery.fn.select2&&(jQuery(".um-s1").each(function(e){var t=jQuery(this);t.select2({allowClear:!0,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s2").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:10,dropdownParent:t.parent()}).on("change",a)}),jQuery(".um-s3").each(function(e){var t=jQuery(this);t.select2({allowClear:!1,minimumResultsForSearch:-1,dropdownParent:t.parent()}).on("change",a)})),init_tipsy(),"function"==typeof jQuery.fn.um_raty&&(jQuery(".um-rating").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){um_live_field=this.id,um_live_value=e,um_apply_conditions(jQuery(this),!1)}}),jQuery(".um-rating-readonly").um_raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0})),jQuery(document).on("change",'.um-field-area input[type="radio"]',function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeAttr("class").addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeAttr("class").addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",'.um-field-area input[type="checkbox"]',function(){var e=jQuery(this).parents("label");e.hasClass("active")?(e.removeClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeAttr("class").addClass("um-icon-android-checkbox-outline"))}),um_init_datetimepicker(),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find('input[type="hidden"]').val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),a=t.find('input[type="hidden"]#'+t.data("key")+"-"+jQuery(this).parents("form").find('input[type="hidden"][name="form_id"]').val()).val(),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href"),r=t.data("mode"),n={data:{mode:r,filename:a,src:i,nonce:um_scripts.nonce},success:function(){t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html(t.data("upload-label")),t.find("input[type=hidden]").val("empty_file")}};return"register"!==r&&(n.data.user_id=jQuery(this).parents("form").find("#user_id").val()),wp.ajax.send("um_remove_file",n),!1}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e);var a=0;e.find(".um-field-group-body").each(function(){a++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+a),e.attr("name",e.data("key")+"-"+a),e.parent().parent().find("label").attr("for",e.data("key")+"-"+a)})}),0<t&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),a=t.data("max_entries");return 1<t.find(".um-field-group-body").length?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),0<a&&t.find(".um-field-group-body").length<a&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document.body).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this),a=t.parent();a.addClass("loading");var i=1*t.data("pages"),r=1*t.data("page")+1,n=t.data("hook");if("um_load_posts"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_posts",author:jQuery(this).data("author"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r==i?a.remove():t.data("page",r)}});else if("um_load_comments"===n)jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate_comments",user_id:jQuery(this).data("user_id"),page:r,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.before(e),r==i?a.remove():t.data("page",r)}});else{var u=jQuery(this).data("args"),o=jQuery(this).parents(".um").find(".um-ajax-items");jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_ajax_paginate",hook:n,args:u,nonce:um_scripts.nonce},complete:function(){a.removeClass("loading")},success:function(e){a.remove(),o.append(e)}})}}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),a=jQuery(this).data("user_id"),arguments=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_muted_action",hook:t,user_id:a,arguments:arguments,nonce:um_scripts.nonce},success:function(e){}}),!1}),jQuery(document.body).on("click","#um-search-button",function(){var e=jQuery(this).parents(".um-search-form").data("members_page"),t=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){t.push(jQuery(this).val())});var a,i=jQuery(this).parents(".um-search-form").find(".um-search-field").val();if(""===i)a=e;else{for(var r="?",n=0;n<t.length;n++)r+=t[n]+"="+i,n!==t.length-1&&(r+="&");a=e+r}window.location=a}),jQuery(document.body).on("keypress",".um-search-field",function(e){if(13===e.which){var t=jQuery(this).parents(".um-search-form").data("members_page"),a=[];jQuery(this).parents(".um-search-form").find('input[name="um-search-keys[]"]').each(function(){a.push(jQuery(this).val())});var i,r=jQuery(this).val();if(""===r)i=t;else{for(var n="?",u=0;u<a.length;u++)n+=a[u]+"="+r,u!==a.length-1&&(n+="&");i=t+n}window.location=i}}),jQuery('.um-form input[class="um-button"][type="submit"]').prop("disabled",!1),jQuery(document).one("click",'.um:not(.um-account) .um-form input[class="um-button"][type="submit"]:not(.um-has-recaptcha)',function(){jQuery(this).attr("disabled","disabled"),jQuery(this).parents("form").trigger("submit")});var o={};function d(t,e,a){var i=t.parents(".um-directory"),r=t.attr("name");t.find('option[value!=""]').remove(),t.hasClass("um-child-option-disabled")||t.prop("disabled",!1);var n=[];if("yes"===e.post.members_directory&&n.push({id:"",text:"",selected:1}),jQuery.each(e.items,function(e,t){n.push({id:e,text:t,selected:""===t})}),t.select2("destroy"),t.select2({data:n,allowClear:!0,minimumResultsForSearch:10}),"yes"===e.post.members_directory){t.find("option").each(function(){""!==jQuery(this).html()&&jQuery(this).data("value_label",jQuery(this).html()).attr("data-value_label",jQuery(this).html())});var u=um_get_data_for_directory(i,"filter_"+r);if(void 0!==u){u=u.split("||");var o=[];jQuery.each(u,function(e){t.find('option[value="'+u[e]+'"]').length&&o.push(u[e]),t.find('option[value="'+u[e]+'"]').prop("disabled",!0).hide(),1===t.find("option:not(:disabled)").length&&t.prop("disabled",!0),t.select2("destroy").select2(),t.val("").trigger("change")}),o=o.join("||"),u!==o&&(um_set_url_from_data(i,"filter_"+r,o),um_ajax_get_members(i))}um_change_tag(i)}"yes"!==e.post.members_directory&&(void 0===e.field.default||t.data("um-original-value")?""!==t.data("um-original-value")&&t.val(t.data("um-original-value")).trigger("change"):t.val(e.field.default).trigger("change"),0==e.field.editable&&(t.addClass("um-child-option-disabled"),t.attr("disabled","disabled")))}jQuery("select[data-um-parent]").each(function(){var r=jQuery(this),n=r.data("um-parent"),u=r.data("um-ajax-source");r.attr("data-um-init-field",!0),jQuery(document).on("change",'select[name="'+n+'"]',function(){var t,e=jQuery(this),a=e.closest("form").find('input[type="hidden"][name="form_id"]').val();if("yes"===r.attr("data-member-directory")){var i=e.parents(".um-directory");t=void 0!==(t=um_get_data_for_directory(i,"filter_"+n))?t.split("||"):""}else t=e.val();if(void 0!==t&&""!==t&&"object"!=typeof o[t]){if(void 0!==r.um_wait&&!1!==r.um_wait)return;r.um_wait=!0,jQuery.ajax({url:wp.ajax.settings.url,type:"post",data:{action:"um_select_options",parent_option_name:n,parent_option:t,child_callback:u,child_name:r.attr("name"),members_directory:r.attr("data-member-directory"),form_id:a,nonce:um_scripts.nonce},success:function(e){"success"===e.status&&""!==t&&(o[t]=e,d(r,e,t)),void 0!==e.debug&&console.log(e),r.um_wait=!1},error:function(e){console.log(e),r.um_wait=!1}})}void 0!==t&&""!==t&&"object"==typeof o[t]&&setTimeout(d,10,r,o[t],t),void 0===t&&""!==t||(r.find('option[value!=""]').remove(),r.val("").trigger("change"))}),jQuery('select[name="'+n+'"]').trigger("change")})});
|
includes/admin/assets/css/um-admin-forms.css
CHANGED
@@ -1,400 +1,404 @@
|
|
1 |
-
.um-form-table.um-third-column .um-forms-line th {
|
2 |
-
width: 33%;
|
3 |
-
}
|
4 |
-
|
5 |
-
.um-form-table.um-half-column .um-forms-line th {
|
6 |
-
width: 50%;
|
7 |
-
}
|
8 |
-
|
9 |
-
.um-form-table.um-two-thirds-column .um-forms-line th {
|
10 |
-
width: 83%;
|
11 |
-
}
|
12 |
-
|
13 |
-
.um-form-table.um-top-label .um-forms-line td {
|
14 |
-
padding: 0 0 15px 0;
|
15 |
-
}
|
16 |
-
|
17 |
-
.um-form-table.um-top-label .um-forms-line td label {
|
18 |
-
margin: 0 0 5px 0;
|
19 |
-
display: inline-block;
|
20 |
-
}
|
21 |
-
|
22 |
-
.um-form-table.um-top-label .um-forms-line[data-field_type="icon"] td label {
|
23 |
-
width: 100%;
|
24 |
-
display: block;
|
25 |
-
margin: 0 0 5px 0;
|
26 |
-
}
|
27 |
-
|
28 |
-
.um_admin_fonticon_wrapper {
|
29 |
-
display: flex;
|
30 |
-
flex-direction: row;
|
31 |
-
flex-wrap: nowrap;
|
32 |
-
justify-content: flex-start;
|
33 |
-
align-items: center;
|
34 |
-
}
|
35 |
-
|
36 |
-
.um-admin-icon-value {
|
37 |
-
line-height: 1;
|
38 |
-
}
|
39 |
-
|
40 |
-
.um_admin_fonticon_wrapper .um-admin-icon-value i {
|
41 |
-
top: 0;
|
42 |
-
}
|
43 |
-
|
44 |
-
input[type=text].um-forms-field.um-long-field,
|
45 |
-
select.um-forms-field.um-long-field,
|
46 |
-
textarea.um-forms-field.um-long-field {
|
47 |
-
width:100% !important;
|
48 |
-
}
|
49 |
-
|
50 |
-
input[type=text].um-forms-field.um-medium-field,
|
51 |
-
select.um-forms-field.um-medium-field,
|
52 |
-
textarea.um-forms-field.um-medium-field {
|
53 |
-
width:50% !important;
|
54 |
-
}
|
55 |
-
|
56 |
-
input[type=text].um-forms-field.um-small-field,
|
57 |
-
select.um-forms-field.um-small-field,
|
58 |
-
textarea.um-forms-field.um-small-field {
|
59 |
-
width:25% !important;
|
60 |
-
}
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
.um-multi-text-list,
|
65 |
-
.um-multi-selects-list,
|
66 |
-
.um-md-default-filters-list {
|
67 |
-
float: left;
|
68 |
-
width:100%;
|
69 |
-
margin: 0 0 10px 0;
|
70 |
-
}
|
71 |
-
|
72 |
-
.um-hidden-multi-text,
|
73 |
-
.um-hidden-multi-selects,
|
74 |
-
.um-hidden-md-default-filters {
|
75 |
-
display: none !important;
|
76 |
-
}
|
77 |
-
|
78 |
-
.um-multi-text-option-line,
|
79 |
-
.um-multi-selects-option-line,
|
80 |
-
.um-md-default-filters-option-line {
|
81 |
-
float:left;
|
82 |
-
width:100%;
|
83 |
-
margin: 0;
|
84 |
-
padding: 0;
|
85 |
-
clear:both;
|
86 |
-
}
|
87 |
-
|
88 |
-
.um-md-default-filters-option-line {
|
89 |
-
border-bottom: 1px solid #eee;
|
90 |
-
padding: 0 0 5px 0;
|
91 |
-
margin: 5px 0 0 0;
|
92 |
-
}
|
93 |
-
|
94 |
-
.um-md-default-filters-option-line .um.um-field-wrapper2 {
|
95 |
-
margin: 5px 0 0 0;
|
96 |
-
}
|
97 |
-
|
98 |
-
.um-multi-selects-option-line.um-admin-drag-fld {
|
99 |
-
background: none;
|
100 |
-
border: none;
|
101 |
-
display: flex;
|
102 |
-
flex-direction: row;
|
103 |
-
justify-content: flex-start;
|
104 |
-
align-items: center;
|
105 |
-
flex-wrap: nowrap;
|
106 |
-
}
|
107 |
-
|
108 |
-
.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon {
|
109 |
-
float: left;
|
110 |
-
width: 20px;
|
111 |
-
text-align: left;
|
112 |
-
line-height: 30px;
|
113 |
-
}
|
114 |
-
|
115 |
-
.um-multi-selects-option-line .um-field-wrapper {
|
116 |
-
float:left;
|
117 |
-
width: calc( 100% - 60px );
|
118 |
-
line-height: 30px;
|
119 |
-
box-sizing: border-box;
|
120 |
-
}
|
121 |
-
|
122 |
-
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields {
|
123 |
-
margin: 5px 0 0 0;
|
124 |
-
}
|
125 |
-
|
126 |
-
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label {
|
127 |
-
float:left;
|
128 |
-
width: 100%;
|
129 |
-
line-height: 30px;
|
130 |
-
box-sizing: border-box;
|
131 |
-
margin: 0 !important;
|
132 |
-
padding: 0 !important;
|
133 |
-
font-weight: bold;
|
134 |
-
display: flex;
|
135 |
-
flex-direction: row;
|
136 |
-
flex-wrap: nowrap;
|
137 |
-
justify-content: space-between;
|
138 |
-
align-items: baseline;
|
139 |
-
}
|
140 |
-
|
141 |
-
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type="text"] {
|
142 |
-
width: auto;
|
143 |
-
display: inline;
|
144 |
-
font-weight: normal;
|
145 |
-
max-width: 70%;
|
146 |
-
flex: 0.9;
|
147 |
-
}
|
148 |
-
|
149 |
-
.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper {
|
150 |
-
width: calc( 100% - 90px );
|
151 |
-
}
|
152 |
-
|
153 |
-
.um-multi-text-option-line .um-field-wrapper {
|
154 |
-
float:left;
|
155 |
-
width: calc( 100% - 90px );
|
156 |
-
line-height: 30px;
|
157 |
-
box-sizing: border-box;
|
158 |
-
}
|
159 |
-
|
160 |
-
.um-md-default-filters-option-line .um-field-wrapper {
|
161 |
-
float:left;
|
162 |
-
width: calc( 100% - 60px );
|
163 |
-
line-height: 30px;
|
164 |
-
box-sizing: border-box;
|
165 |
-
}
|
166 |
-
|
167 |
-
.um-md-default-filters-option-line .um-field-wrapper2 {
|
168 |
-
float:left;
|
169 |
-
width: calc( 100% - 60px );
|
170 |
-
line-height: 30px;
|
171 |
-
box-sizing: border-box;
|
172 |
-
}
|
173 |
-
|
174 |
-
.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header {
|
175 |
-
background: #44b0ec;
|
176 |
-
border: 1px solid #44b0ec !important;
|
177 |
-
margin-top: -1px;
|
178 |
-
}
|
179 |
-
|
180 |
-
.um-md-default-filters-option-line .um-field-wrapper2 select {
|
181 |
-
width: 100%;
|
182 |
-
float: left;
|
183 |
-
}
|
184 |
-
|
185 |
-
.um-md-default-filters-option-line .um-field-wrapper2 input {
|
186 |
-
width: 100%;
|
187 |
-
float: left;
|
188 |
-
}
|
189 |
-
|
190 |
-
.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter,
|
191 |
-
.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter {
|
192 |
-
width: calc( 50% - 7px ) !important;
|
193 |
-
float: left;
|
194 |
-
}
|
195 |
-
|
196 |
-
.um-md-default-filters-option-line .um-field-wrapper2 .um-slider {
|
197 |
-
margin: 5px 9px 0 9px;
|
198 |
-
width: calc( 100% - 18px );
|
199 |
-
box-sizing: border-box;
|
200 |
-
display: block;
|
201 |
-
}
|
202 |
-
|
203 |
-
.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child,
|
204 |
-
.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child {
|
205 |
-
margin-right: 11px;
|
206 |
-
}
|
207 |
-
|
208 |
-
.um-multi-text-option-line .um-field-wrapper input,
|
209 |
-
.um-multi-selects-option-line .um-field-wrapper select {
|
210 |
-
float:left;
|
211 |
-
width: 100%;
|
212 |
-
margin:0;
|
213 |
-
}
|
214 |
-
|
215 |
-
|
216 |
-
.um-multi-text-option-line .um-field-control,
|
217 |
-
.um-multi-selects-option-line .um-field-control,
|
218 |
-
.um-md-default-filters-option-line .um-field-control {
|
219 |
-
float:left;
|
220 |
-
width: 60px;
|
221 |
-
line-height: 30px;
|
222 |
-
padding: 0 10px;
|
223 |
-
box-sizing: border-box;
|
224 |
-
}
|
225 |
-
|
226 |
-
.um-form-table .description {
|
227 |
-
font-style: italic;
|
228 |
-
}
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
}
|
271 |
-
.um-form-fields-section label
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
.um-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
.um-
|
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 |
-
.um-forms-line .um-
|
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 |
-
margin: 7px 0 0 0;
|
353 |
-
}
|
354 |
-
|
355 |
-
.um-forms-line td .um-same-page-update-wrapper .
|
356 |
-
margin: 7px 0 0 0;
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
}
|
366 |
-
|
367 |
-
.um-forms-line[data-field_type="same_page_update"]
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
.um-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
-moz-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
}
|
394 |
-
|
395 |
-
.um-sortable-items-field .um-sortable-item
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
|
|
|
|
|
|
|
1 |
+
.um-form-table.um-third-column .um-forms-line th {
|
2 |
+
width: 33%;
|
3 |
+
}
|
4 |
+
|
5 |
+
.um-form-table.um-half-column .um-forms-line th {
|
6 |
+
width: 50%;
|
7 |
+
}
|
8 |
+
|
9 |
+
.um-form-table.um-two-thirds-column .um-forms-line th {
|
10 |
+
width: 83%;
|
11 |
+
}
|
12 |
+
|
13 |
+
.um-form-table.um-top-label .um-forms-line td {
|
14 |
+
padding: 0 0 15px 0;
|
15 |
+
}
|
16 |
+
|
17 |
+
.um-form-table.um-top-label .um-forms-line td label {
|
18 |
+
margin: 0 0 5px 0;
|
19 |
+
display: inline-block;
|
20 |
+
}
|
21 |
+
|
22 |
+
.um-form-table.um-top-label .um-forms-line[data-field_type="icon"] td label {
|
23 |
+
width: 100%;
|
24 |
+
display: block;
|
25 |
+
margin: 0 0 5px 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
.um_admin_fonticon_wrapper {
|
29 |
+
display: flex;
|
30 |
+
flex-direction: row;
|
31 |
+
flex-wrap: nowrap;
|
32 |
+
justify-content: flex-start;
|
33 |
+
align-items: center;
|
34 |
+
}
|
35 |
+
|
36 |
+
.um-admin-icon-value {
|
37 |
+
line-height: 1;
|
38 |
+
}
|
39 |
+
|
40 |
+
.um_admin_fonticon_wrapper .um-admin-icon-value i {
|
41 |
+
top: 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
input[type=text].um-forms-field.um-long-field,
|
45 |
+
select.um-forms-field.um-long-field,
|
46 |
+
textarea.um-forms-field.um-long-field {
|
47 |
+
width:100% !important;
|
48 |
+
}
|
49 |
+
|
50 |
+
input[type=text].um-forms-field.um-medium-field,
|
51 |
+
select.um-forms-field.um-medium-field,
|
52 |
+
textarea.um-forms-field.um-medium-field {
|
53 |
+
width:50% !important;
|
54 |
+
}
|
55 |
+
|
56 |
+
input[type=text].um-forms-field.um-small-field,
|
57 |
+
select.um-forms-field.um-small-field,
|
58 |
+
textarea.um-forms-field.um-small-field {
|
59 |
+
width:25% !important;
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
.um-multi-text-list,
|
65 |
+
.um-multi-selects-list,
|
66 |
+
.um-md-default-filters-list {
|
67 |
+
float: left;
|
68 |
+
width:100%;
|
69 |
+
margin: 0 0 10px 0;
|
70 |
+
}
|
71 |
+
|
72 |
+
.um-hidden-multi-text,
|
73 |
+
.um-hidden-multi-selects,
|
74 |
+
.um-hidden-md-default-filters {
|
75 |
+
display: none !important;
|
76 |
+
}
|
77 |
+
|
78 |
+
.um-multi-text-option-line,
|
79 |
+
.um-multi-selects-option-line,
|
80 |
+
.um-md-default-filters-option-line {
|
81 |
+
float:left;
|
82 |
+
width:100%;
|
83 |
+
margin: 0;
|
84 |
+
padding: 0;
|
85 |
+
clear:both;
|
86 |
+
}
|
87 |
+
|
88 |
+
.um-md-default-filters-option-line {
|
89 |
+
border-bottom: 1px solid #eee;
|
90 |
+
padding: 0 0 5px 0;
|
91 |
+
margin: 5px 0 0 0;
|
92 |
+
}
|
93 |
+
|
94 |
+
.um-md-default-filters-option-line .um.um-field-wrapper2 {
|
95 |
+
margin: 5px 0 0 0;
|
96 |
+
}
|
97 |
+
|
98 |
+
.um-multi-selects-option-line.um-admin-drag-fld {
|
99 |
+
background: none;
|
100 |
+
border: none;
|
101 |
+
display: flex;
|
102 |
+
flex-direction: row;
|
103 |
+
justify-content: flex-start;
|
104 |
+
align-items: center;
|
105 |
+
flex-wrap: nowrap;
|
106 |
+
}
|
107 |
+
|
108 |
+
.um-multi-selects-option-line.um-admin-drag-fld .um-field-icon {
|
109 |
+
float: left;
|
110 |
+
width: 20px;
|
111 |
+
text-align: left;
|
112 |
+
line-height: 30px;
|
113 |
+
}
|
114 |
+
|
115 |
+
.um-multi-selects-option-line .um-field-wrapper {
|
116 |
+
float:left;
|
117 |
+
width: calc( 100% - 60px );
|
118 |
+
line-height: 30px;
|
119 |
+
box-sizing: border-box;
|
120 |
+
}
|
121 |
+
|
122 |
+
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields {
|
123 |
+
margin: 5px 0 0 0;
|
124 |
+
}
|
125 |
+
|
126 |
+
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label {
|
127 |
+
float:left;
|
128 |
+
width: 100%;
|
129 |
+
line-height: 30px;
|
130 |
+
box-sizing: border-box;
|
131 |
+
margin: 0 !important;
|
132 |
+
padding: 0 !important;
|
133 |
+
font-weight: bold;
|
134 |
+
display: flex;
|
135 |
+
flex-direction: row;
|
136 |
+
flex-wrap: nowrap;
|
137 |
+
justify-content: space-between;
|
138 |
+
align-items: baseline;
|
139 |
+
}
|
140 |
+
|
141 |
+
.um-multi-selects-option-line .um-field-wrapper.um-custom-order-fields label input[type="text"] {
|
142 |
+
width: auto;
|
143 |
+
display: inline;
|
144 |
+
font-weight: normal;
|
145 |
+
max-width: 70%;
|
146 |
+
flex: 0.9;
|
147 |
+
}
|
148 |
+
|
149 |
+
.um-multi-selects-option-line.um-admin-drag-fld .um-field-wrapper {
|
150 |
+
width: calc( 100% - 90px );
|
151 |
+
}
|
152 |
+
|
153 |
+
.um-multi-text-option-line .um-field-wrapper {
|
154 |
+
float:left;
|
155 |
+
width: calc( 100% - 90px );
|
156 |
+
line-height: 30px;
|
157 |
+
box-sizing: border-box;
|
158 |
+
}
|
159 |
+
|
160 |
+
.um-md-default-filters-option-line .um-field-wrapper {
|
161 |
+
float:left;
|
162 |
+
width: calc( 100% - 60px );
|
163 |
+
line-height: 30px;
|
164 |
+
box-sizing: border-box;
|
165 |
+
}
|
166 |
+
|
167 |
+
.um-md-default-filters-option-line .um-field-wrapper2 {
|
168 |
+
float:left;
|
169 |
+
width: calc( 100% - 60px );
|
170 |
+
line-height: 30px;
|
171 |
+
box-sizing: border-box;
|
172 |
+
}
|
173 |
+
|
174 |
+
.um-md-default-filters-option-line .um-field-wrapper2 .ui-slider-range.ui-widget-header {
|
175 |
+
background: #44b0ec;
|
176 |
+
border: 1px solid #44b0ec !important;
|
177 |
+
margin-top: -1px;
|
178 |
+
}
|
179 |
+
|
180 |
+
.um-md-default-filters-option-line .um-field-wrapper2 select {
|
181 |
+
width: 100%;
|
182 |
+
float: left;
|
183 |
+
}
|
184 |
+
|
185 |
+
.um-md-default-filters-option-line .um-field-wrapper2 input {
|
186 |
+
width: 100%;
|
187 |
+
float: left;
|
188 |
+
}
|
189 |
+
|
190 |
+
.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter,
|
191 |
+
.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter {
|
192 |
+
width: calc( 50% - 7px ) !important;
|
193 |
+
float: left;
|
194 |
+
}
|
195 |
+
|
196 |
+
.um-md-default-filters-option-line .um-field-wrapper2 .um-slider {
|
197 |
+
margin: 5px 9px 0 9px;
|
198 |
+
width: calc( 100% - 18px );
|
199 |
+
box-sizing: border-box;
|
200 |
+
display: block;
|
201 |
+
}
|
202 |
+
|
203 |
+
.um-md-default-filters-option-line .um-field-wrapper2 input.um-timepicker-filter:first-child,
|
204 |
+
.um-md-default-filters-option-line .um-field-wrapper2 input.um-datepicker-filter:first-child {
|
205 |
+
margin-right: 11px;
|
206 |
+
}
|
207 |
+
|
208 |
+
.um-multi-text-option-line .um-field-wrapper input,
|
209 |
+
.um-multi-selects-option-line .um-field-wrapper select {
|
210 |
+
float:left;
|
211 |
+
width: 100%;
|
212 |
+
margin:0;
|
213 |
+
}
|
214 |
+
|
215 |
+
|
216 |
+
.um-multi-text-option-line .um-field-control,
|
217 |
+
.um-multi-selects-option-line .um-field-control,
|
218 |
+
.um-md-default-filters-option-line .um-field-control {
|
219 |
+
float:left;
|
220 |
+
width: 60px;
|
221 |
+
line-height: 30px;
|
222 |
+
padding: 0 10px;
|
223 |
+
box-sizing: border-box;
|
224 |
+
}
|
225 |
+
|
226 |
+
.um-form-table .description {
|
227 |
+
font-style: italic;
|
228 |
+
}
|
229 |
+
|
230 |
+
.um-form-field .description {
|
231 |
+
clear: both;
|
232 |
+
}
|
233 |
+
|
234 |
+
|
235 |
+
.um-form-fields-section {
|
236 |
+
float:left;
|
237 |
+
clear: none;
|
238 |
+
margin:0;
|
239 |
+
padding: 0 10px 0 0;
|
240 |
+
box-sizing: border-box;
|
241 |
+
-moz-box-sizing: border-box;
|
242 |
+
-webkit-box-sizing: border-box;
|
243 |
+
}
|
244 |
+
|
245 |
+
.um-form-fields-section label {
|
246 |
+
float:left;
|
247 |
+
width:100%;
|
248 |
+
margin:0;
|
249 |
+
padding:0;
|
250 |
+
}
|
251 |
+
|
252 |
+
.um-form-fields-section label input {
|
253 |
+
float:left;
|
254 |
+
margin-top:0;
|
255 |
+
}
|
256 |
+
|
257 |
+
.um-form-fields-section label span {
|
258 |
+
float:left;
|
259 |
+
width:calc( 100% - 20px );
|
260 |
+
}
|
261 |
+
|
262 |
+
.um-multi-text-option-line,
|
263 |
+
.um-multi-selects-option-line {
|
264 |
+
margin: 0 0 5px 0;
|
265 |
+
}
|
266 |
+
|
267 |
+
@media screen and (max-width: 782px) {
|
268 |
+
.um-form-fields-section {
|
269 |
+
width:100% !important;
|
270 |
+
}
|
271 |
+
.um-admin-metabox .um-form-fields-section label {
|
272 |
+
line-height: 22px !important;
|
273 |
+
margin: 0 0 12px 0 !important;
|
274 |
+
}
|
275 |
+
.um-form-fields-section label span {
|
276 |
+
width:calc( 100% - 30px );
|
277 |
+
}
|
278 |
+
|
279 |
+
.um-multi-text-option-line,
|
280 |
+
.um-multi-selects-option-line {
|
281 |
+
margin: 0 0 6px 0;
|
282 |
+
}
|
283 |
+
|
284 |
+
.um-forms-line label {
|
285 |
+
float:left;
|
286 |
+
width:100%;
|
287 |
+
}
|
288 |
+
|
289 |
+
|
290 |
+
.um-form-table.um-third-column .um-forms-line th,
|
291 |
+
.um-form-table.um-half-column .um-forms-line th,
|
292 |
+
.um-form-table.um-two-thirds-column .um-forms-line th {
|
293 |
+
float:left;
|
294 |
+
width: 100%;
|
295 |
+
}
|
296 |
+
|
297 |
+
.um-form-table.um-third-column .um-forms-line td,
|
298 |
+
.um-form-table.um-half-column .um-forms-line td,
|
299 |
+
.um-form-table.um-two-thirds-column .um-forms-line td {
|
300 |
+
float:left;
|
301 |
+
width: 100%;
|
302 |
+
}
|
303 |
+
|
304 |
+
.um-form-table.um-third-column .um-forms-line th label,
|
305 |
+
.um-form-table.um-half-column .um-forms-line th label,
|
306 |
+
.um-form-table.um-two-thirds-column .um-forms-line th label {
|
307 |
+
float:left;
|
308 |
+
width: 100%;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
|
313 |
+
/*Multi text filed */
|
314 |
+
.um-forms-line .um-text-delete {
|
315 |
+
color: #a00;
|
316 |
+
float:left;
|
317 |
+
}
|
318 |
+
|
319 |
+
.um-forms-line .um-text-delete:hover {
|
320 |
+
color: red;
|
321 |
+
}
|
322 |
+
|
323 |
+
.um-forms-line .um-multi-text-add-option {
|
324 |
+
margin-bottom: 14px;
|
325 |
+
}
|
326 |
+
|
327 |
+
|
328 |
+
/* Media uploader */
|
329 |
+
.um-forms-line .icon_preview {
|
330 |
+
display: none;
|
331 |
+
max-width: 200px;
|
332 |
+
max-height: 200px;
|
333 |
+
padding: 5px;
|
334 |
+
cursor: pointer;
|
335 |
+
border: 1px solid #e3e3e3;
|
336 |
+
background: #f7f7f7;
|
337 |
+
border-radius: 3px;
|
338 |
+
height: auto;
|
339 |
+
width: auto !important;
|
340 |
+
}
|
341 |
+
|
342 |
+
|
343 |
+
.um-forms-line[data-conditional] {
|
344 |
+
display: none;
|
345 |
+
}
|
346 |
+
|
347 |
+
|
348 |
+
|
349 |
+
/* Same page update field */
|
350 |
+
.um-forms-line td .um-same-page-update-wrapper {
|
351 |
+
display: none;
|
352 |
+
margin: 7px 0 0 0;
|
353 |
+
}
|
354 |
+
|
355 |
+
.um-forms-line td .um-same-page-update-wrapper input.um-admin-form-same-page-update {
|
356 |
+
margin: 7px 0 0 0;
|
357 |
+
}
|
358 |
+
|
359 |
+
.um-forms-line td .um-same-page-update-wrapper .upgrade_log {
|
360 |
+
margin: 7px 0 0 0;
|
361 |
+
width:100%;
|
362 |
+
height:150px;
|
363 |
+
overflow: auto;
|
364 |
+
border: 1px solid #a1a1a1;
|
365 |
+
}
|
366 |
+
|
367 |
+
.um-forms-line[data-field_type="same_page_update"] {
|
368 |
+
vertical-align: baseline;
|
369 |
+
}
|
370 |
+
|
371 |
+
.um-forms-line[data-field_type="same_page_update"] th,
|
372 |
+
.um-forms-line[data-field_type="same_page_update"] td {
|
373 |
+
vertical-align: baseline;
|
374 |
+
}
|
375 |
+
|
376 |
+
.um-sortable-items-field .um-sortable-item {
|
377 |
+
cursor: move !important;
|
378 |
+
padding: 5px;
|
379 |
+
box-sizing: border-box;
|
380 |
+
-moz-box-sizing: border-box;
|
381 |
+
-webkit-box-sizing: border-box;
|
382 |
+
border: 1px solid #7e8993;
|
383 |
+
border-radius: 4px;
|
384 |
+
-moz-border-radius: 4px;
|
385 |
+
background: #f1f1f1;
|
386 |
+
height: 42px;
|
387 |
+
line-height: 28px;
|
388 |
+
display: flex;
|
389 |
+
flex-direction: row;
|
390 |
+
justify-content: flex-start;
|
391 |
+
align-items: center;
|
392 |
+
flex-wrap: nowrap;
|
393 |
+
}
|
394 |
+
|
395 |
+
.um-sortable-items-field .um-sortable-item.um-hidden-item {
|
396 |
+
display: none;
|
397 |
+
}
|
398 |
+
|
399 |
+
.um-sortable-items-field .um-sortable-item .um-field-icon {
|
400 |
+
font-size: 18px;
|
401 |
+
width: 20px;
|
402 |
+
text-align: left;
|
403 |
+
margin: 0 10px 0 0;
|
404 |
+
}
|
includes/admin/assets/js/um-admin-blocks.js
CHANGED
@@ -1,235 +1,235 @@
|
|
1 |
-
'use strict';
|
2 |
-
|
3 |
-
var um_components = wp.components,
|
4 |
-
umSelectControl = um_components.SelectControl,
|
5 |
-
umTextareaControl = um_components.TextareaControl;
|
6 |
-
|
7 |
-
|
8 |
-
function um_admin_blocks_custom_fields( um_condition_fields, props ) {
|
9 |
-
return wp.hooks.applyFilters( 'um_admin_blocks_custom_fields', [], um_condition_fields, props );
|
10 |
-
}
|
11 |
-
|
12 |
-
var um_block_restriction = wp.compose.createHigherOrderComponent( function( BlockEdit ) {
|
13 |
-
var um_condition_fields = {
|
14 |
-
um_who_access: 'um_block_settings_hide',
|
15 |
-
um_roles_access: 'um_block_settings_hide',
|
16 |
-
um_message_type: 'um_block_settings_hide',
|
17 |
-
um_message_content: 'um_block_settings_hide'
|
18 |
-
};
|
19 |
-
|
20 |
-
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_default', um_condition_fields );
|
21 |
-
|
22 |
-
return function( props ) {
|
23 |
-
|
24 |
-
if ( props.attributes.um_is_restrict !== true ) {
|
25 |
-
um_condition_fields['um_who_access'] = 'um_block_settings_hide';
|
26 |
-
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
27 |
-
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
28 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
29 |
-
} else {
|
30 |
-
um_condition_fields['um_who_access'] = '';
|
31 |
-
|
32 |
-
if ( parseInt( props.attributes.um_who_access ) === 0 || typeof props.attributes.um_who_access === 'undefined' ) {
|
33 |
-
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
34 |
-
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
35 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
36 |
-
} else if ( parseInt( props.attributes.um_who_access ) === 1 ) {
|
37 |
-
um_condition_fields['um_roles_access'] = '';
|
38 |
-
um_condition_fields['um_message_type'] = '';
|
39 |
-
|
40 |
-
if ( parseInt( props.attributes.um_message_type ) === 2 ) {
|
41 |
-
um_condition_fields['um_message_content'] = '';
|
42 |
-
} else {
|
43 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
44 |
-
}
|
45 |
-
} else {
|
46 |
-
um_condition_fields['um_message_type'] = '';
|
47 |
-
|
48 |
-
if ( parseInt( props.attributes.um_message_type ) === 2 ) {
|
49 |
-
um_condition_fields['um_message_content'] = '';
|
50 |
-
} else {
|
51 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
52 |
-
}
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields', um_condition_fields, props );
|
57 |
-
|
58 |
-
return wp.element.createElement(
|
59 |
-
wp.element.Fragment,
|
60 |
-
{},
|
61 |
-
wp.element.createElement( BlockEdit, props ),
|
62 |
-
wp.element.createElement(
|
63 |
-
wp.blockEditor.InspectorControls,
|
64 |
-
{},
|
65 |
-
wp.element.createElement(
|
66 |
-
wp.components.PanelBody,
|
67 |
-
{
|
68 |
-
title: wp.i18n.__( '
|
69 |
-
className: 'um_block_settings'
|
70 |
-
},
|
71 |
-
wp.element.createElement(
|
72 |
-
wp.components.ToggleControl,
|
73 |
-
{
|
74 |
-
label: wp.i18n.__( 'Restrict access?', 'ultimate-member' ),
|
75 |
-
checked: props.attributes.um_is_restrict,
|
76 |
-
onChange: function onChange( value ) {
|
77 |
-
props.setAttributes({ um_is_restrict: value });
|
78 |
-
if ( value === false ) {
|
79 |
-
um_condition_fields['um_who_access'] = 'um_block_settings_hide';
|
80 |
-
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
81 |
-
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
82 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
83 |
-
} else {
|
84 |
-
um_condition_fields['um_who_access'] = '';
|
85 |
-
}
|
86 |
-
|
87 |
-
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_is_restrict', value );
|
88 |
-
}
|
89 |
-
}
|
90 |
-
),
|
91 |
-
wp.element.createElement(
|
92 |
-
umSelectControl,
|
93 |
-
{
|
94 |
-
type: 'number',
|
95 |
-
className: um_condition_fields['um_who_access'],
|
96 |
-
label: wp.i18n.__( 'Who can access this
|
97 |
-
value: props.attributes.um_who_access,
|
98 |
-
options: [
|
99 |
-
{
|
100 |
-
label: wp.i18n.__( 'Everyone', 'ultimate-member' ),
|
101 |
-
value: 0
|
102 |
-
},
|
103 |
-
{
|
104 |
-
label: wp.i18n.__( 'Logged in users', 'ultimate-member' ),
|
105 |
-
value: 1
|
106 |
-
},
|
107 |
-
{
|
108 |
-
label: wp.i18n.__( 'Logged out users', 'ultimate-member' ),
|
109 |
-
value: 2
|
110 |
-
}
|
111 |
-
],
|
112 |
-
onChange: function onChange( value ) {
|
113 |
-
props.setAttributes({ um_who_access: value });
|
114 |
-
if ( parseInt( value ) === 0 ) {
|
115 |
-
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
116 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
117 |
-
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
118 |
-
} else if ( parseInt( value ) === 1 ) {
|
119 |
-
um_condition_fields['um_message_type'] = '';
|
120 |
-
um_condition_fields['um_roles_access'] = '';
|
121 |
-
} else {
|
122 |
-
um_condition_fields['um_message_type'] = '';
|
123 |
-
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
124 |
-
}
|
125 |
-
|
126 |
-
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_who_access', value );
|
127 |
-
}
|
128 |
-
}
|
129 |
-
),
|
130 |
-
wp.element.createElement(
|
131 |
-
umSelectControl,
|
132 |
-
{
|
133 |
-
multiple: true,
|
134 |
-
className: um_condition_fields['um_roles_access'],
|
135 |
-
label: wp.i18n.__( 'What roles can access this
|
136 |
-
value: props.attributes.um_roles_access,
|
137 |
-
options: um_restrict_roles,
|
138 |
-
onChange: function onChange( value ) {
|
139 |
-
props.setAttributes({ um_roles_access: value });
|
140 |
-
}
|
141 |
-
}
|
142 |
-
),
|
143 |
-
wp.element.createElement(
|
144 |
-
umSelectControl,
|
145 |
-
{
|
146 |
-
type: 'number',
|
147 |
-
className: um_condition_fields['um_message_type'],
|
148 |
-
label: wp.i18n.__( 'Restriction
|
149 |
-
value: props.attributes.um_message_type,
|
150 |
-
options: [
|
151 |
-
{
|
152 |
-
label: wp.i18n.__( 'Hide block', 'ultimate-member' ),
|
153 |
-
value: 0
|
154 |
-
},
|
155 |
-
{
|
156 |
-
label: wp.i18n.__( 'Show global default message', 'ultimate-member' ),
|
157 |
-
value: 1
|
158 |
-
},
|
159 |
-
{
|
160 |
-
label: wp.i18n.__( 'Show custom message', 'ultimate-member' ),
|
161 |
-
value: 2
|
162 |
-
}
|
163 |
-
],
|
164 |
-
onChange: function onChange( value ) {
|
165 |
-
props.setAttributes({ um_message_type: value });
|
166 |
-
if ( parseInt( value ) === 2 ) {
|
167 |
-
um_condition_fields['um_message_content'] = '';
|
168 |
-
} else {
|
169 |
-
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
170 |
-
}
|
171 |
-
}
|
172 |
-
}
|
173 |
-
),
|
174 |
-
wp.element.createElement(
|
175 |
-
umTextareaControl,
|
176 |
-
{
|
177 |
-
type: 'number',
|
178 |
-
className: um_condition_fields['um_message_content'],
|
179 |
-
label: wp.i18n.__( '
|
180 |
-
value: props.attributes.um_message_content,
|
181 |
-
onChange: function onChange( value ) {
|
182 |
-
props.setAttributes({ um_message_content: value });
|
183 |
-
}
|
184 |
-
}
|
185 |
-
),
|
186 |
-
um_admin_blocks_custom_fields( um_condition_fields, props )
|
187 |
-
)
|
188 |
-
)
|
189 |
-
);
|
190 |
-
};
|
191 |
-
}, 'um_block_restriction' );
|
192 |
-
|
193 |
-
wp.hooks.addFilter( 'editor.BlockEdit', 'um-block/um_block_restriction', um_block_restriction );
|
194 |
-
|
195 |
-
|
196 |
-
/**
|
197 |
-
* Save Attributes
|
198 |
-
*
|
199 |
-
* @type {{um_is_restrict: {type: string}, um_who_access: {type: string}, um_message_type: {type: string}, um_message_content: {type: string}}}
|
200 |
-
*/
|
201 |
-
var um_block_restrict_settings = {
|
202 |
-
um_is_restrict: {
|
203 |
-
type: "boolean"
|
204 |
-
},
|
205 |
-
um_who_access: {
|
206 |
-
type: "select"
|
207 |
-
},
|
208 |
-
um_roles_access: {
|
209 |
-
type: "select"
|
210 |
-
},
|
211 |
-
um_message_type: {
|
212 |
-
type: "select"
|
213 |
-
},
|
214 |
-
um_message_content: {
|
215 |
-
type: "string"
|
216 |
-
}
|
217 |
-
};
|
218 |
-
|
219 |
-
um_block_restrict_settings = wp.hooks.applyFilters( 'um_admin_blocks_restrict_settings', um_block_restrict_settings );
|
220 |
-
|
221 |
-
|
222 |
-
/**
|
223 |
-
*
|
224 |
-
* @param settings
|
225 |
-
* @returns {*}
|
226 |
-
*/
|
227 |
-
function um_add_block_attributes( settings ) {
|
228 |
-
var _lodash = lodash,
|
229 |
-
assign = _lodash.assign;
|
230 |
-
|
231 |
-
settings.attributes = assign( settings.attributes, um_block_restrict_settings );
|
232 |
-
return settings;
|
233 |
-
}
|
234 |
-
|
235 |
-
wp.hooks.addFilter( 'blocks.registerBlockType', 'um-block/um_add_block_attributes', um_add_block_attributes );
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
var um_components = wp.components,
|
4 |
+
umSelectControl = um_components.SelectControl,
|
5 |
+
umTextareaControl = um_components.TextareaControl;
|
6 |
+
|
7 |
+
|
8 |
+
function um_admin_blocks_custom_fields( um_condition_fields, props ) {
|
9 |
+
return wp.hooks.applyFilters( 'um_admin_blocks_custom_fields', [], um_condition_fields, props );
|
10 |
+
}
|
11 |
+
|
12 |
+
var um_block_restriction = wp.compose.createHigherOrderComponent( function( BlockEdit ) {
|
13 |
+
var um_condition_fields = {
|
14 |
+
um_who_access: 'um_block_settings_hide',
|
15 |
+
um_roles_access: 'um_block_settings_hide',
|
16 |
+
um_message_type: 'um_block_settings_hide',
|
17 |
+
um_message_content: 'um_block_settings_hide'
|
18 |
+
};
|
19 |
+
|
20 |
+
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_default', um_condition_fields );
|
21 |
+
|
22 |
+
return function( props ) {
|
23 |
+
|
24 |
+
if ( props.attributes.um_is_restrict !== true ) {
|
25 |
+
um_condition_fields['um_who_access'] = 'um_block_settings_hide';
|
26 |
+
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
27 |
+
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
28 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
29 |
+
} else {
|
30 |
+
um_condition_fields['um_who_access'] = '';
|
31 |
+
|
32 |
+
if ( parseInt( props.attributes.um_who_access ) === 0 || typeof props.attributes.um_who_access === 'undefined' ) {
|
33 |
+
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
34 |
+
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
35 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
36 |
+
} else if ( parseInt( props.attributes.um_who_access ) === 1 ) {
|
37 |
+
um_condition_fields['um_roles_access'] = '';
|
38 |
+
um_condition_fields['um_message_type'] = '';
|
39 |
+
|
40 |
+
if ( parseInt( props.attributes.um_message_type ) === 2 ) {
|
41 |
+
um_condition_fields['um_message_content'] = '';
|
42 |
+
} else {
|
43 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
um_condition_fields['um_message_type'] = '';
|
47 |
+
|
48 |
+
if ( parseInt( props.attributes.um_message_type ) === 2 ) {
|
49 |
+
um_condition_fields['um_message_content'] = '';
|
50 |
+
} else {
|
51 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields', um_condition_fields, props );
|
57 |
+
|
58 |
+
return wp.element.createElement(
|
59 |
+
wp.element.Fragment,
|
60 |
+
{},
|
61 |
+
wp.element.createElement( BlockEdit, props ),
|
62 |
+
wp.element.createElement(
|
63 |
+
wp.blockEditor.InspectorControls,
|
64 |
+
{},
|
65 |
+
wp.element.createElement(
|
66 |
+
wp.components.PanelBody,
|
67 |
+
{
|
68 |
+
title: wp.i18n.__( 'Ultimate Member: Content Restriction', 'ultimate-member' ),
|
69 |
+
className: 'um_block_settings'
|
70 |
+
},
|
71 |
+
wp.element.createElement(
|
72 |
+
wp.components.ToggleControl,
|
73 |
+
{
|
74 |
+
label: wp.i18n.__( 'Restrict access?', 'ultimate-member' ),
|
75 |
+
checked: props.attributes.um_is_restrict,
|
76 |
+
onChange: function onChange( value ) {
|
77 |
+
props.setAttributes({ um_is_restrict: value });
|
78 |
+
if ( value === false ) {
|
79 |
+
um_condition_fields['um_who_access'] = 'um_block_settings_hide';
|
80 |
+
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
81 |
+
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
82 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
83 |
+
} else {
|
84 |
+
um_condition_fields['um_who_access'] = '';
|
85 |
+
}
|
86 |
+
|
87 |
+
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_is_restrict', value );
|
88 |
+
}
|
89 |
+
}
|
90 |
+
),
|
91 |
+
wp.element.createElement(
|
92 |
+
umSelectControl,
|
93 |
+
{
|
94 |
+
type: 'number',
|
95 |
+
className: um_condition_fields['um_who_access'],
|
96 |
+
label: wp.i18n.__( 'Who can access this block?', 'ultimate-member' ),
|
97 |
+
value: props.attributes.um_who_access,
|
98 |
+
options: [
|
99 |
+
{
|
100 |
+
label: wp.i18n.__( 'Everyone', 'ultimate-member' ),
|
101 |
+
value: 0
|
102 |
+
},
|
103 |
+
{
|
104 |
+
label: wp.i18n.__( 'Logged in users', 'ultimate-member' ),
|
105 |
+
value: 1
|
106 |
+
},
|
107 |
+
{
|
108 |
+
label: wp.i18n.__( 'Logged out users', 'ultimate-member' ),
|
109 |
+
value: 2
|
110 |
+
}
|
111 |
+
],
|
112 |
+
onChange: function onChange( value ) {
|
113 |
+
props.setAttributes({ um_who_access: value });
|
114 |
+
if ( parseInt( value ) === 0 ) {
|
115 |
+
um_condition_fields['um_message_type'] = 'um_block_settings_hide';
|
116 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
117 |
+
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
118 |
+
} else if ( parseInt( value ) === 1 ) {
|
119 |
+
um_condition_fields['um_message_type'] = '';
|
120 |
+
um_condition_fields['um_roles_access'] = '';
|
121 |
+
} else {
|
122 |
+
um_condition_fields['um_message_type'] = '';
|
123 |
+
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
|
124 |
+
}
|
125 |
+
|
126 |
+
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_who_access', value );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
),
|
130 |
+
wp.element.createElement(
|
131 |
+
umSelectControl,
|
132 |
+
{
|
133 |
+
multiple: true,
|
134 |
+
className: um_condition_fields['um_roles_access'],
|
135 |
+
label: wp.i18n.__( 'What roles can access this block?', 'ultimate-member' ),
|
136 |
+
value: props.attributes.um_roles_access,
|
137 |
+
options: um_restrict_roles,
|
138 |
+
onChange: function onChange( value ) {
|
139 |
+
props.setAttributes({ um_roles_access: value });
|
140 |
+
}
|
141 |
+
}
|
142 |
+
),
|
143 |
+
wp.element.createElement(
|
144 |
+
umSelectControl,
|
145 |
+
{
|
146 |
+
type: 'number',
|
147 |
+
className: um_condition_fields['um_message_type'],
|
148 |
+
label: wp.i18n.__( 'Restriction action', 'ultimate-member' ),
|
149 |
+
value: props.attributes.um_message_type,
|
150 |
+
options: [
|
151 |
+
{
|
152 |
+
label: wp.i18n.__( 'Hide block', 'ultimate-member' ),
|
153 |
+
value: 0
|
154 |
+
},
|
155 |
+
{
|
156 |
+
label: wp.i18n.__( 'Show global default message', 'ultimate-member' ),
|
157 |
+
value: 1
|
158 |
+
},
|
159 |
+
{
|
160 |
+
label: wp.i18n.__( 'Show custom message', 'ultimate-member' ),
|
161 |
+
value: 2
|
162 |
+
}
|
163 |
+
],
|
164 |
+
onChange: function onChange( value ) {
|
165 |
+
props.setAttributes({ um_message_type: value });
|
166 |
+
if ( parseInt( value ) === 2 ) {
|
167 |
+
um_condition_fields['um_message_content'] = '';
|
168 |
+
} else {
|
169 |
+
um_condition_fields['um_message_content'] = 'um_block_settings_hide';
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
),
|
174 |
+
wp.element.createElement(
|
175 |
+
umTextareaControl,
|
176 |
+
{
|
177 |
+
type: 'number',
|
178 |
+
className: um_condition_fields['um_message_content'],
|
179 |
+
label: wp.i18n.__( 'Custom restricted access message', 'ultimate-member' ),
|
180 |
+
value: props.attributes.um_message_content,
|
181 |
+
onChange: function onChange( value ) {
|
182 |
+
props.setAttributes({ um_message_content: value });
|
183 |
+
}
|
184 |
+
}
|
185 |
+
),
|
186 |
+
um_admin_blocks_custom_fields( um_condition_fields, props )
|
187 |
+
)
|
188 |
+
)
|
189 |
+
);
|
190 |
+
};
|
191 |
+
}, 'um_block_restriction' );
|
192 |
+
|
193 |
+
wp.hooks.addFilter( 'editor.BlockEdit', 'um-block/um_block_restriction', um_block_restriction );
|
194 |
+
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Save Attributes
|
198 |
+
*
|
199 |
+
* @type {{um_is_restrict: {type: string}, um_who_access: {type: string}, um_message_type: {type: string}, um_message_content: {type: string}}}
|
200 |
+
*/
|
201 |
+
var um_block_restrict_settings = {
|
202 |
+
um_is_restrict: {
|
203 |
+
type: "boolean"
|
204 |
+
},
|
205 |
+
um_who_access: {
|
206 |
+
type: "select"
|
207 |
+
},
|
208 |
+
um_roles_access: {
|
209 |
+
type: "select"
|
210 |
+
},
|
211 |
+
um_message_type: {
|
212 |
+
type: "select"
|
213 |
+
},
|
214 |
+
um_message_content: {
|
215 |
+
type: "string"
|
216 |
+
}
|
217 |
+
};
|
218 |
+
|
219 |
+
um_block_restrict_settings = wp.hooks.applyFilters( 'um_admin_blocks_restrict_settings', um_block_restrict_settings );
|
220 |
+
|
221 |
+
|
222 |
+
/**
|
223 |
+
*
|
224 |
+
* @param settings
|
225 |
+
* @returns {*}
|
226 |
+
*/
|
227 |
+
function um_add_block_attributes( settings ) {
|
228 |
+
var _lodash = lodash,
|
229 |
+
assign = _lodash.assign;
|
230 |
+
|
231 |
+
settings.attributes = assign( settings.attributes, um_block_restrict_settings );
|
232 |
+
return settings;
|
233 |
+
}
|
234 |
+
|
235 |
+
wp.hooks.addFilter( 'blocks.registerBlockType', 'um-block/um_add_block_attributes', um_add_block_attributes );
|
includes/admin/class-admin.php
CHANGED
@@ -1,1956 +1,1970 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin;
|
3 |
-
|
4 |
-
// Exit if accessed directly.
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
exit;
|
7 |
-
}
|
8 |
-
|
9 |
-
if ( ! class_exists( 'um\admin\Admin' ) ) {
|
10 |
-
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Class Admin
|
14 |
-
* @package um\admin
|
15 |
-
*/
|
16 |
-
class Admin extends Admin_Functions {
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
public $templates_path;
|
23 |
-
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var array
|
27 |
-
*/
|
28 |
-
public $role_meta;
|
29 |
-
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @var array
|
33 |
-
*/
|
34 |
-
public $restriction_term_meta;
|
35 |
-
|
36 |
-
|
37 |
-
/**
|
38 |
-
* @var array
|
39 |
-
*/
|
40 |
-
public $member_directory_meta;
|
41 |
-
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var array
|
45 |
-
*/
|
46 |
-
public $form_meta;
|
47 |
-
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @var array
|
51 |
-
*/
|
52 |
-
public $builder_input;
|
53 |
-
|
54 |
-
|
55 |
-
/**
|
56 |
-
* @var array
|
57 |
-
*/
|
58 |
-
public $restriction_post_meta;
|
59 |
-
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Admin constructor.
|
63 |
-
*/
|
64 |
-
public function __construct() {
|
65 |
-
parent::__construct();
|
66 |
-
|
67 |
-
$this->templates_path = um_path . 'includes/admin/templates/';
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
'
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
'
|
129 |
-
),
|
130 |
-
'
|
131 |
-
'sanitize' => '
|
132 |
-
),
|
133 |
-
'
|
134 |
-
'sanitize' => 'bool',
|
135 |
-
),
|
136 |
-
'
|
137 |
-
'sanitize' => '
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
'
|
149 |
-
),
|
150 |
-
'
|
151 |
-
'sanitize' => 'sanitize_array_key',
|
152 |
-
'default' => '
|
153 |
-
'array' => array( '
|
154 |
-
),
|
155 |
-
'
|
156 |
-
'sanitize' => '
|
157 |
-
),
|
158 |
-
'
|
159 |
-
'sanitize' => '
|
160 |
-
),
|
161 |
-
'
|
162 |
-
'sanitize' => 'sanitize_array_key',
|
163 |
-
'default' => '
|
164 |
-
'array' => array( '
|
165 |
-
),
|
166 |
-
'
|
167 |
-
'sanitize' => '
|
168 |
-
),
|
169 |
-
'
|
170 |
-
'sanitize' => '
|
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 |
-
'sanitize' => '
|
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 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
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 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
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 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
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 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
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 |
-
'sanitize' => '
|
521 |
-
),
|
522 |
-
'
|
523 |
-
'sanitize' => '
|
524 |
-
),
|
525 |
-
'
|
526 |
-
'sanitize' => '
|
527 |
-
),
|
528 |
-
'
|
529 |
-
'sanitize' => '
|
530 |
-
),
|
531 |
-
'
|
532 |
-
'sanitize' => '
|
533 |
-
),
|
534 |
-
'
|
535 |
-
'sanitize' => '
|
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 |
-
|
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 |
-
|
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 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
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 |
-
if ( isset( $item['
|
863 |
-
$item['
|
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 |
-
|
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 |
-
|
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 |
-
$sanitized[ $k ] = (
|
1109 |
-
break;
|
1110 |
-
case '
|
1111 |
-
$sanitized[ $k ] = (
|
1112 |
-
break;
|
1113 |
-
case '
|
1114 |
-
$sanitized[ $k ] =
|
1115 |
-
break;
|
1116 |
-
case '
|
1117 |
-
$sanitized[ $k ] =
|
1118 |
-
break;
|
1119 |
-
case '
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
*
|
1142 |
-
*
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
$sanitized[ $k ] = (
|
1169 |
-
break;
|
1170 |
-
case '
|
1171 |
-
$sanitized[ $k ] = (
|
1172 |
-
break;
|
1173 |
-
case '
|
1174 |
-
$sanitized[ $k ] =
|
1175 |
-
break;
|
1176 |
-
case '
|
1177 |
-
$sanitized[ $k ] =
|
1178 |
-
break;
|
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 |
-
if ( ! array_key_exists(
|
1207 |
-
// @todo remove since 2.2.x and leave only continue
|
1208 |
-
$sanitized[ $k ] = $v;
|
1209 |
-
continue;
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
if (
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
$sanitized[ $k ] = (
|
1225 |
-
break;
|
1226 |
-
case '
|
1227 |
-
$sanitized[ $k ] =
|
1228 |
-
break;
|
1229 |
-
case '
|
1230 |
-
$sanitized[ $k ] =
|
1231 |
-
break;
|
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 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
$sanitized[ $k ] =
|
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 |
-
|
1383 |
-
|
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 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
if (
|
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 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
if (
|
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 |
-
$sanitized[ $k ] =
|
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 |
-
|
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 |
-
|
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 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
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 |
-
function
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace um\admin;
|
3 |
+
|
4 |
+
// Exit if accessed directly.
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit;
|
7 |
+
}
|
8 |
+
|
9 |
+
if ( ! class_exists( 'um\admin\Admin' ) ) {
|
10 |
+
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class Admin
|
14 |
+
* @package um\admin
|
15 |
+
*/
|
16 |
+
class Admin extends Admin_Functions {
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $templates_path;
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var array
|
27 |
+
*/
|
28 |
+
public $role_meta;
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var array
|
33 |
+
*/
|
34 |
+
public $restriction_term_meta;
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var array
|
39 |
+
*/
|
40 |
+
public $member_directory_meta;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var array
|
45 |
+
*/
|
46 |
+
public $form_meta;
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
public $builder_input;
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @var array
|
57 |
+
*/
|
58 |
+
public $restriction_post_meta;
|
59 |
+
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Admin constructor.
|
63 |
+
*/
|
64 |
+
public function __construct() {
|
65 |
+
parent::__construct();
|
66 |
+
|
67 |
+
$this->templates_path = um_path . 'includes/admin/templates/';
|
68 |
+
|
69 |
+
add_action( 'admin_init', array( &$this, 'admin_init' ), 0 );
|
70 |
+
|
71 |
+
$prefix = is_network_admin() ? 'network_admin_' : '';
|
72 |
+
add_filter( "{$prefix}plugin_action_links_" . um_plugin, array( &$this, 'plugin_links' ) );
|
73 |
+
|
74 |
+
add_action( 'um_admin_do_action__user_cache', array( &$this, 'user_cache' ) );
|
75 |
+
add_action( 'um_admin_do_action__purge_temp', array( &$this, 'purge_temp' ) );
|
76 |
+
add_action( 'um_admin_do_action__manual_upgrades_request', array( &$this, 'manual_upgrades_request' ) );
|
77 |
+
add_action( 'um_admin_do_action__duplicate_form', array( &$this, 'duplicate_form' ) );
|
78 |
+
add_action( 'um_admin_do_action__um_hide_locale_notice', array( &$this, 'um_hide_notice' ) );
|
79 |
+
add_action( 'um_admin_do_action__um_can_register_notice', array( &$this, 'um_hide_notice' ) );
|
80 |
+
add_action( 'um_admin_do_action__um_hide_exif_notice', array( &$this, 'um_hide_notice' ) );
|
81 |
+
add_action( 'um_admin_do_action__user_action', array( &$this, 'user_action' ) );
|
82 |
+
|
83 |
+
add_action( 'um_admin_do_action__install_core_pages', array( &$this, 'install_core_pages' ) );
|
84 |
+
|
85 |
+
add_filter( 'admin_body_class', array( &$this, 'admin_body_class' ), 999 );
|
86 |
+
|
87 |
+
add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
|
88 |
+
add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
|
89 |
+
add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
function init_variables() {
|
94 |
+
$this->role_meta = apply_filters(
|
95 |
+
'um_role_meta_map',
|
96 |
+
array(
|
97 |
+
'_um_priority' => array(
|
98 |
+
'sanitize' => 'int',
|
99 |
+
),
|
100 |
+
'_um_can_access_wpadmin' => array(
|
101 |
+
'sanitize' => 'bool',
|
102 |
+
),
|
103 |
+
'_um_can_not_see_adminbar' => array(
|
104 |
+
'sanitize' => 'bool',
|
105 |
+
),
|
106 |
+
'_um_can_edit_everyone' => array(
|
107 |
+
'sanitize' => 'bool',
|
108 |
+
),
|
109 |
+
'_um_can_edit_roles' => array(
|
110 |
+
'sanitize' => array( $this, 'sanitize_existed_role' ),
|
111 |
+
),
|
112 |
+
'_um_can_delete_everyone' => array(
|
113 |
+
'sanitize' => 'bool',
|
114 |
+
),
|
115 |
+
'_um_can_delete_roles' => array(
|
116 |
+
'sanitize' => array( $this, 'sanitize_existed_role' ),
|
117 |
+
),
|
118 |
+
'_um_can_edit_profile' => array(
|
119 |
+
'sanitize' => 'bool',
|
120 |
+
),
|
121 |
+
'_um_can_delete_profile' => array(
|
122 |
+
'sanitize' => 'bool',
|
123 |
+
),
|
124 |
+
'_um_can_view_all' => array(
|
125 |
+
'sanitize' => 'bool',
|
126 |
+
),
|
127 |
+
'_um_can_view_roles' => array(
|
128 |
+
'sanitize' => array( $this, 'sanitize_existed_role' ),
|
129 |
+
),
|
130 |
+
'_um_can_make_private_profile' => array(
|
131 |
+
'sanitize' => 'bool',
|
132 |
+
),
|
133 |
+
'_um_can_access_private_profile' => array(
|
134 |
+
'sanitize' => 'bool',
|
135 |
+
),
|
136 |
+
'_um_profile_noindex' => array(
|
137 |
+
'sanitize' => array( $this, 'sanitize_profile_noindex' ),
|
138 |
+
),
|
139 |
+
'_um_default_homepage' => array(
|
140 |
+
'sanitize' => 'bool',
|
141 |
+
),
|
142 |
+
'_um_redirect_homepage' => array(
|
143 |
+
'sanitize' => 'url',
|
144 |
+
),
|
145 |
+
'_um_status' => array(
|
146 |
+
'sanitize' => 'sanitize_array_key',
|
147 |
+
'default' => 'approved',
|
148 |
+
'array' => array( 'approved', 'checkmail', 'pending' ),
|
149 |
+
),
|
150 |
+
'_um_auto_approve_act' => array(
|
151 |
+
'sanitize' => 'sanitize_array_key',
|
152 |
+
'default' => 'redirect_profile',
|
153 |
+
'array' => array( 'redirect_profile', 'redirect_url' ),
|
154 |
+
),
|
155 |
+
'_um_auto_approve_url' => array(
|
156 |
+
'sanitize' => 'url',
|
157 |
+
),
|
158 |
+
'_um_login_email_activate' => array(
|
159 |
+
'sanitize' => 'bool',
|
160 |
+
),
|
161 |
+
'_um_checkmail_action' => array(
|
162 |
+
'sanitize' => 'sanitize_array_key',
|
163 |
+
'default' => 'show_message',
|
164 |
+
'array' => array( 'show_message', 'redirect_url' ),
|
165 |
+
),
|
166 |
+
'_um_checkmail_message' => array(
|
167 |
+
'sanitize' => 'textarea',
|
168 |
+
),
|
169 |
+
'_um_checkmail_url' => array(
|
170 |
+
'sanitize' => 'url',
|
171 |
+
),
|
172 |
+
'_um_url_email_activate' => array(
|
173 |
+
'sanitize' => 'url',
|
174 |
+
),
|
175 |
+
'_um_pending_action' => array(
|
176 |
+
'sanitize' => 'sanitize_array_key',
|
177 |
+
'default' => 'show_message',
|
178 |
+
'array' => array( 'show_message', 'redirect_url' ),
|
179 |
+
),
|
180 |
+
'_um_pending_message' => array(
|
181 |
+
'sanitize' => 'textarea',
|
182 |
+
),
|
183 |
+
'_um_pending_url' => array(
|
184 |
+
'sanitize' => 'url',
|
185 |
+
),
|
186 |
+
'_um_after_login' => array(
|
187 |
+
'sanitize' => 'sanitize_array_key',
|
188 |
+
'default' => 'redirect_profile',
|
189 |
+
'array' => array( 'redirect_profile', 'redirect_url', 'refresh', 'redirect_admin' ),
|
190 |
+
),
|
191 |
+
'_um_login_redirect_url' => array(
|
192 |
+
'sanitize' => 'url',
|
193 |
+
),
|
194 |
+
'_um_after_logout' => array(
|
195 |
+
'sanitize' => 'sanitize_array_key',
|
196 |
+
'default' => 'redirect_home',
|
197 |
+
'array' => array( 'redirect_home', 'redirect_url' ),
|
198 |
+
),
|
199 |
+
'_um_logout_redirect_url' => array(
|
200 |
+
'sanitize' => 'url',
|
201 |
+
),
|
202 |
+
'_um_after_delete' => array(
|
203 |
+
'sanitize' => 'sanitize_array_key',
|
204 |
+
'default' => 'redirect_home',
|
205 |
+
'array' => array( 'redirect_home', 'redirect_url' ),
|
206 |
+
),
|
207 |
+
'_um_delete_redirect_url' => array(
|
208 |
+
'sanitize' => 'url',
|
209 |
+
),
|
210 |
+
'wp_capabilities' => array(
|
211 |
+
'sanitize' => array( $this, 'sanitize_wp_capabilities' ),
|
212 |
+
),
|
213 |
+
)
|
214 |
+
);
|
215 |
+
|
216 |
+
$this->restriction_post_meta = apply_filters(
|
217 |
+
'um_restriction_post_meta_map',
|
218 |
+
array(
|
219 |
+
'_um_custom_access_settings' => array(
|
220 |
+
'sanitize' => 'bool',
|
221 |
+
),
|
222 |
+
'_um_accessible' => array(
|
223 |
+
'sanitize' => 'int',
|
224 |
+
),
|
225 |
+
'_um_access_roles' => array(
|
226 |
+
'sanitize' => array( $this, 'sanitize_restriction_existed_role' ),
|
227 |
+
),
|
228 |
+
'_um_noaccess_action' => array(
|
229 |
+
'sanitize' => 'int',
|
230 |
+
),
|
231 |
+
'_um_restrict_by_custom_message' => array(
|
232 |
+
'sanitize' => 'int',
|
233 |
+
),
|
234 |
+
'_um_restrict_custom_message' => array(
|
235 |
+
'sanitize' => 'wp_kses',
|
236 |
+
),
|
237 |
+
'_um_access_redirect' => array(
|
238 |
+
'sanitize' => 'int',
|
239 |
+
),
|
240 |
+
'_um_access_redirect_url' => array(
|
241 |
+
'sanitize' => 'url',
|
242 |
+
),
|
243 |
+
'_um_access_hide_from_queries' => array(
|
244 |
+
'sanitize' => 'bool',
|
245 |
+
),
|
246 |
+
)
|
247 |
+
);
|
248 |
+
|
249 |
+
$this->restriction_term_meta = apply_filters(
|
250 |
+
'um_restriction_term_meta_map',
|
251 |
+
array(
|
252 |
+
'_um_custom_access_settings' => array(
|
253 |
+
'sanitize' => 'bool',
|
254 |
+
),
|
255 |
+
'_um_accessible' => array(
|
256 |
+
'sanitize' => 'int',
|
257 |
+
),
|
258 |
+
'_um_access_roles' => array(
|
259 |
+
'sanitize' => array( $this, 'sanitize_restriction_existed_role' ),
|
260 |
+
),
|
261 |
+
'_um_noaccess_action' => array(
|
262 |
+
'sanitize' => 'int',
|
263 |
+
),
|
264 |
+
'_um_restrict_by_custom_message' => array(
|
265 |
+
'sanitize' => 'int',
|
266 |
+
),
|
267 |
+
'_um_restrict_custom_message' => array(
|
268 |
+
'sanitize' => 'wp_kses',
|
269 |
+
),
|
270 |
+
'_um_access_redirect' => array(
|
271 |
+
'sanitize' => 'int',
|
272 |
+
),
|
273 |
+
'_um_access_redirect_url' => array(
|
274 |
+
'sanitize' => 'url',
|
275 |
+
),
|
276 |
+
'_um_access_hide_from_queries' => array(
|
277 |
+
'sanitize' => 'bool',
|
278 |
+
),
|
279 |
+
)
|
280 |
+
);
|
281 |
+
|
282 |
+
$this->member_directory_meta = apply_filters(
|
283 |
+
'um_member_directory_meta_map',
|
284 |
+
array(
|
285 |
+
'_um_directory_template' => array(
|
286 |
+
'sanitize' => 'text',
|
287 |
+
),
|
288 |
+
'_um_mode' => array(
|
289 |
+
'sanitize' => 'key',
|
290 |
+
),
|
291 |
+
'_um_view_types' => array(
|
292 |
+
'sanitize' => array( $this, 'sanitize_md_view_types' ),
|
293 |
+
),
|
294 |
+
'_um_default_view' => array(
|
295 |
+
'sanitize' => 'key',
|
296 |
+
),
|
297 |
+
'_um_roles' => array(
|
298 |
+
'sanitize' => array( $this, 'sanitize_restriction_existed_role' ),
|
299 |
+
),
|
300 |
+
'_um_has_profile_photo' => array(
|
301 |
+
'sanitize' => 'bool',
|
302 |
+
),
|
303 |
+
'_um_show_these_users' => array(
|
304 |
+
'sanitize' => 'textarea',
|
305 |
+
),
|
306 |
+
'_um_exclude_these_users' => array(
|
307 |
+
'sanitize' => 'textarea',
|
308 |
+
),
|
309 |
+
'_um_must_search' => array(
|
310 |
+
'sanitize' => 'bool',
|
311 |
+
),
|
312 |
+
'_um_max_users' => array(
|
313 |
+
'sanitize' => 'absint',
|
314 |
+
),
|
315 |
+
'_um_profiles_per_page' => array(
|
316 |
+
'sanitize' => 'absint',
|
317 |
+
),
|
318 |
+
'_um_profiles_per_page_mobile' => array(
|
319 |
+
'sanitize' => 'absint',
|
320 |
+
),
|
321 |
+
'_um_directory_header' => array(
|
322 |
+
'sanitize' => 'text',
|
323 |
+
),
|
324 |
+
'_um_directory_header_single' => array(
|
325 |
+
'sanitize' => 'text',
|
326 |
+
),
|
327 |
+
'_um_directory_no_users' => array(
|
328 |
+
'sanitize' => 'text',
|
329 |
+
),
|
330 |
+
'_um_profile_photo' => array(
|
331 |
+
'sanitize' => 'bool',
|
332 |
+
),
|
333 |
+
'_um_cover_photos' => array(
|
334 |
+
'sanitize' => 'bool',
|
335 |
+
),
|
336 |
+
'_um_show_name' => array(
|
337 |
+
'sanitize' => 'bool',
|
338 |
+
),
|
339 |
+
'_um_show_tagline' => array(
|
340 |
+
'sanitize' => 'bool',
|
341 |
+
),
|
342 |
+
'_um_tagline_fields' => array(
|
343 |
+
'sanitize' => array( $this, 'sanitize_user_field' ),
|
344 |
+
),
|
345 |
+
'_um_show_userinfo' => array(
|
346 |
+
'sanitize' => 'bool',
|
347 |
+
),
|
348 |
+
'_um_reveal_fields' => array(
|
349 |
+
'sanitize' => array( $this, 'sanitize_user_field' ),
|
350 |
+
),
|
351 |
+
'_um_show_social' => array(
|
352 |
+
'sanitize' => 'bool',
|
353 |
+
),
|
354 |
+
'_um_userinfo_animate' => array(
|
355 |
+
'sanitize' => 'bool',
|
356 |
+
),
|
357 |
+
'_um_search' => array(
|
358 |
+
'sanitize' => 'bool',
|
359 |
+
),
|
360 |
+
'_um_roles_can_search' => array(
|
361 |
+
'sanitize' => array( $this, 'sanitize_restriction_existed_role' ),
|
362 |
+
),
|
363 |
+
'_um_filters' => array(
|
364 |
+
'sanitize' => 'bool',
|
365 |
+
),
|
366 |
+
'_um_roles_can_filter' => array(
|
367 |
+
'sanitize' => array( $this, 'sanitize_restriction_existed_role' ),
|
368 |
+
),
|
369 |
+
'_um_search_fields' => array(
|
370 |
+
'sanitize' => array( $this, 'sanitize_filter_fields' ),
|
371 |
+
),
|
372 |
+
'_um_filters_expanded' => array(
|
373 |
+
'sanitize' => 'bool',
|
374 |
+
),
|
375 |
+
'_um_filters_is_collapsible' => array(
|
376 |
+
'sanitize' => 'bool',
|
377 |
+
),
|
378 |
+
'_um_search_filters' => array(
|
379 |
+
'sanitize' => array( $this, 'sanitize_filter_fields' ),
|
380 |
+
),
|
381 |
+
'_um_sortby' => array(
|
382 |
+
'sanitize' => 'text',
|
383 |
+
),
|
384 |
+
'_um_sortby_custom' => array(
|
385 |
+
'sanitize' => 'text',
|
386 |
+
),
|
387 |
+
'_um_sortby_custom_label' => array(
|
388 |
+
'sanitize' => 'text',
|
389 |
+
),
|
390 |
+
'_um_enable_sorting' => array(
|
391 |
+
'sanitize' => 'bool',
|
392 |
+
),
|
393 |
+
'_um_sorting_fields' => array(
|
394 |
+
'sanitize' => array( $this, 'sanitize_md_sorting_fields' ),
|
395 |
+
),
|
396 |
+
)
|
397 |
+
);
|
398 |
+
|
399 |
+
$this->form_meta = apply_filters(
|
400 |
+
'um_form_meta_map',
|
401 |
+
array(
|
402 |
+
'_um_mode' => array(
|
403 |
+
'sanitize' => 'key',
|
404 |
+
),
|
405 |
+
'_um_register_use_gdpr' => array(
|
406 |
+
'sanitize' => 'bool',
|
407 |
+
),
|
408 |
+
'_um_register_use_gdpr_content_id' => array(
|
409 |
+
'sanitize' => 'absint',
|
410 |
+
),
|
411 |
+
'_um_register_use_gdpr_toggle_show' => array(
|
412 |
+
'sanitize' => 'text',
|
413 |
+
),
|
414 |
+
'_um_register_use_gdpr_toggle_hide' => array(
|
415 |
+
'sanitize' => 'text',
|
416 |
+
),
|
417 |
+
'_um_register_use_gdpr_agreement' => array(
|
418 |
+
'sanitize' => 'text',
|
419 |
+
),
|
420 |
+
'_um_register_use_gdpr_error_text' => array(
|
421 |
+
'sanitize' => 'text',
|
422 |
+
),
|
423 |
+
'_um_register_use_custom_settings' => array(
|
424 |
+
'sanitize' => 'bool',
|
425 |
+
),
|
426 |
+
'_um_register_role' => array(
|
427 |
+
'sanitize' => 'key',
|
428 |
+
),
|
429 |
+
'_um_register_template' => array(
|
430 |
+
'sanitize' => 'text',
|
431 |
+
),
|
432 |
+
'_um_register_max_width' => array(
|
433 |
+
'sanitize' => 'text',
|
434 |
+
),
|
435 |
+
'_um_register_icons' => array(
|
436 |
+
'sanitize' => 'key',
|
437 |
+
),
|
438 |
+
'_um_register_primary_btn_word' => array(
|
439 |
+
'sanitize' => 'text',
|
440 |
+
),
|
441 |
+
'_um_register_secondary_btn' => array(
|
442 |
+
'sanitize' => 'bool',
|
443 |
+
),
|
444 |
+
'_um_register_secondary_btn_word' => array(
|
445 |
+
'sanitize' => 'text',
|
446 |
+
),
|
447 |
+
'_um_login_after_login' => array(
|
448 |
+
'sanitize' => 'key',
|
449 |
+
),
|
450 |
+
'_um_login_redirect_url' => array(
|
451 |
+
'sanitize' => 'url',
|
452 |
+
),
|
453 |
+
'_um_login_use_custom_settings' => array(
|
454 |
+
'sanitize' => 'bool',
|
455 |
+
),
|
456 |
+
'_um_login_template' => array(
|
457 |
+
'sanitize' => 'text',
|
458 |
+
),
|
459 |
+
'_um_login_max_width' => array(
|
460 |
+
'sanitize' => 'text',
|
461 |
+
),
|
462 |
+
'_um_login_icons' => array(
|
463 |
+
'sanitize' => 'key',
|
464 |
+
),
|
465 |
+
'_um_login_primary_btn_word' => array(
|
466 |
+
'sanitize' => 'text',
|
467 |
+
),
|
468 |
+
'_um_login_secondary_btn' => array(
|
469 |
+
'sanitize' => 'bool',
|
470 |
+
),
|
471 |
+
'_um_login_secondary_btn_word' => array(
|
472 |
+
'sanitize' => 'text',
|
473 |
+
),
|
474 |
+
'_um_login_forgot_pass_link' => array(
|
475 |
+
'sanitize' => 'bool',
|
476 |
+
),
|
477 |
+
'_um_login_show_rememberme' => array(
|
478 |
+
'sanitize' => 'bool',
|
479 |
+
),
|
480 |
+
'_um_profile_metafields' => array(
|
481 |
+
'sanitize' => array( $this, 'sanitize_user_field' ),
|
482 |
+
),
|
483 |
+
'_um_profile_use_custom_settings' => array(
|
484 |
+
'sanitize' => 'bool',
|
485 |
+
),
|
486 |
+
'_um_profile_role' => array(
|
487 |
+
'sanitize' => array( $this, 'sanitize_existed_role' ),
|
488 |
+
),
|
489 |
+
'_um_profile_template' => array(
|
490 |
+
'sanitize' => 'text',
|
491 |
+
),
|
492 |
+
'_um_profile_max_width' => array(
|
493 |
+
'sanitize' => 'text',
|
494 |
+
),
|
495 |
+
'_um_profile_area_max_width' => array(
|
496 |
+
'sanitize' => 'text',
|
497 |
+
),
|
498 |
+
'_um_profile_icons' => array(
|
499 |
+
'sanitize' => 'key',
|
500 |
+
),
|
501 |
+
'_um_profile_primary_btn_word' => array(
|
502 |
+
'sanitize' => 'text',
|
503 |
+
),
|
504 |
+
'_um_profile_secondary_btn' => array(
|
505 |
+
'sanitize' => 'bool',
|
506 |
+
),
|
507 |
+
'_um_profile_secondary_btn_word' => array(
|
508 |
+
'sanitize' => 'text',
|
509 |
+
),
|
510 |
+
'_um_profile_cover_enabled' => array(
|
511 |
+
'sanitize' => 'bool',
|
512 |
+
),
|
513 |
+
'_um_profile_coversize' => array(
|
514 |
+
'sanitize' => 'absint',
|
515 |
+
),
|
516 |
+
'_um_profile_cover_ratio' => array(
|
517 |
+
'sanitize' => 'text',
|
518 |
+
),
|
519 |
+
'_um_profile_disable_photo_upload' => array(
|
520 |
+
'sanitize' => 'bool',
|
521 |
+
),
|
522 |
+
'_um_profile_photosize' => array(
|
523 |
+
'sanitize' => array( $this, 'sanitize_photosize' ),
|
524 |
+
),
|
525 |
+
'_um_profile_photo_required' => array(
|
526 |
+
'sanitize' => 'bool',
|
527 |
+
),
|
528 |
+
'_um_profile_show_name' => array(
|
529 |
+
'sanitize' => 'bool',
|
530 |
+
),
|
531 |
+
'_um_profile_show_social_links' => array(
|
532 |
+
'sanitize' => 'bool',
|
533 |
+
),
|
534 |
+
'_um_profile_show_bio' => array(
|
535 |
+
'sanitize' => 'bool',
|
536 |
+
),
|
537 |
+
|
538 |
+
)
|
539 |
+
);
|
540 |
+
|
541 |
+
$this->builder_input = apply_filters(
|
542 |
+
'um_builder_input_map',
|
543 |
+
array(
|
544 |
+
'_in_row' => array(
|
545 |
+
'sanitize' => 'key',
|
546 |
+
),
|
547 |
+
'_in_sub_row' => array(
|
548 |
+
'sanitize' => 'absint',
|
549 |
+
),
|
550 |
+
'_in_column' => array(
|
551 |
+
'sanitize' => 'absint',
|
552 |
+
),
|
553 |
+
'_in_group' => array(
|
554 |
+
'sanitize' => 'absint',
|
555 |
+
),
|
556 |
+
'_visibility' => array(
|
557 |
+
'sanitize' => 'key',
|
558 |
+
),
|
559 |
+
'_conditional_action' => array(
|
560 |
+
'sanitize' => 'key',
|
561 |
+
),
|
562 |
+
'_conditional_action1' => array(
|
563 |
+
'sanitize' => 'key',
|
564 |
+
),
|
565 |
+
'_conditional_action2' => array(
|
566 |
+
'sanitize' => 'key',
|
567 |
+
),
|
568 |
+
'_conditional_action3' => array(
|
569 |
+
'sanitize' => 'key',
|
570 |
+
),
|
571 |
+
'_conditional_action4' => array(
|
572 |
+
'sanitize' => 'key',
|
573 |
+
),
|
574 |
+
'_conditional_field' => array(
|
575 |
+
'sanitize' => 'text',
|
576 |
+
),
|
577 |
+
'_conditional_field1' => array(
|
578 |
+
'sanitize' => 'text',
|
579 |
+
),
|
580 |
+
'_conditional_field2' => array(
|
581 |
+
'sanitize' => 'text',
|
582 |
+
),
|
583 |
+
'_conditional_field3' => array(
|
584 |
+
'sanitize' => 'text',
|
585 |
+
),
|
586 |
+
'_conditional_field4' => array(
|
587 |
+
'sanitize' => 'text',
|
588 |
+
),
|
589 |
+
'_conditional_operator' => array(
|
590 |
+
'sanitize' => 'text',
|
591 |
+
),
|
592 |
+
'_conditional_operator1' => array(
|
593 |
+
'sanitize' => 'text',
|
594 |
+
),
|
595 |
+
'_conditional_operator2' => array(
|
596 |
+
'sanitize' => 'text',
|
597 |
+
),
|
598 |
+
'_conditional_operator3' => array(
|
599 |
+
'sanitize' => 'text',
|
600 |
+
),
|
601 |
+
'_conditional_operator4' => array(
|
602 |
+
'sanitize' => 'text',
|
603 |
+
),
|
604 |
+
'_conditional_value' => array(
|
605 |
+
'sanitize' => 'text',
|
606 |
+
),
|
607 |
+
'_conditional_value1' => array(
|
608 |
+
'sanitize' => 'text',
|
609 |
+
),
|
610 |
+
'_conditional_value2' => array(
|
611 |
+
'sanitize' => 'text',
|
612 |
+
),
|
613 |
+
'_conditional_value3' => array(
|
614 |
+
'sanitize' => 'text',
|
615 |
+
),
|
616 |
+
'_conditional_value4' => array(
|
617 |
+
'sanitize' => 'text',
|
618 |
+
),
|
619 |
+
'_validate' => array(
|
620 |
+
'sanitize' => 'key',
|
621 |
+
),
|
622 |
+
'_custom_validate' => array(
|
623 |
+
'sanitize' => 'text',
|
624 |
+
),
|
625 |
+
'_icon' => array(
|
626 |
+
'sanitize' => 'key',
|
627 |
+
),
|
628 |
+
'_css_class' => array(
|
629 |
+
'sanitize' => 'text',
|
630 |
+
),
|
631 |
+
'_width' => array(
|
632 |
+
'sanitize' => 'absint',
|
633 |
+
),
|
634 |
+
'_divider_text' => array(
|
635 |
+
'sanitize' => 'text',
|
636 |
+
),
|
637 |
+
'_padding' => array(
|
638 |
+
'sanitize' => 'text',
|
639 |
+
),
|
640 |
+
'_margin' => array(
|
641 |
+
'sanitize' => 'text',
|
642 |
+
),
|
643 |
+
'_border' => array(
|
644 |
+
'sanitize' => 'text',
|
645 |
+
),
|
646 |
+
'_borderstyle' => array(
|
647 |
+
'sanitize' => 'key',
|
648 |
+
),
|
649 |
+
'_borderradius' => array(
|
650 |
+
'sanitize' => 'text',
|
651 |
+
),
|
652 |
+
'_bordercolor' => array(
|
653 |
+
'sanitize' => 'text',
|
654 |
+
),
|
655 |
+
'_heading' => array(
|
656 |
+
'sanitize' => 'bool',
|
657 |
+
),
|
658 |
+
'_heading_text' => array(
|
659 |
+
'sanitize' => 'text',
|
660 |
+
),
|
661 |
+
'_background' => array(
|
662 |
+
'sanitize' => 'text',
|
663 |
+
),
|
664 |
+
'_heading_background_color' => array(
|
665 |
+
'sanitize' => 'text',
|
666 |
+
),
|
667 |
+
'_heading_text_color' => array(
|
668 |
+
'sanitize' => 'text',
|
669 |
+
),
|
670 |
+
'_text_color' => array(
|
671 |
+
'sanitize' => 'text',
|
672 |
+
),
|
673 |
+
'_icon_color' => array(
|
674 |
+
'sanitize' => 'text',
|
675 |
+
),
|
676 |
+
'_color' => array(
|
677 |
+
'sanitize' => 'text',
|
678 |
+
),
|
679 |
+
'_url_text' => array(
|
680 |
+
'sanitize' => 'text',
|
681 |
+
),
|
682 |
+
'_url_target' => array(
|
683 |
+
'sanitize' => 'key',
|
684 |
+
),
|
685 |
+
'_url_rel' => array(
|
686 |
+
'sanitize' => 'key',
|
687 |
+
),
|
688 |
+
'_force_good_pass' => array(
|
689 |
+
'sanitize' => 'bool',
|
690 |
+
),
|
691 |
+
'_force_confirm_pass' => array(
|
692 |
+
'sanitize' => 'bool',
|
693 |
+
),
|
694 |
+
'_style' => array(
|
695 |
+
'sanitize' => 'key',
|
696 |
+
),
|
697 |
+
'_intervals' => array(
|
698 |
+
'sanitize' => 'absint',
|
699 |
+
),
|
700 |
+
'_format' => array(
|
701 |
+
'sanitize' => 'text',
|
702 |
+
),
|
703 |
+
'_format_custom' => array(
|
704 |
+
'sanitize' => 'text',
|
705 |
+
),
|
706 |
+
'_pretty_format' => array(
|
707 |
+
'sanitize' => 'bool',
|
708 |
+
),
|
709 |
+
'_disabled_weekdays' => array(
|
710 |
+
'sanitize' => 'absint',
|
711 |
+
),
|
712 |
+
'_years' => array(
|
713 |
+
'sanitize' => 'absint',
|
714 |
+
),
|
715 |
+
'_years_x' => array(
|
716 |
+
'sanitize' => 'key',
|
717 |
+
),
|
718 |
+
'_range_start' => array(
|
719 |
+
'sanitize' => 'text',
|
720 |
+
),
|
721 |
+
'_range_end' => array(
|
722 |
+
'sanitize' => 'text',
|
723 |
+
),
|
724 |
+
'_range' => array(
|
725 |
+
'sanitize' => 'key',
|
726 |
+
),
|
727 |
+
'_content' => array(
|
728 |
+
'sanitize' => 'textarea',
|
729 |
+
),
|
730 |
+
'_crop' => array(
|
731 |
+
'sanitize' => 'int',
|
732 |
+
),
|
733 |
+
'_allowed_types' => array(
|
734 |
+
'sanitize' => 'key',
|
735 |
+
),
|
736 |
+
'_upload_text' => array(
|
737 |
+
'sanitize' => 'text',
|
738 |
+
),
|
739 |
+
'_upload_help_text' => array(
|
740 |
+
'sanitize' => 'text',
|
741 |
+
),
|
742 |
+
'_button_text' => array(
|
743 |
+
'sanitize' => 'text',
|
744 |
+
),
|
745 |
+
'_max_size' => array(
|
746 |
+
'sanitize' => 'absint',
|
747 |
+
),
|
748 |
+
'_height' => array(
|
749 |
+
'sanitize' => 'text',
|
750 |
+
),
|
751 |
+
'_spacing' => array(
|
752 |
+
'sanitize' => 'text',
|
753 |
+
),
|
754 |
+
'_is_multi' => array(
|
755 |
+
'sanitize' => 'bool',
|
756 |
+
),
|
757 |
+
'_max_selections' => array(
|
758 |
+
'sanitize' => 'absint',
|
759 |
+
),
|
760 |
+
'_min_selections' => array(
|
761 |
+
'sanitize' => 'absint',
|
762 |
+
),
|
763 |
+
'_max_entries' => array(
|
764 |
+
'sanitize' => 'absint',
|
765 |
+
),
|
766 |
+
'_max_words' => array(
|
767 |
+
'sanitize' => 'absint',
|
768 |
+
),
|
769 |
+
'_min' => array(
|
770 |
+
'sanitize' => 'absint',
|
771 |
+
),
|
772 |
+
'_max' => array(
|
773 |
+
'sanitize' => 'absint',
|
774 |
+
),
|
775 |
+
'_min_chars' => array(
|
776 |
+
'sanitize' => 'absint',
|
777 |
+
),
|
778 |
+
'_max_chars' => array(
|
779 |
+
'sanitize' => 'absint',
|
780 |
+
),
|
781 |
+
'_html' => array(
|
782 |
+
'sanitize' => 'bool',
|
783 |
+
),
|
784 |
+
'_options' => array(
|
785 |
+
'sanitize' => 'textarea',
|
786 |
+
),
|
787 |
+
'_title' => array(
|
788 |
+
'sanitize' => 'text',
|
789 |
+
),
|
790 |
+
'_id' => array(
|
791 |
+
'sanitize' => 'text',
|
792 |
+
),
|
793 |
+
'_metakey' => array(
|
794 |
+
'sanitize' => 'text',
|
795 |
+
),
|
796 |
+
'_help' => array(
|
797 |
+
'sanitize' => 'text',
|
798 |
+
),
|
799 |
+
'_default' => array(
|
800 |
+
'sanitize' => 'text',
|
801 |
+
),
|
802 |
+
'_label' => array(
|
803 |
+
'sanitize' => 'text',
|
804 |
+
),
|
805 |
+
'_label_confirm_pass' => array(
|
806 |
+
'sanitize' => 'text',
|
807 |
+
),
|
808 |
+
'_placeholder' => array(
|
809 |
+
'sanitize' => 'text',
|
810 |
+
),
|
811 |
+
'_public' => array(
|
812 |
+
'sanitize' => 'text',
|
813 |
+
),
|
814 |
+
'_roles' => array(
|
815 |
+
'sanitize' => array( $this, 'sanitize_existed_role' ),
|
816 |
+
),
|
817 |
+
'_required' => array(
|
818 |
+
'sanitize' => 'bool',
|
819 |
+
),
|
820 |
+
'_editable' => array(
|
821 |
+
'sanitize' => 'bool',
|
822 |
+
),
|
823 |
+
'_number' => array(
|
824 |
+
'sanitize' => 'absint',
|
825 |
+
),
|
826 |
+
'_custom_dropdown_options_source' => array(
|
827 |
+
'sanitize' => 'text',
|
828 |
+
),
|
829 |
+
'_parent_dropdown_relationship' => array(
|
830 |
+
'sanitize' => 'text',
|
831 |
+
),
|
832 |
+
)
|
833 |
+
);
|
834 |
+
}
|
835 |
+
|
836 |
+
|
837 |
+
/**
|
838 |
+
* @param array|string $value
|
839 |
+
*
|
840 |
+
* @return array|string
|
841 |
+
*/
|
842 |
+
public function sanitize_md_sorting_fields( $value ) {
|
843 |
+
$filter_fields = array_merge( UM()->member_directory()->sort_fields, array( 'other' => __( 'Other (Custom Field)', 'ultimate-member' ) ) );
|
844 |
+
$filter_fields = array_keys( $filter_fields );
|
845 |
+
|
846 |
+
if ( '' !== $value ) {
|
847 |
+
$value = array_filter(
|
848 |
+
$value,
|
849 |
+
function( $v, $k ) use ( $filter_fields ) {
|
850 |
+
if ( 'other_data' === $k ) {
|
851 |
+
return true;
|
852 |
+
} else {
|
853 |
+
return in_array( sanitize_text_field( $v ), $filter_fields, true );
|
854 |
+
}
|
855 |
+
},
|
856 |
+
ARRAY_FILTER_USE_BOTH
|
857 |
+
);
|
858 |
+
|
859 |
+
$value = array_map(
|
860 |
+
function( $item ) {
|
861 |
+
if ( is_array( $item ) ) {
|
862 |
+
if ( isset( $item['meta_key'] ) ) {
|
863 |
+
$item['meta_key'] = sanitize_text_field( $item['meta_key'] );
|
864 |
+
}
|
865 |
+
if ( isset( $item['label'] ) ) {
|
866 |
+
$item['label'] = sanitize_text_field( $item['label'] );
|
867 |
+
}
|
868 |
+
|
869 |
+
return $item;
|
870 |
+
} else {
|
871 |
+
return sanitize_text_field( $item );
|
872 |
+
}
|
873 |
+
},
|
874 |
+
$value
|
875 |
+
);
|
876 |
+
}
|
877 |
+
|
878 |
+
return $value;
|
879 |
+
}
|
880 |
+
|
881 |
+
|
882 |
+
/**
|
883 |
+
* @param array|string $value
|
884 |
+
*
|
885 |
+
* @return array|string
|
886 |
+
*/
|
887 |
+
public function sanitize_filter_fields( $value ) {
|
888 |
+
$filter_fields = array_keys( UM()->member_directory()->filter_fields );
|
889 |
+
|
890 |
+
if ( '' !== $value ) {
|
891 |
+
$value = array_filter(
|
892 |
+
$value,
|
893 |
+
function( $v, $k ) use ( $filter_fields ) {
|
894 |
+
return in_array( sanitize_text_field( $v ), $filter_fields, true );
|
895 |
+
},
|
896 |
+
ARRAY_FILTER_USE_BOTH
|
897 |
+
);
|
898 |
+
|
899 |
+
$value = array_map( 'sanitize_text_field', $value );
|
900 |
+
}
|
901 |
+
|
902 |
+
return $value;
|
903 |
+
}
|
904 |
+
|
905 |
+
|
906 |
+
/**
|
907 |
+
* @param array|string $value
|
908 |
+
*
|
909 |
+
* @return array|string
|
910 |
+
*/
|
911 |
+
public function sanitize_user_field( $value ) {
|
912 |
+
$user_fields = array_keys( UM()->builtin()->all_user_fields() );
|
913 |
+
|
914 |
+
if ( '' !== $value ) {
|
915 |
+
$value = array_filter(
|
916 |
+
$value,
|
917 |
+
function( $v, $k ) use ( $user_fields ) {
|
918 |
+
return in_array( sanitize_text_field( $v ), $user_fields, true );
|
919 |
+
},
|
920 |
+
ARRAY_FILTER_USE_BOTH
|
921 |
+
);
|
922 |
+
|
923 |
+
$value = array_map( 'sanitize_text_field', $value );
|
924 |
+
}
|
925 |
+
|
926 |
+
return $value;
|
927 |
+
}
|
928 |
+
|
929 |
+
|
930 |
+
/**
|
931 |
+
* @param array|string $value
|
932 |
+
*
|
933 |
+
* @return array|string
|
934 |
+
*/
|
935 |
+
public function sanitize_md_view_types( $value ) {
|
936 |
+
$view_types = array_map(
|
937 |
+
function ( $item ) {
|
938 |
+
return $item['title'];
|
939 |
+
},
|
940 |
+
UM()->member_directory()->view_types
|
941 |
+
);
|
942 |
+
$view_types = array_keys( $view_types );
|
943 |
+
|
944 |
+
if ( '' !== $value ) {
|
945 |
+
$value = array_filter(
|
946 |
+
$value,
|
947 |
+
function( $v, $k ) use ( $view_types ) {
|
948 |
+
return in_array( sanitize_key( $k ), $view_types, true ) && 1 === (int) $v;
|
949 |
+
},
|
950 |
+
ARRAY_FILTER_USE_BOTH
|
951 |
+
);
|
952 |
+
|
953 |
+
$value = array_map( 'sanitize_key', $value );
|
954 |
+
}
|
955 |
+
|
956 |
+
return $value;
|
957 |
+
}
|
958 |
+
|
959 |
+
|
960 |
+
/**
|
961 |
+
* @param array|string $value
|
962 |
+
*
|
963 |
+
* @return array|string
|
964 |
+
*/
|
965 |
+
public function sanitize_photosize( $value ) {
|
966 |
+
$sizes = UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' );
|
967 |
+
$sizes = array_keys( $sizes );
|
968 |
+
|
969 |
+
if ( '' !== $value ) {
|
970 |
+
$value = in_array( absint( $value ), $sizes, true ) ? absint( $value ) : '';
|
971 |
+
}
|
972 |
+
|
973 |
+
return $value;
|
974 |
+
}
|
975 |
+
|
976 |
+
|
977 |
+
/**
|
978 |
+
* @param array|string $value
|
979 |
+
*
|
980 |
+
* @return array|string
|
981 |
+
*/
|
982 |
+
public function sanitize_cover_photosize( $value ) {
|
983 |
+
$sizes = UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' );
|
984 |
+
$sizes = array_keys( $sizes );
|
985 |
+
|
986 |
+
if ( '' !== $value ) {
|
987 |
+
$value = in_array( absint( $value ), $sizes, true ) ? absint( $value ) : '';
|
988 |
+
}
|
989 |
+
|
990 |
+
return $value;
|
991 |
+
}
|
992 |
+
|
993 |
+
|
994 |
+
/**
|
995 |
+
* @param array|string $value
|
996 |
+
*
|
997 |
+
* @return array|string
|
998 |
+
*/
|
999 |
+
public function sanitize_restriction_existed_role( $value ) {
|
1000 |
+
$all_roles = array_keys( UM()->roles()->get_roles() );
|
1001 |
+
|
1002 |
+
if ( '' !== $value ) {
|
1003 |
+
$value = array_filter(
|
1004 |
+
$value,
|
1005 |
+
function( $v, $k ) use ( $all_roles ) {
|
1006 |
+
return in_array( sanitize_key( $k ), $all_roles, true ) && 1 === (int) $v;
|
1007 |
+
},
|
1008 |
+
ARRAY_FILTER_USE_BOTH
|
1009 |
+
);
|
1010 |
+
|
1011 |
+
$value = array_map( 'sanitize_key', $value );
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
return $value;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
|
1018 |
+
/**
|
1019 |
+
* @param array|string $value
|
1020 |
+
*
|
1021 |
+
* @return array|string
|
1022 |
+
*/
|
1023 |
+
public function sanitize_existed_role( $value ) {
|
1024 |
+
$all_roles = array_keys( UM()->roles()->get_roles() );
|
1025 |
+
|
1026 |
+
if ( '' !== $value ) {
|
1027 |
+
$value = array_filter(
|
1028 |
+
$value,
|
1029 |
+
function( $v, $k ) use ( $all_roles ) {
|
1030 |
+
return in_array( sanitize_key( $v ), $all_roles, true );
|
1031 |
+
},
|
1032 |
+
ARRAY_FILTER_USE_BOTH
|
1033 |
+
);
|
1034 |
+
|
1035 |
+
$value = array_map( 'sanitize_key', $value );
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
return $value;
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
|
1042 |
+
/**
|
1043 |
+
* @param array|string $value
|
1044 |
+
*
|
1045 |
+
* @return array|string
|
1046 |
+
*/
|
1047 |
+
public function sanitize_tabs_privacy( $value ) {
|
1048 |
+
$all_privacy = array_keys( UM()->profile()->tabs_privacy() );
|
1049 |
+
|
1050 |
+
if ( '' !== $value ) {
|
1051 |
+
$value = in_array( absint( $value ), $all_privacy, true ) ? absint( $value ) : '';
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
return $value;
|
1055 |
+
}
|
1056 |
+
|
1057 |
+
|
1058 |
+
/**
|
1059 |
+
* @param $value
|
1060 |
+
*
|
1061 |
+
* @return bool|string
|
1062 |
+
*/
|
1063 |
+
public function sanitize_profile_noindex( $value ) {
|
1064 |
+
$value = '' !== $value ? (bool) $value : $value;
|
1065 |
+
return $value;
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
|
1069 |
+
/**
|
1070 |
+
* @param $value
|
1071 |
+
*
|
1072 |
+
* @return array
|
1073 |
+
*/
|
1074 |
+
public function sanitize_wp_capabilities( $value ) {
|
1075 |
+
$value = array_map( 'boolval', array_filter( $value ) );
|
1076 |
+
return $value;
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
|
1080 |
+
/**
|
1081 |
+
* Sanitize role meta fields when wp-admin form has been submitted
|
1082 |
+
*
|
1083 |
+
* @param array $data
|
1084 |
+
*
|
1085 |
+
* @return array
|
1086 |
+
*/
|
1087 |
+
public function sanitize_role_meta( $data ) {
|
1088 |
+
$sanitized = array();
|
1089 |
+
foreach ( $data as $k => $v ) {
|
1090 |
+
if ( ! array_key_exists( $k, $this->role_meta ) ) {
|
1091 |
+
// @todo remove since 2.2.x and leave only continue
|
1092 |
+
$sanitized[ $k ] = $v;
|
1093 |
+
continue;
|
1094 |
+
}
|
1095 |
+
|
1096 |
+
if ( ! array_key_exists( 'sanitize', $this->role_meta[ $k ] ) ) {
|
1097 |
+
// @todo remove since 2.2.x and leave only continue
|
1098 |
+
$sanitized[ $k ] = $v;
|
1099 |
+
continue;
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
if ( is_callable( $this->role_meta[ $k ]['sanitize'], true, $callable_name ) ) {
|
1103 |
+
add_filter( 'um_role_meta_sanitize_' . $k, $this->role_meta[ $k ]['sanitize'], 10, 1 );
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
switch ( $this->role_meta[ $k ]['sanitize'] ) {
|
1107 |
+
default:
|
1108 |
+
$sanitized[ $k ] = apply_filters( 'um_role_meta_sanitize_' . $k, $data[ $k ] );
|
1109 |
+
break;
|
1110 |
+
case 'int':
|
1111 |
+
$sanitized[ $k ] = (int) $v;
|
1112 |
+
break;
|
1113 |
+
case 'bool':
|
1114 |
+
$sanitized[ $k ] = (bool) $v;
|
1115 |
+
break;
|
1116 |
+
case 'url':
|
1117 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1118 |
+
break;
|
1119 |
+
case 'textarea':
|
1120 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1121 |
+
break;
|
1122 |
+
case 'sanitize_array_key':
|
1123 |
+
if ( ! array_key_exists( 'default', $this->role_meta[ $k ] ) || ! array_key_exists( 'array', $this->role_meta[ $k ] ) ) {
|
1124 |
+
continue 2;
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
$sanitized[ $k ] = ! in_array( sanitize_key( $v ), $this->role_meta[ $k ]['array'], true ) ? $this->role_meta[ $k ]['default'] : sanitize_key( $v );
|
1128 |
+
break;
|
1129 |
+
}
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
$data = $sanitized;
|
1133 |
+
|
1134 |
+
$data = apply_filters( 'um_save_role_meta_sanitize', $data );
|
1135 |
+
|
1136 |
+
return $data;
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
|
1140 |
+
/**
|
1141 |
+
* Sanitize post restriction meta fields when wp-admin form has been submitted
|
1142 |
+
*
|
1143 |
+
* @param array $data
|
1144 |
+
*
|
1145 |
+
* @return array
|
1146 |
+
*/
|
1147 |
+
public function sanitize_post_restriction_meta( $data ) {
|
1148 |
+
$sanitized = array();
|
1149 |
+
foreach ( $data as $k => $v ) {
|
1150 |
+
if ( ! array_key_exists( $k, $this->restriction_post_meta ) ) {
|
1151 |
+
// @todo remove since 2.2.x and leave only continue
|
1152 |
+
$sanitized[ $k ] = $v;
|
1153 |
+
continue;
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
if ( ! array_key_exists( 'sanitize', $this->restriction_post_meta[ $k ] ) ) {
|
1157 |
+
// @todo remove since 2.2.x and leave only continue
|
1158 |
+
$sanitized[ $k ] = $v;
|
1159 |
+
continue;
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
if ( is_callable( $this->restriction_post_meta[ $k ]['sanitize'], true, $callable_name ) ) {
|
1163 |
+
add_filter( 'um_restriction_post_meta_sanitize_' . $k, $this->restriction_post_meta[ $k ]['sanitize'], 10, 1 );
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
switch ( $this->restriction_post_meta[ $k ]['sanitize'] ) {
|
1167 |
+
default:
|
1168 |
+
$sanitized[ $k ] = apply_filters( 'um_restriction_post_meta_sanitize_' . $k, $data[ $k ] );
|
1169 |
+
break;
|
1170 |
+
case 'int':
|
1171 |
+
$sanitized[ $k ] = (int) $v;
|
1172 |
+
break;
|
1173 |
+
case 'bool':
|
1174 |
+
$sanitized[ $k ] = (bool) $v;
|
1175 |
+
break;
|
1176 |
+
case 'url':
|
1177 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1178 |
+
break;
|
1179 |
+
case 'textarea':
|
1180 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1181 |
+
break;
|
1182 |
+
case 'wp_kses':
|
1183 |
+
$sanitized[ $k ] = wp_kses_post( $v );
|
1184 |
+
break;
|
1185 |
+
}
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
$data = $sanitized;
|
1189 |
+
|
1190 |
+
$data = apply_filters( 'um_save_restriction_post_meta_sanitize', $data );
|
1191 |
+
|
1192 |
+
return $data;
|
1193 |
+
}
|
1194 |
+
|
1195 |
+
|
1196 |
+
/**
|
1197 |
+
* Sanitize term restriction meta fields when wp-admin form has been submitted
|
1198 |
+
*
|
1199 |
+
* @param array $data
|
1200 |
+
*
|
1201 |
+
* @return array
|
1202 |
+
*/
|
1203 |
+
public function sanitize_term_restriction_meta( $data ) {
|
1204 |
+
$sanitized = array();
|
1205 |
+
foreach ( $data as $k => $v ) {
|
1206 |
+
if ( ! array_key_exists( $k, $this->restriction_term_meta ) ) {
|
1207 |
+
// @todo remove since 2.2.x and leave only continue
|
1208 |
+
$sanitized[ $k ] = $v;
|
1209 |
+
continue;
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
if ( ! array_key_exists( 'sanitize', $this->restriction_term_meta[ $k ] ) ) {
|
1213 |
+
// @todo remove since 2.2.x and leave only continue
|
1214 |
+
$sanitized[ $k ] = $v;
|
1215 |
+
continue;
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
if ( is_callable( $this->restriction_term_meta[ $k ]['sanitize'], true, $callable_name ) ) {
|
1219 |
+
add_filter( 'um_restriction_term_meta_sanitize_' . $k, $this->restriction_term_meta[ $k ]['sanitize'], 10, 1 );
|
1220 |
+
}
|
1221 |
+
|
1222 |
+
switch ( $this->restriction_term_meta[ $k ]['sanitize'] ) {
|
1223 |
+
default:
|
1224 |
+
$sanitized[ $k ] = apply_filters( 'um_restriction_term_meta_sanitize_' . $k, $data[ $k ] );
|
1225 |
+
break;
|
1226 |
+
case 'int':
|
1227 |
+
$sanitized[ $k ] = (int) $v;
|
1228 |
+
break;
|
1229 |
+
case 'bool':
|
1230 |
+
$sanitized[ $k ] = (bool) $v;
|
1231 |
+
break;
|
1232 |
+
case 'url':
|
1233 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1234 |
+
break;
|
1235 |
+
case 'textarea':
|
1236 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1237 |
+
break;
|
1238 |
+
case 'wp_kses':
|
1239 |
+
$sanitized[ $k ] = wp_kses_post( $v );
|
1240 |
+
break;
|
1241 |
+
}
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
$data = $sanitized;
|
1245 |
+
|
1246 |
+
$data = apply_filters( 'um_save_restriction_term_meta_sanitize', $data );
|
1247 |
+
|
1248 |
+
return $data;
|
1249 |
+
}
|
1250 |
+
|
1251 |
+
|
1252 |
+
/**
|
1253 |
+
* Sanitize member directory meta when wp-admin form has been submitted
|
1254 |
+
*
|
1255 |
+
* @todo checking all sanitize types
|
1256 |
+
*
|
1257 |
+
* @param array $data
|
1258 |
+
*
|
1259 |
+
* @return array
|
1260 |
+
*/
|
1261 |
+
public function sanitize_member_directory_meta( $data ) {
|
1262 |
+
$sanitized = array();
|
1263 |
+
foreach ( $data as $k => $v ) {
|
1264 |
+
if ( ! array_key_exists( $k, $this->member_directory_meta ) ) {
|
1265 |
+
// @todo remove since 2.2.x and leave only continue
|
1266 |
+
$sanitized[ $k ] = $v;
|
1267 |
+
continue;
|
1268 |
+
}
|
1269 |
+
|
1270 |
+
if ( ! array_key_exists( 'sanitize', $this->member_directory_meta[ $k ] ) ) {
|
1271 |
+
// @todo remove since 2.2.x and leave only continue
|
1272 |
+
$sanitized[ $k ] = $v;
|
1273 |
+
continue;
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
if ( is_callable( $this->member_directory_meta[ $k ]['sanitize'], true, $callable_name ) ) {
|
1277 |
+
add_filter( 'um_member_directory_meta_sanitize_' . $k, $this->member_directory_meta[ $k ]['sanitize'], 10, 1 );
|
1278 |
+
}
|
1279 |
+
|
1280 |
+
switch ( $this->member_directory_meta[ $k ]['sanitize'] ) {
|
1281 |
+
default:
|
1282 |
+
$sanitized[ $k ] = apply_filters( 'um_member_directory_meta_sanitize_' . $k, $data[ $k ] );
|
1283 |
+
break;
|
1284 |
+
case 'int':
|
1285 |
+
$sanitized[ $k ] = (int) $v;
|
1286 |
+
break;
|
1287 |
+
case 'bool':
|
1288 |
+
$sanitized[ $k ] = (bool) $v;
|
1289 |
+
break;
|
1290 |
+
case 'url':
|
1291 |
+
if ( is_array( $v ) ) {
|
1292 |
+
$sanitized[ $k ] = array_map( 'esc_url_raw', $v );
|
1293 |
+
} else {
|
1294 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1295 |
+
}
|
1296 |
+
break;
|
1297 |
+
case 'text':
|
1298 |
+
$sanitized[ $k ] = sanitize_text_field( $v );
|
1299 |
+
break;
|
1300 |
+
case 'textarea':
|
1301 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1302 |
+
break;
|
1303 |
+
case 'key':
|
1304 |
+
if ( is_array( $v ) ) {
|
1305 |
+
$sanitized[ $k ] = array_map( 'sanitize_key', $v );
|
1306 |
+
} else {
|
1307 |
+
$sanitized[ $k ] = sanitize_key( $v );
|
1308 |
+
}
|
1309 |
+
break;
|
1310 |
+
case 'absint':
|
1311 |
+
if ( is_array( $v ) ) {
|
1312 |
+
$sanitized[ $k ] = array_map( 'absint', $v );
|
1313 |
+
} else {
|
1314 |
+
$sanitized[ $k ] = absint( $v );
|
1315 |
+
}
|
1316 |
+
break;
|
1317 |
+
}
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
$data = $sanitized;
|
1321 |
+
|
1322 |
+
$data = apply_filters( 'um_save_member_directory_meta_sanitize', $data );
|
1323 |
+
|
1324 |
+
return $data;
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
|
1328 |
+
/**
|
1329 |
+
* Sanitize builder field meta when wp-admin form has been submitted
|
1330 |
+
*
|
1331 |
+
* @todo checking all sanitize types
|
1332 |
+
*
|
1333 |
+
* @param array $data
|
1334 |
+
*
|
1335 |
+
* @return array
|
1336 |
+
*/
|
1337 |
+
public function sanitize_builder_field_meta( $data ) {
|
1338 |
+
$sanitized = array();
|
1339 |
+
foreach ( $data as $k => $v ) {
|
1340 |
+
if ( ! array_key_exists( $k, $this->builder_input ) ) {
|
1341 |
+
// @todo remove since 2.2.x and leave only continue
|
1342 |
+
$sanitized[ $k ] = $v;
|
1343 |
+
continue;
|
1344 |
+
}
|
1345 |
+
|
1346 |
+
if ( ! array_key_exists( 'sanitize', $this->builder_input[ $k ] ) ) {
|
1347 |
+
// @todo remove since 2.2.x and leave only continue
|
1348 |
+
$sanitized[ $k ] = $v;
|
1349 |
+
continue;
|
1350 |
+
}
|
1351 |
+
|
1352 |
+
if ( is_callable( $this->builder_input[ $k ]['sanitize'], true, $callable_name ) ) {
|
1353 |
+
add_filter( 'um_builder_input_sanitize_' . $k, $this->builder_input[ $k ]['sanitize'], 10, 1 );
|
1354 |
+
}
|
1355 |
+
|
1356 |
+
switch ( $this->builder_input[ $k ]['sanitize'] ) {
|
1357 |
+
default:
|
1358 |
+
$sanitized[ $k ] = apply_filters( 'um_builder_input_sanitize_' . $k, $data[ $k ] );
|
1359 |
+
break;
|
1360 |
+
case 'int':
|
1361 |
+
$sanitized[ $k ] = (int) $v;
|
1362 |
+
break;
|
1363 |
+
case 'bool':
|
1364 |
+
$sanitized[ $k ] = (bool) $v;
|
1365 |
+
break;
|
1366 |
+
case 'url':
|
1367 |
+
if ( is_array( $v ) ) {
|
1368 |
+
$sanitized[ $k ] = array_map( 'esc_url_raw', $v );
|
1369 |
+
} else {
|
1370 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1371 |
+
}
|
1372 |
+
break;
|
1373 |
+
case 'text':
|
1374 |
+
$sanitized[ $k ] = sanitize_text_field( $v );
|
1375 |
+
break;
|
1376 |
+
case 'textarea':
|
1377 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1378 |
+
break;
|
1379 |
+
case 'wp_kses':
|
1380 |
+
$sanitized[ $k ] = wp_kses_post( $v );
|
1381 |
+
break;
|
1382 |
+
case 'key':
|
1383 |
+
if ( is_array( $v ) ) {
|
1384 |
+
$sanitized[ $k ] = array_map( 'sanitize_key', $v );
|
1385 |
+
} else {
|
1386 |
+
$sanitized[ $k ] = sanitize_key( $v );
|
1387 |
+
}
|
1388 |
+
break;
|
1389 |
+
case 'absint':
|
1390 |
+
if ( is_array( $v ) ) {
|
1391 |
+
$sanitized[ $k ] = array_map( 'absint', $v );
|
1392 |
+
} else {
|
1393 |
+
$sanitized[ $k ] = absint( $v );
|
1394 |
+
}
|
1395 |
+
break;
|
1396 |
+
}
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
$data = $sanitized;
|
1400 |
+
|
1401 |
+
$data = apply_filters( 'um_save_builder_input_sanitize', $data );
|
1402 |
+
|
1403 |
+
return $data;
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
|
1407 |
+
/**
|
1408 |
+
* Sanitize form meta when wp-admin form has been submitted
|
1409 |
+
*
|
1410 |
+
* @todo checking all sanitize types
|
1411 |
+
*
|
1412 |
+
* @param array $data
|
1413 |
+
*
|
1414 |
+
* @return array
|
1415 |
+
*/
|
1416 |
+
public function sanitize_form_meta( $data ) {
|
1417 |
+
$sanitized = array();
|
1418 |
+
foreach ( $data as $k => $v ) {
|
1419 |
+
if ( ! array_key_exists( $k, $this->form_meta ) ) {
|
1420 |
+
// @todo remove since 2.2.x and leave only continue
|
1421 |
+
$sanitized[ $k ] = $v;
|
1422 |
+
continue;
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
if ( ! array_key_exists( 'sanitize', $this->form_meta[ $k ] ) ) {
|
1426 |
+
// @todo remove since 2.2.x and leave only continue
|
1427 |
+
$sanitized[ $k ] = $v;
|
1428 |
+
continue;
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
if ( is_callable( $this->form_meta[ $k ]['sanitize'], true, $callable_name ) ) {
|
1432 |
+
add_filter( 'um_form_meta_sanitize_' . $k, $this->form_meta[ $k ]['sanitize'], 10, 1 );
|
1433 |
+
}
|
1434 |
+
|
1435 |
+
switch ( $this->form_meta[ $k ]['sanitize'] ) {
|
1436 |
+
default:
|
1437 |
+
$sanitized[ $k ] = apply_filters( 'um_form_meta_sanitize_' . $k, $data[ $k ] );
|
1438 |
+
break;
|
1439 |
+
case 'int':
|
1440 |
+
$sanitized[ $k ] = (int) $v;
|
1441 |
+
break;
|
1442 |
+
case 'bool':
|
1443 |
+
$sanitized[ $k ] = (bool) $v;
|
1444 |
+
break;
|
1445 |
+
case 'url':
|
1446 |
+
if ( is_array( $v ) ) {
|
1447 |
+
$sanitized[ $k ] = array_map( 'esc_url_raw', $v );
|
1448 |
+
} else {
|
1449 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1450 |
+
}
|
1451 |
+
break;
|
1452 |
+
case 'text':
|
1453 |
+
$sanitized[ $k ] = sanitize_text_field( $v );
|
1454 |
+
break;
|
1455 |
+
case 'textarea':
|
1456 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1457 |
+
break;
|
1458 |
+
case 'key':
|
1459 |
+
if ( is_array( $v ) ) {
|
1460 |
+
$sanitized[ $k ] = array_map( 'sanitize_key', $v );
|
1461 |
+
} else {
|
1462 |
+
$sanitized[ $k ] = sanitize_key( $v );
|
1463 |
+
}
|
1464 |
+
break;
|
1465 |
+
case 'absint':
|
1466 |
+
if ( is_array( $v ) ) {
|
1467 |
+
$sanitized[ $k ] = array_map( 'absint', $v );
|
1468 |
+
} else {
|
1469 |
+
$sanitized[ $k ] = absint( $v );
|
1470 |
+
}
|
1471 |
+
break;
|
1472 |
+
}
|
1473 |
+
}
|
1474 |
+
|
1475 |
+
$data = $sanitized;
|
1476 |
+
|
1477 |
+
$data = apply_filters( 'um_save_form_meta_sanitize', $data );
|
1478 |
+
|
1479 |
+
return $data;
|
1480 |
+
}
|
1481 |
+
|
1482 |
+
|
1483 |
+
/**
|
1484 |
+
* Sanitize options when wp-admin form has been submitted
|
1485 |
+
*
|
1486 |
+
* @todo checking all sanitize types
|
1487 |
+
*
|
1488 |
+
* @param array $data
|
1489 |
+
*
|
1490 |
+
* @return array
|
1491 |
+
*/
|
1492 |
+
public function sanitize_options( $data ) {
|
1493 |
+
$sanitized = array();
|
1494 |
+
foreach ( $data as $k => $v ) {
|
1495 |
+
if ( ! array_key_exists( $k, UM()->admin_settings()->settings_map ) ) {
|
1496 |
+
// @todo remove since 2.2.x and leave only continue
|
1497 |
+
$sanitized[ $k ] = $v;
|
1498 |
+
continue;
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
if ( ! array_key_exists( 'sanitize', UM()->admin_settings()->settings_map[ $k ] ) ) {
|
1502 |
+
// @todo remove since 2.2.x and leave only continue
|
1503 |
+
$sanitized[ $k ] = $v;
|
1504 |
+
continue;
|
1505 |
+
}
|
1506 |
+
|
1507 |
+
if ( is_callable( UM()->admin_settings()->settings_map[ $k ]['sanitize'], true, $callable_name ) ) {
|
1508 |
+
add_filter( 'um_settings_sanitize_' . $k, UM()->admin_settings()->settings_map[ $k ]['sanitize'], 10, 1 );
|
1509 |
+
}
|
1510 |
+
|
1511 |
+
switch ( UM()->admin_settings()->settings_map[ $k ]['sanitize'] ) {
|
1512 |
+
default:
|
1513 |
+
$sanitized[ $k ] = apply_filters( 'um_settings_sanitize_' . $k, $v );
|
1514 |
+
break;
|
1515 |
+
case 'int':
|
1516 |
+
$sanitized[ $k ] = (int) $v;
|
1517 |
+
break;
|
1518 |
+
case 'absint':
|
1519 |
+
if ( is_array( $v ) ) {
|
1520 |
+
$sanitized[ $k ] = array_map( 'absint', $v );
|
1521 |
+
} else {
|
1522 |
+
$sanitized[ $k ] = absint( $v );
|
1523 |
+
}
|
1524 |
+
break;
|
1525 |
+
case 'key':
|
1526 |
+
if ( is_array( $v ) ) {
|
1527 |
+
$sanitized[ $k ] = array_map( 'sanitize_key', $v );
|
1528 |
+
} else {
|
1529 |
+
$sanitized[ $k ] = sanitize_key( $v );
|
1530 |
+
}
|
1531 |
+
break;
|
1532 |
+
case 'bool':
|
1533 |
+
$sanitized[ $k ] = (bool) $v;
|
1534 |
+
break;
|
1535 |
+
case 'url':
|
1536 |
+
if ( is_array( $v ) ) {
|
1537 |
+
$sanitized[ $k ] = array_map( 'esc_url_raw', $v );
|
1538 |
+
} else {
|
1539 |
+
$sanitized[ $k ] = esc_url_raw( $v );
|
1540 |
+
}
|
1541 |
+
break;
|
1542 |
+
case 'wp_kses':
|
1543 |
+
$sanitized[ $k ] = wp_kses_post( $v );
|
1544 |
+
break;
|
1545 |
+
case 'textarea':
|
1546 |
+
$sanitized[ $k ] = sanitize_textarea_field( $v );
|
1547 |
+
break;
|
1548 |
+
case 'text':
|
1549 |
+
$sanitized[ $k ] = sanitize_text_field( $v );
|
1550 |
+
break;
|
1551 |
+
}
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
$data = $sanitized;
|
1555 |
+
|
1556 |
+
$data = apply_filters( 'um_save_settings_sanitize', $data );
|
1557 |
+
|
1558 |
+
return $data;
|
1559 |
+
}
|
1560 |
+
|
1561 |
+
|
1562 |
+
/**
|
1563 |
+
* Adds class to our admin pages
|
1564 |
+
*
|
1565 |
+
* @param $classes
|
1566 |
+
*
|
1567 |
+
* @return string
|
1568 |
+
*/
|
1569 |
+
public function admin_body_class( $classes ) {
|
1570 |
+
if ( $this->is_um_screen() ) {
|
1571 |
+
return "$classes um-admin";
|
1572 |
+
}
|
1573 |
+
return $classes;
|
1574 |
+
}
|
1575 |
+
|
1576 |
+
|
1577 |
+
/**
|
1578 |
+
*
|
1579 |
+
*/
|
1580 |
+
public function manual_upgrades_request() {
|
1581 |
+
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
1582 |
+
die();
|
1583 |
+
}
|
1584 |
+
|
1585 |
+
$last_request = get_option( 'um_last_manual_upgrades_request', false );
|
1586 |
+
|
1587 |
+
if ( empty( $last_request ) || time() > $last_request + DAY_IN_SECONDS ) {
|
1588 |
+
|
1589 |
+
if ( is_multisite() ) {
|
1590 |
+
$blogs_ids = get_sites();
|
1591 |
+
foreach( $blogs_ids as $b ) {
|
1592 |
+
switch_to_blog( $b->blog_id );
|
1593 |
+
wp_clean_update_cache();
|
1594 |
+
|
1595 |
+
UM()->plugin_updater()->um_checklicenses();
|
1596 |
+
|
1597 |
+
update_option( 'um_last_manual_upgrades_request', time() );
|
1598 |
+
restore_current_blog();
|
1599 |
+
}
|
1600 |
+
} else {
|
1601 |
+
wp_clean_update_cache();
|
1602 |
+
|
1603 |
+
UM()->plugin_updater()->um_checklicenses();
|
1604 |
+
|
1605 |
+
update_option( 'um_last_manual_upgrades_request', time() );
|
1606 |
+
}
|
1607 |
+
|
1608 |
+
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'got_updates' ), admin_url( 'admin.php' ) );
|
1609 |
+
} else {
|
1610 |
+
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'often_updates' ), admin_url( 'admin.php' ) );
|
1611 |
+
}
|
1612 |
+
exit( wp_redirect( $url ) );
|
1613 |
+
}
|
1614 |
+
|
1615 |
+
|
1616 |
+
/**
|
1617 |
+
* Core pages installation
|
1618 |
+
*/
|
1619 |
+
function install_core_pages() {
|
1620 |
+
if ( ! is_admin() ) {
|
1621 |
+
die();
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
UM()->setup()->install_default_pages();
|
1625 |
+
|
1626 |
+
//check empty pages in settings
|
1627 |
+
$empty_pages = array();
|
1628 |
+
|
1629 |
+
$pages = UM()->config()->permalinks;
|
1630 |
+
if ( $pages && is_array( $pages ) ) {
|
1631 |
+
foreach ( $pages as $slug => $page_id ) {
|
1632 |
+
$page = get_post( $page_id );
|
1633 |
+
|
1634 |
+
if ( ! isset( $page->ID ) && in_array( $slug, array_keys( UM()->config()->core_pages ) ) ) {
|
1635 |
+
$empty_pages[] = $slug;
|
1636 |
+
}
|
1637 |
+
}
|
1638 |
+
}
|
1639 |
+
|
1640 |
+
//if there aren't empty pages - then hide pages notice
|
1641 |
+
if ( empty( $empty_pages ) ) {
|
1642 |
+
$hidden_notices = get_option( 'um_hidden_admin_notices', array() );
|
1643 |
+
$hidden_notices[] = 'wrong_pages';
|
1644 |
+
|
1645 |
+
update_option( 'um_hidden_admin_notices', $hidden_notices );
|
1646 |
+
}
|
1647 |
+
|
1648 |
+
$url = add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) );
|
1649 |
+
exit( wp_redirect( $url ) );
|
1650 |
+
}
|
1651 |
+
|
1652 |
+
|
1653 |
+
/**
|
1654 |
+
* Clear all users cache
|
1655 |
+
*
|
1656 |
+
* @param $action
|
1657 |
+
*/
|
1658 |
+
function user_cache( $action ) {
|
1659 |
+
global $wpdb;
|
1660 |
+
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
1661 |
+
die();
|
1662 |
+
}
|
1663 |
+
|
1664 |
+
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'um_cache_userdata_%'" );
|
1665 |
+
|
1666 |
+
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'cleared_cache' ), admin_url( 'admin.php' ) );
|
1667 |
+
exit( wp_redirect( $url ) );
|
1668 |
+
}
|
1669 |
+
|
1670 |
+
|
1671 |
+
/**
|
1672 |
+
* Purge temp uploads dir
|
1673 |
+
* @param $action
|
1674 |
+
*/
|
1675 |
+
function purge_temp( $action ) {
|
1676 |
+
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
1677 |
+
die();
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
UM()->files()->remove_dir( UM()->files()->upload_temp );
|
1681 |
+
|
1682 |
+
$url = add_query_arg( array( 'page' => 'ultimatemember', 'update' => 'purged_temp' ), admin_url( 'admin.php' ) );
|
1683 |
+
exit( wp_redirect( $url ) );
|
1684 |
+
}
|
1685 |
+
|
1686 |
+
|
1687 |
+
/**
|
1688 |
+
* Duplicate form
|
1689 |
+
*
|
1690 |
+
* @param $action
|
1691 |
+
*/
|
1692 |
+
function duplicate_form( $action ) {
|
1693 |
+
if ( ! is_admin() || ! current_user_can('manage_options') ) {
|
1694 |
+
die();
|
1695 |
+
}
|
1696 |
+
if ( ! isset( $_REQUEST['post_id'] ) || ! is_numeric( $_REQUEST['post_id'] ) ) {
|
1697 |
+
die();
|
1698 |
+
}
|
1699 |
+
|
1700 |
+
$post_id = absint( $_REQUEST['post_id'] );
|
1701 |
+
|
1702 |
+
$n = array(
|
1703 |
+
'post_type' => 'um_form',
|
1704 |
+
'post_title' => sprintf( __( 'Duplicate of %s', 'ultimate-member' ), get_the_title( $post_id ) ),
|
1705 |
+
'post_status' => 'publish',
|
1706 |
+
'post_author' => get_current_user_id(),
|
1707 |
+
);
|
1708 |
+
|
1709 |
+
$n_id = wp_insert_post( $n );
|
1710 |
+
|
1711 |
+
$n_fields = get_post_custom( $post_id );
|
1712 |
+
foreach ( $n_fields as $key => $value ) {
|
1713 |
+
|
1714 |
+
if ( $key == '_um_custom_fields' ) {
|
1715 |
+
$the_value = unserialize( $value[0] );
|
1716 |
+
} else {
|
1717 |
+
$the_value = $value[0];
|
1718 |
+
}
|
1719 |
+
|
1720 |
+
update_post_meta( $n_id, $key, $the_value );
|
1721 |
+
|
1722 |
+
}
|
1723 |
+
|
1724 |
+
delete_post_meta( $n_id, '_um_core' );
|
1725 |
+
|
1726 |
+
$url = admin_url( 'edit.php?post_type=um_form' );
|
1727 |
+
$url = add_query_arg( 'update', 'form_duplicated', $url );
|
1728 |
+
|
1729 |
+
exit( wp_redirect( $url ) );
|
1730 |
+
|
1731 |
+
}
|
1732 |
+
|
1733 |
+
|
1734 |
+
/**
|
1735 |
+
* Action to hide notices in admin
|
1736 |
+
*
|
1737 |
+
* @param $action
|
1738 |
+
*/
|
1739 |
+
function um_hide_notice( $action ) {
|
1740 |
+
if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
|
1741 |
+
die();
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
update_option( $action, 1 );
|
1745 |
+
exit( wp_redirect( remove_query_arg( 'um_adm_action' ) ) );
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
|
1749 |
+
/**
|
1750 |
+
* Various user actions
|
1751 |
+
*
|
1752 |
+
* @param $action
|
1753 |
+
*/
|
1754 |
+
function user_action( $action ) {
|
1755 |
+
if ( ! is_admin() || ! current_user_can( 'edit_users' ) ) {
|
1756 |
+
die();
|
1757 |
+
}
|
1758 |
+
if ( ! isset( $_REQUEST['sub'] ) ) {
|
1759 |
+
die();
|
1760 |
+
}
|
1761 |
+
if ( ! isset( $_REQUEST['user_id'] ) ) {
|
1762 |
+
die();
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
um_fetch_user( absint( $_REQUEST['user_id'] ) );
|
1766 |
+
|
1767 |
+
$subaction = sanitize_key( $_REQUEST['sub'] );
|
1768 |
+
|
1769 |
+
/**
|
1770 |
+
* UM hook
|
1771 |
+
*
|
1772 |
+
* @type action
|
1773 |
+
* @title um_admin_user_action_hook
|
1774 |
+
* @description Action on bulk user subaction
|
1775 |
+
* @input_vars
|
1776 |
+
* [{"var":"$subaction","type":"string","desc":"Bulk Subaction"}]
|
1777 |
+
* @change_log
|
1778 |
+
* ["Since: 2.0"]
|
1779 |
+
* @usage add_action( 'um_admin_user_action_hook', 'function_name', 10, 1 );
|
1780 |
+
* @example
|
1781 |
+
* <?php
|
1782 |
+
* add_action( 'um_admin_user_action_hook', 'my_admin_user_action', 10, 1 );
|
1783 |
+
* function my_admin_user_action( $subaction ) {
|
1784 |
+
* // your code here
|
1785 |
+
* }
|
1786 |
+
* ?>
|
1787 |
+
*/
|
1788 |
+
do_action( 'um_admin_user_action_hook', $subaction );
|
1789 |
+
/**
|
1790 |
+
* UM hook
|
1791 |
+
*
|
1792 |
+
* @type action
|
1793 |
+
* @title um_admin_user_action_{$subaction}_hook
|
1794 |
+
* @description Action on bulk user subaction
|
1795 |
+
* @change_log
|
1796 |
+
* ["Since: 2.0"]
|
1797 |
+
* @usage add_action( 'um_admin_user_action_{$subaction}_hook', 'function_name', 10 );
|
1798 |
+
* @example
|
1799 |
+
* <?php
|
1800 |
+
* add_action( 'um_admin_user_action_{$subaction}_hook', 'my_admin_user_action', 10 );
|
1801 |
+
* function my_admin_user_action() {
|
1802 |
+
* // your code here
|
1803 |
+
* }
|
1804 |
+
* ?>
|
1805 |
+
*/
|
1806 |
+
do_action( "um_admin_user_action_{$subaction}_hook" );
|
1807 |
+
|
1808 |
+
um_reset_user();
|
1809 |
+
|
1810 |
+
wp_redirect( add_query_arg( 'update', 'user_updated', admin_url( '?page=ultimatemember' ) ) );
|
1811 |
+
exit;
|
1812 |
+
|
1813 |
+
}
|
1814 |
+
|
1815 |
+
|
1816 |
+
/**
|
1817 |
+
* Add any custom links to plugin page
|
1818 |
+
*
|
1819 |
+
* @param array $links
|
1820 |
+
*
|
1821 |
+
* @return array
|
1822 |
+
*/
|
1823 |
+
function plugin_links( $links ) {
|
1824 |
+
$more_links[] = '<a href="http://docs.ultimatemember.com/">' . __( 'Docs', 'ultimate-member' ) . '</a>';
|
1825 |
+
$more_links[] = '<a href="'.admin_url().'admin.php?page=um_options">' . __( 'Settings', 'ultimate-member' ) . '</a>';
|
1826 |
+
|
1827 |
+
$links = $more_links + $links;
|
1828 |
+
return $links;
|
1829 |
+
}
|
1830 |
+
|
1831 |
+
|
1832 |
+
/**
|
1833 |
+
* Init admin action/filters + request handlers
|
1834 |
+
*/
|
1835 |
+
function admin_init() {
|
1836 |
+
$this->init_variables();
|
1837 |
+
|
1838 |
+
if ( is_admin() && current_user_can( 'manage_options' ) && ! empty( $_REQUEST['um_adm_action'] ) ) {
|
1839 |
+
$action = sanitize_key( $_REQUEST['um_adm_action'] );
|
1840 |
+
|
1841 |
+
/**
|
1842 |
+
* UM hook
|
1843 |
+
*
|
1844 |
+
* @type action
|
1845 |
+
* @title um_admin_do_action__
|
1846 |
+
* @description Make some action on custom admin action
|
1847 |
+
* @input_vars
|
1848 |
+
* [{"var":"$action","type":"string","desc":"Admin Action"}]
|
1849 |
+
* @change_log
|
1850 |
+
* ["Since: 2.0"]
|
1851 |
+
* @usage add_action( 'um_admin_do_action__', 'function_name', 10, 1 );
|
1852 |
+
* @example
|
1853 |
+
* <?php
|
1854 |
+
* add_action( 'um_admin_do_action__', 'my_admin_do_action', 10, 1 );
|
1855 |
+
* function my_admin_do_action( $action ) {
|
1856 |
+
* // your code here
|
1857 |
+
* }
|
1858 |
+
* ?>
|
1859 |
+
*/
|
1860 |
+
do_action( 'um_admin_do_action__', $action );
|
1861 |
+
/**
|
1862 |
+
* UM hook
|
1863 |
+
*
|
1864 |
+
* @type action
|
1865 |
+
* @title um_admin_do_action__{$action}
|
1866 |
+
* @description Make some action on custom admin $action
|
1867 |
+
* @input_vars
|
1868 |
+
* [{"var":"$action","type":"string","desc":"Admin Action"}]
|
1869 |
+
* @change_log
|
1870 |
+
* ["Since: 2.0"]
|
1871 |
+
* @usage add_action( 'um_admin_do_action__{$action}', 'function_name', 10, 1 );
|
1872 |
+
* @example
|
1873 |
+
* <?php
|
1874 |
+
* add_action( 'um_admin_do_action__{$action}', 'my_admin_do_action', 10, 1 );
|
1875 |
+
* function my_admin_do_action( $action ) {
|
1876 |
+
* // your code here
|
1877 |
+
* }
|
1878 |
+
* ?>
|
1879 |
+
*/
|
1880 |
+
do_action( "um_admin_do_action__{$action}", $action );
|
1881 |
+
}
|
1882 |
+
}
|
1883 |
+
|
1884 |
+
|
1885 |
+
/**
|
1886 |
+
* Updated post messages
|
1887 |
+
*
|
1888 |
+
* @param array $messages
|
1889 |
+
*
|
1890 |
+
* @return array
|
1891 |
+
*/
|
1892 |
+
function post_updated_messages( $messages ) {
|
1893 |
+
global $post_ID;
|
1894 |
+
|
1895 |
+
$post_type = get_post_type( $post_ID );
|
1896 |
+
|
1897 |
+
if ( $post_type == 'um_form' ) {
|
1898 |
+
$messages['um_form'] = array(
|
1899 |
+
0 => '',
|
1900 |
+
1 => __( 'Form updated.', 'ultimate-member' ),
|
1901 |
+
2 => __( 'Custom field updated.', 'ultimate-member' ),
|
1902 |
+
3 => __( 'Custom field deleted.', 'ultimate-member' ),
|
1903 |
+
4 => __( 'Form updated.', 'ultimate-member' ),
|
1904 |
+
5 => isset( $_GET['revision'] ) ? __( 'Form restored to revision.', 'ultimate-member' ) : false,
|
1905 |
+
6 => __( 'Form created.', 'ultimate-member' ),
|
1906 |
+
7 => __( 'Form saved.', 'ultimate-member' ),
|
1907 |
+
8 => __( 'Form submitted.', 'ultimate-member' ),
|
1908 |
+
9 => __( 'Form scheduled.', 'ultimate-member' ),
|
1909 |
+
10 => __( 'Form draft updated.', 'ultimate-member' ),
|
1910 |
+
);
|
1911 |
+
}
|
1912 |
+
|
1913 |
+
return $messages;
|
1914 |
+
}
|
1915 |
+
|
1916 |
+
|
1917 |
+
/**
|
1918 |
+
* Gettext filters
|
1919 |
+
*
|
1920 |
+
* @param $translation
|
1921 |
+
* @param $text
|
1922 |
+
* @param $domain
|
1923 |
+
*
|
1924 |
+
* @return string
|
1925 |
+
*/
|
1926 |
+
function gettext( $translation, $text, $domain ) {
|
1927 |
+
global $post;
|
1928 |
+
if ( isset( $post->post_type ) && $this->is_plugin_post_type() ) {
|
1929 |
+
$translations = get_translations_for_domain( $domain );
|
1930 |
+
if ( $text == 'Publish' ) {
|
1931 |
+
return $translations->translate( 'Create' );
|
1932 |
+
} elseif ( $text == 'Move to Trash' ) {
|
1933 |
+
return $translations->translate( 'Delete' );
|
1934 |
+
}
|
1935 |
+
}
|
1936 |
+
|
1937 |
+
return $translation;
|
1938 |
+
}
|
1939 |
+
|
1940 |
+
|
1941 |
+
/**
|
1942 |
+
* Fix parent file for correct highlighting
|
1943 |
+
*
|
1944 |
+
* @param $parent_file
|
1945 |
+
*
|
1946 |
+
* @return string
|
1947 |
+
*/
|
1948 |
+
function parent_file( $parent_file ) {
|
1949 |
+
global $current_screen;
|
1950 |
+
$screen_id = $current_screen->id;
|
1951 |
+
if ( strstr( $screen_id, 'um_' ) ) {
|
1952 |
+
$parent_file = 'ultimatemember';
|
1953 |
+
}
|
1954 |
+
return $parent_file;
|
1955 |
+
}
|
1956 |
+
|
1957 |
+
|
1958 |
+
/**
|
1959 |
+
* @since 2.0
|
1960 |
+
*
|
1961 |
+
* @return core\Admin_Notices()
|
1962 |
+
*/
|
1963 |
+
function notices() {
|
1964 |
+
if ( empty( UM()->classes['admin_notices'] ) ) {
|
1965 |
+
UM()->classes['admin_notices'] = new core\Admin_Notices();
|
1966 |
+
}
|
1967 |
+
return UM()->classes['admin_notices'];
|
1968 |
+
}
|
1969 |
+
}
|
1970 |
+
}
|
includes/admin/core/class-admin-builder.php
CHANGED
@@ -1,1228 +1,1228 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_Builder
|
13 |
-
* @package um\admin\core
|
14 |
-
*/
|
15 |
-
class Admin_Builder {
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @var
|
20 |
-
*/
|
21 |
-
var $form_id;
|
22 |
-
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Admin_Builder constructor.
|
26 |
-
*/
|
27 |
-
function __construct() {
|
28 |
-
add_action( 'um_admin_field_modal_header', array( &$this, 'add_message_handlers' ) );
|
29 |
-
add_action( 'um_admin_field_modal_footer', array( &$this, 'add_conditional_support' ), 10, 4 );
|
30 |
-
add_filter( 'um_admin_builder_skip_field_validation', array( &$this, 'skip_field_validation' ), 10, 3 );
|
31 |
-
add_filter( 'um_admin_pre_save_field_to_form', array( &$this, 'um_admin_pre_save_field_to_form' ), 1 );
|
32 |
-
add_filter( 'um_admin_pre_save_fields_hook', array( &$this, 'um_admin_pre_save_fields_hook' ), 1 );
|
33 |
-
add_filter( 'um_admin_field_update_error_handling', array( &$this, 'um_admin_field_update_error_handling' ), 1, 2 );
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
/**
|
38 |
-
* Apply a filter to handle errors for field updating in backend
|
39 |
-
*
|
40 |
-
* @param $errors
|
41 |
-
* @param $array
|
42 |
-
*
|
43 |
-
* @return mixed
|
44 |
-
*/
|
45 |
-
function um_admin_field_update_error_handling( $errors, $array ) {
|
46 |
-
/**
|
47 |
-
* @var $field_type
|
48 |
-
*/
|
49 |
-
extract( $array );
|
50 |
-
|
51 |
-
$field_attr = UM()->builtin()->get_core_field_attrs( $field_type );
|
52 |
-
|
53 |
-
if ( isset( $field_attr['validate'] ) ) {
|
54 |
-
|
55 |
-
$validate = $field_attr['validate'];
|
56 |
-
foreach ( $validate as $post_input => $arr ) {
|
57 |
-
|
58 |
-
$skip = apply_filters( 'um_admin_builder_skip_field_validation', false, $post_input, $array );
|
59 |
-
if ( $skip ) {
|
60 |
-
continue;
|
61 |
-
}
|
62 |
-
|
63 |
-
$mode = $arr['mode'];
|
64 |
-
|
65 |
-
switch ( $mode ) {
|
66 |
-
|
67 |
-
case 'numeric':
|
68 |
-
if ( ! empty( $array['post'][ $post_input ] ) && ! is_numeric( $array['post'][ $post_input ] ) ){
|
69 |
-
$errors[ $post_input ] = $validate[ $post_input ]['error'];
|
70 |
-
}
|
71 |
-
break;
|
72 |
-
|
73 |
-
case 'unique':
|
74 |
-
if ( ! isset( $array['post']['edit_mode'] ) ) {
|
75 |
-
if ( UM()->builtin()->unique_field_err( $array['post'][ $post_input ] ) ) {
|
76 |
-
$errors[ $post_input ] = UM()->builtin()->unique_field_err( $array['post'][ $post_input ] );
|
77 |
-
}
|
78 |
-
}
|
79 |
-
break;
|
80 |
-
|
81 |
-
case 'required':
|
82 |
-
if ( $array['post'][ $post_input ] == '' ) {
|
83 |
-
$errors[ $post_input ] = $validate[ $post_input ]['error'];
|
84 |
-
}
|
85 |
-
break;
|
86 |
-
|
87 |
-
case 'range-start':
|
88 |
-
if ( UM()->builtin()->date_range_start_err( $array['post'][ $post_input ] ) && $array['post']['_range'] == 'date_range' ) {
|
89 |
-
$errors[ $post_input ] = UM()->builtin()->date_range_start_err( $array['post'][ $post_input ] );
|
90 |
-
}
|
91 |
-
break;
|
92 |
-
|
93 |
-
case 'range-end':
|
94 |
-
if ( UM()->builtin()->date_range_end_err( $array['post'][ $post_input ], $array['post']['_range_start'] ) && $array['post']['_range'] == 'date_range' ) {
|
95 |
-
$errors[ $post_input ] = UM()->builtin()->date_range_end_err( $array['post'][ $post_input ], $array['post']['_range_start'] );
|
96 |
-
}
|
97 |
-
break;
|
98 |
-
|
99 |
-
}
|
100 |
-
|
101 |
-
}
|
102 |
-
|
103 |
-
}
|
104 |
-
|
105 |
-
return $errors;
|
106 |
-
|
107 |
-
}
|
108 |
-
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Some fields may require extra fields before saving
|
112 |
-
*
|
113 |
-
* @param $array
|
114 |
-
*
|
115 |
-
* @return mixed
|
116 |
-
*/
|
117 |
-
function um_admin_pre_save_fields_hook( $array ) {
|
118 |
-
/**
|
119 |
-
* @var $form_id
|
120 |
-
* @var $field_type
|
121 |
-
*/
|
122 |
-
extract( $array );
|
123 |
-
|
124 |
-
$fields_without_metakey = UM()->builtin()->get_fields_without_metakey();
|
125 |
-
|
126 |
-
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
127 |
-
$count = 1;
|
128 |
-
if ( ! empty( $fields ) ) {
|
129 |
-
$count = count( $fields ) + 1;
|
130 |
-
}
|
131 |
-
|
132 |
-
// set unique meta key
|
133 |
-
if ( in_array( $field_type, $fields_without_metakey ) && ! isset( $array['post']['_metakey'] ) ) {
|
134 |
-
$array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
|
135 |
-
}
|
136 |
-
|
137 |
-
// set position
|
138 |
-
if ( ! isset( $array['post']['_position'] ) ) {
|
139 |
-
$array['post']['_position'] = $count;
|
140 |
-
}
|
141 |
-
|
142 |
-
return $array;
|
143 |
-
}
|
144 |
-
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Modify field args just before it is saved into form
|
148 |
-
*
|
149 |
-
* @param $array
|
150 |
-
*
|
151 |
-
* @return mixed
|
152 |
-
*/
|
153 |
-
function um_admin_pre_save_field_to_form( $array ){
|
154 |
-
unset( $array['conditions'] );
|
155 |
-
if ( isset($array['conditional_field']) && ! empty( $array['conditional_action'] ) && ! empty( $array['conditional_operator'] ) ) {
|
156 |
-
$array['conditional_value'] = isset( $array['conditional_value'] ) ? $array['conditional_value'] : '';
|
157 |
-
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
|
158 |
-
}
|
159 |
-
|
160 |
-
if ( isset( $array['conditional_field1'] ) && ! empty( $array['conditional_action1'] ) && ! empty( $array['conditional_operator1'] ) ) {
|
161 |
-
$array['conditional_value1'] = isset( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
|
162 |
-
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
|
163 |
-
}
|
164 |
-
|
165 |
-
if ( isset( $array['conditional_field2'] ) && ! empty( $array['conditional_action2'] ) && ! empty( $array['conditional_operator2'] ) ) {
|
166 |
-
$array['conditional_value2'] = isset( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
|
167 |
-
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
|
168 |
-
}
|
169 |
-
|
170 |
-
if ( isset( $array['conditional_field3'] ) && ! empty( $array['conditional_action3'] ) && ! empty( $array['conditional_operator3'] ) ) {
|
171 |
-
$array['conditional_value3'] = isset( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
|
172 |
-
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
|
173 |
-
}
|
174 |
-
|
175 |
-
if ( isset( $array['conditional_field4'] ) && ! empty( $array['conditional_action4'] ) && ! empty( $array['conditional_operator4'] ) ) {
|
176 |
-
$array['conditional_value4'] = isset( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
|
177 |
-
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
|
178 |
-
}
|
179 |
-
|
180 |
-
return $array;
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Put status handler in modal
|
186 |
-
*/
|
187 |
-
function add_message_handlers() {
|
188 |
-
?>
|
189 |
-
<div class="um-admin-error-block"></div>
|
190 |
-
<div class="um-admin-success-block"></div>
|
191 |
-
<?php
|
192 |
-
}
|
193 |
-
|
194 |
-
|
195 |
-
/**
|
196 |
-
* Footer of modal
|
197 |
-
*
|
198 |
-
* @param $form_id
|
199 |
-
* @param $field_args
|
200 |
-
* @param $in_edit
|
201 |
-
* @param $edit_array
|
202 |
-
*/
|
203 |
-
function add_conditional_support( $form_id, $field_args, $in_edit, $edit_array ) {
|
204 |
-
$metabox = UM()->metabox();
|
205 |
-
|
206 |
-
if ( isset( $field_args['conditional_support'] ) && $field_args['conditional_support'] == 0 ) {
|
207 |
-
return;
|
208 |
-
} ?>
|
209 |
-
|
210 |
-
<div class="um-admin-btn-toggle">
|
211 |
-
|
212 |
-
<?php if ( $in_edit ) { $metabox->in_edit = true; $metabox->edit_array = $edit_array; ?>
|
213 |
-
<a href="javascript:void(0);"><i class="um-icon-plus"></i><?php _e( 'Manage conditional fields support' ); ?></a> <?php UM()->tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
|
214 |
-
<?php } else { ?>
|
215 |
-
<a href="javascript:void(0);"><i class="um-icon-plus"></i><?php _e( 'Add conditional fields support' ); ?></a> <?php UM()->tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
|
216 |
-
<?php } ?>
|
217 |
-
|
218 |
-
<div class="um-admin-btn-content">
|
219 |
-
<div class="um-admin-cur-condition-template">
|
220 |
-
|
221 |
-
<?php $metabox->field_input( '_conditional_action', $form_id ); ?>
|
222 |
-
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
223 |
-
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
224 |
-
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
225 |
-
|
226 |
-
<p><a href="javascript:void(0);" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
227 |
-
|
228 |
-
<div class="um-admin-clear"></div>
|
229 |
-
</div>
|
230 |
-
<p class="um-admin-conditions-notice">
|
231 |
-
<small>
|
232 |
-
<?php _e( 'Use the condition operator `equals to` or `not equals` if the parent field has a single option.', 'ultimate-member' ); ?>
|
233 |
-
<br><?php _e( 'Use the condition operator `greater than` or `less than` if the parent field is a number.', 'ultimate-member' ); ?>
|
234 |
-
<br><?php _e( 'Use the condition operator `contains` if the parent field has multiple options.', 'ultimate-member' ); ?>
|
235 |
-
</small>
|
236 |
-
</p>
|
237 |
-
<p><a href="javascript:void(0);" class="um-admin-new-condition button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a></p>
|
238 |
-
<p class="um-admin-reset-conditions"><a href="javascript:void(0);" class="button"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
|
239 |
-
|
240 |
-
<div class="um-admin-clear"></div>
|
241 |
-
|
242 |
-
<?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
|
243 |
-
|
244 |
-
foreach ( $edit_array['conditions'] as $k => $arr ) {
|
245 |
-
|
246 |
-
if ( $k == 0 ) $k = ''; ?>
|
247 |
-
|
248 |
-
<div class="um-admin-cur-condition">
|
249 |
-
|
250 |
-
<?php $metabox->field_input( '_conditional_action' . $k, $form_id ); ?>
|
251 |
-
<?php $metabox->field_input( '_conditional_field' . $k , $form_id ); ?>
|
252 |
-
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
|
253 |
-
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
|
254 |
-
|
255 |
-
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
256 |
-
|
257 |
-
<div class="um-admin-clear"></div>
|
258 |
-
</div>
|
259 |
-
|
260 |
-
<?php
|
261 |
-
}
|
262 |
-
|
263 |
-
} else { ?>
|
264 |
-
|
265 |
-
<div class="um-admin-cur-condition">
|
266 |
-
|
267 |
-
<?php $metabox->field_input( '_conditional_action', $form_id ); ?>
|
268 |
-
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
269 |
-
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
270 |
-
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
271 |
-
|
272 |
-
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
273 |
-
|
274 |
-
<div class="um-admin-clear"></div>
|
275 |
-
</div>
|
276 |
-
|
277 |
-
<?php } ?>
|
278 |
-
</div>
|
279 |
-
</div>
|
280 |
-
|
281 |
-
<?php
|
282 |
-
}
|
283 |
-
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Update the builder area
|
287 |
-
*/
|
288 |
-
function update_builder() {
|
289 |
-
UM()->admin()->check_ajax_nonce();
|
290 |
-
|
291 |
-
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
292 |
-
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
293 |
-
}
|
294 |
-
|
295 |
-
ob_start();
|
296 |
-
|
297 |
-
$this->form_id = absint( $_POST['form_id'] );
|
298 |
-
|
299 |
-
$this->show_builder();
|
300 |
-
|
301 |
-
$output = ob_get_clean();
|
302 |
-
|
303 |
-
if ( is_array( $output ) ) {
|
304 |
-
print_r( $output );
|
305 |
-
} else {
|
306 |
-
echo $output;
|
307 |
-
}
|
308 |
-
die;
|
309 |
-
}
|
310 |
-
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Sort array function
|
314 |
-
*
|
315 |
-
* @param array $arr
|
316 |
-
* @param string $col
|
317 |
-
* @param int $dir
|
318 |
-
*
|
319 |
-
* @return array
|
320 |
-
*/
|
321 |
-
function array_sort_by_column( $arr, $col, $dir = SORT_ASC ) {
|
322 |
-
$sort_col = array();
|
323 |
-
|
324 |
-
foreach ( $arr as $key => $row ) {
|
325 |
-
if ( ! empty( $row[ $col ] ) ) {
|
326 |
-
$sort_col[ $key ] = $row[ $col ];
|
327 |
-
}
|
328 |
-
}
|
329 |
-
|
330 |
-
if ( ! empty( $sort_col ) ) {
|
331 |
-
array_multisort( $sort_col, $dir, $arr );
|
332 |
-
}
|
333 |
-
|
334 |
-
return $arr;
|
335 |
-
}
|
336 |
-
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Get fields in row
|
340 |
-
*
|
341 |
-
* @param $row_id
|
342 |
-
*
|
343 |
-
* @return string
|
344 |
-
*/
|
345 |
-
function get_fields_by_row( $row_id ) {
|
346 |
-
|
347 |
-
if ( empty( $this->global_fields ) || ! is_array( $this->global_fields ) ) {
|
348 |
-
$this->global_fields = array();
|
349 |
-
}
|
350 |
-
|
351 |
-
foreach ( $this->global_fields as $key => $array ) {
|
352 |
-
if ( ! isset( $array['in_row'] ) || ( isset( $array['in_row'] ) && $array['in_row'] == $row_id ) ) {
|
353 |
-
$results[ $key ] = $array;
|
354 |
-
unset( $this->global_fields[ $key ] );
|
355 |
-
}
|
356 |
-
}
|
357 |
-
|
358 |
-
return ( isset ( $results ) ) ? $results : '';
|
359 |
-
}
|
360 |
-
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Get fields by sub row
|
364 |
-
*
|
365 |
-
* @param $row_fields
|
366 |
-
* @param $subrow_id
|
367 |
-
*
|
368 |
-
* @return string
|
369 |
-
*/
|
370 |
-
function get_fields_in_subrow( $row_fields, $subrow_id ) {
|
371 |
-
if ( ! is_array( $row_fields ) ) {
|
372 |
-
return '';
|
373 |
-
}
|
374 |
-
|
375 |
-
foreach( $row_fields as $key => $array ) {
|
376 |
-
if ( ! isset( $array['in_sub_row'] ) || ( isset( $array['in_sub_row'] ) && $array['in_sub_row'] == $subrow_id ) ) {
|
377 |
-
$results[ $key ] = $array;
|
378 |
-
unset( $this->global_fields[ $key ] );
|
379 |
-
}
|
380 |
-
}
|
381 |
-
|
382 |
-
return ( isset ( $results ) ) ? $results : '';
|
383 |
-
}
|
384 |
-
|
385 |
-
|
386 |
-
/**
|
387 |
-
* Display the builder
|
388 |
-
*/
|
389 |
-
function show_builder() {
|
390 |
-
|
391 |
-
$fields = UM()->query()->get_attr( 'custom_fields', $this->form_id );
|
392 |
-
|
393 |
-
if ( !isset( $fields ) || empty( $fields ) ) { ?>
|
394 |
-
|
395 |
-
<div class="um-admin-drag-row">
|
396 |
-
|
397 |
-
<!-- Master Row Actions -->
|
398 |
-
<div class="um-admin-drag-row-icons">
|
399 |
-
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
400 |
-
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="_um_row_1"><i class="um-faicon-pencil"></i></a>
|
401 |
-
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
402 |
-
</div>
|
403 |
-
<div class="um-admin-clear"></div>
|
404 |
-
|
405 |
-
<div class="um-admin-drag-rowsubs">
|
406 |
-
<div class="um-admin-drag-rowsub">
|
407 |
-
|
408 |
-
<!-- Column Layout -->
|
409 |
-
<div class="um-admin-drag-ctrls columns">
|
410 |
-
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
411 |
-
<a href="javascript:void(0);" data-cols="2"></a>
|
412 |
-
<a href="javascript:void(0);" data-cols="3"></a>
|
413 |
-
</div>
|
414 |
-
|
415 |
-
<!-- Sub Row Actions -->
|
416 |
-
<div class="um-admin-drag-rowsub-icons">
|
417 |
-
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
418 |
-
</div><div class="um-admin-clear"></div>
|
419 |
-
|
420 |
-
<!-- Columns -->
|
421 |
-
<div class="um-admin-drag-col">
|
422 |
-
|
423 |
-
</div>
|
424 |
-
|
425 |
-
<div class="um-admin-drag-col-dynamic"></div>
|
426 |
-
|
427 |
-
<div class="um-admin-clear"></div>
|
428 |
-
|
429 |
-
</div>
|
430 |
-
</div>
|
431 |
-
|
432 |
-
</div>
|
433 |
-
|
434 |
-
<?php
|
435 |
-
|
436 |
-
} else {
|
437 |
-
|
438 |
-
if ( empty( $fields ) || ! is_array( $fields ) ) {
|
439 |
-
$this->global_fields = array();
|
440 |
-
} else {
|
441 |
-
$this->global_fields = $fields;
|
442 |
-
}
|
443 |
-
|
444 |
-
foreach ( $this->global_fields as $key => $array ) {
|
445 |
-
if ( $array['type'] == 'row' ) {
|
446 |
-
$rows[ $key ] = $array;
|
447 |
-
unset( $this->global_fields[ $key ] ); // not needed now
|
448 |
-
}
|
449 |
-
|
450 |
-
}
|
451 |
-
|
452 |
-
if ( ! isset( $rows ) ) {
|
453 |
-
$rows = array(
|
454 |
-
'_um_row_1' => array(
|
455 |
-
'type' => 'row',
|
456 |
-
'id' => '_um_row_1',
|
457 |
-
'sub_rows' => 1,
|
458 |
-
'cols' => 1
|
459 |
-
),
|
460 |
-
);
|
461 |
-
}
|
462 |
-
|
463 |
-
foreach ( $rows as $row_id => $array ) { ?>
|
464 |
-
|
465 |
-
<div class="um-admin-drag-row" data-original="<?php echo esc_attr( $row_id ); ?>">
|
466 |
-
|
467 |
-
<!-- Master Row Actions -->
|
468 |
-
<div class="um-admin-drag-row-icons">
|
469 |
-
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
470 |
-
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member'); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="<?php echo esc_attr( $row_id ); ?>"><i class="um-faicon-pencil"></i></a>
|
471 |
-
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
472 |
-
<?php if ( $row_id != '_um_row_1' ) {?>
|
473 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
|
474 |
-
<?php } ?>
|
475 |
-
</div><div class="um-admin-clear"></div>
|
476 |
-
|
477 |
-
<div class="um-admin-drag-rowsubs">
|
478 |
-
|
479 |
-
<?php $row_fields = $this->get_fields_by_row( $row_id );
|
480 |
-
|
481 |
-
$sub_rows = ( isset( $array['sub_rows'] ) ) ? $array['sub_rows'] : 1;
|
482 |
-
for ( $c = 0; $c < $sub_rows; $c++ ) {
|
483 |
-
|
484 |
-
$subrow_fields = $this->get_fields_in_subrow( $row_fields, $c );
|
485 |
-
|
486 |
-
?>
|
487 |
-
|
488 |
-
<div class="um-admin-drag-rowsub">
|
489 |
-
|
490 |
-
<!-- Column Layout -->
|
491 |
-
<div class="um-admin-drag-ctrls columns">
|
492 |
-
|
493 |
-
<?php
|
494 |
-
|
495 |
-
if ( !isset( $array['cols'] ) ){
|
496 |
-
$col_num = 1;
|
497 |
-
}
|
498 |
-
|
499 |
-
|
500 |
-
$
|
501 |
-
|
502 |
-
}
|
503 |
-
|
504 |
-
for ( $i = 1; $i <= 3; $i++ ) {
|
505 |
-
echo '<a href="javascript:void(0);" data-cols="'.$i.'" ';
|
506 |
-
if ( $col_num == $i ) echo 'class="active"';
|
507 |
-
echo '></a>';
|
508 |
-
}
|
509 |
-
|
510 |
-
?>
|
511 |
-
|
512 |
-
</div>
|
513 |
-
|
514 |
-
<!-- Sub Row Actions -->
|
515 |
-
<div class="um-admin-drag-rowsub-icons">
|
516 |
-
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
517 |
-
<?php if ( $c > 0 ) { ?><a href="javascript:void(0);" class="um-admin-tipsy-n" title="Delete Row" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a><?php } ?>
|
518 |
-
</div>
|
519 |
-
<div class="um-admin-clear"></div>
|
520 |
-
|
521 |
-
<!-- Columns -->
|
522 |
-
<div class="um-admin-drag-col">
|
523 |
-
|
524 |
-
<?php
|
525 |
-
|
526 |
-
if ( is_array( $subrow_fields ) ) {
|
527 |
-
|
528 |
-
$subrow_fields = $this->array_sort_by_column( $subrow_fields, 'position');
|
529 |
-
|
530 |
-
foreach( $subrow_fields as $key => $keyarray ) {
|
531 |
-
/**
|
532 |
-
* @var $type
|
533 |
-
* @var $title
|
534 |
-
*/
|
535 |
-
extract( $keyarray );
|
536 |
-
|
537 |
-
?>
|
538 |
-
|
539 |
-
<div class="um-admin-drag-fld um-admin-delete-area um-field-type-<?php echo $type; ?> <?php echo $key; ?>" data-group="<?php echo (isset($keyarray['in_group'])) ? $keyarray['in_group'] : ''; ?>" data-key="<?php echo $key; ?>" data-column="<?php echo ( isset($keyarray['in_column']) ) ? $keyarray['in_column'] : 1; ?>">
|
540 |
-
|
541 |
-
<div class="um-admin-drag-fld-title um-field-type-<?php echo $type; ?>">
|
542 |
-
<?php if ( $type == 'group' ) { ?>
|
543 |
-
<i class="um-icon-plus"></i>
|
544 |
-
<?php } else if ( isset($keyarray['icon']) && !empty( $keyarray['icon'] ) ) { ?>
|
545 |
-
<i class="<?php echo $keyarray['icon']; ?>"></i>
|
546 |
-
<?php } ?><?php echo ! empty( $keyarray['title'] ) ? $keyarray['title'] : __( '(no title)', 'ultimate-member' ); ?></div>
|
547 |
-
<?php $field_name = isset( UM()->builtin()->core_fields[$type]['name'] ) ? UM()->builtin()->core_fields[$type]['name'] : ''; ?>
|
548 |
-
<div class="um-admin-drag-fld-type um-field-type-<?php echo $type; ?>"><?php echo $field_name; ?></div>
|
549 |
-
<div class="um-admin-drag-fld-icons um-field-type-<?php echo $type; ?>">
|
550 |
-
|
551 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit', 'ultimate-member' ) ?>" data-modal="UM_edit_field" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="<?php echo $type; ?>" data-arg2="<?php echo $this->form_id; ?>" data-arg3="<?php echo $key; ?>"><i class="um-faicon-pencil"></i></a>
|
552 |
-
|
553 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n um_admin_duplicate_field" title="<?php esc_attr_e( 'Duplicate', 'ultimate-member' ) ?>" data-silent_action="um_admin_duplicate_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-files-o"></i></a>
|
554 |
-
|
555 |
-
<?php if ( $type == 'group' ) { ?>
|
556 |
-
|
557 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Group', 'ultimate-member' ) ?>" data-remove_element="um-admin-drag-fld.um-field-type-group" data-silent_action="um_admin_remove_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-trash-o"></i></a>
|
558 |
-
<?php } else { ?>
|
559 |
-
|
560 |
-
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete', 'ultimate-member' ) ?>" data-silent_action="um_admin_remove_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-trash-o"></i></a>
|
561 |
-
|
562 |
-
<?php } ?>
|
563 |
-
|
564 |
-
</div><div class="um-admin-clear"></div>
|
565 |
-
|
566 |
-
<?php if ( $type == 'group' ) { ?>
|
567 |
-
<div class="um-admin-drag-group">
|
568 |
-
|
569 |
-
</div>
|
570 |
-
<?php } ?>
|
571 |
-
|
572 |
-
</div>
|
573 |
-
|
574 |
-
<?php
|
575 |
-
|
576 |
-
} // end foreach
|
577 |
-
|
578 |
-
} // end if
|
579 |
-
|
580 |
-
?>
|
581 |
-
|
582 |
-
</div>
|
583 |
-
|
584 |
-
<div class="um-admin-drag-col-dynamic"></div>
|
585 |
-
|
586 |
-
<div class="um-admin-clear"></div>
|
587 |
-
|
588 |
-
</div>
|
589 |
-
|
590 |
-
<?php } ?>
|
591 |
-
|
592 |
-
</div>
|
593 |
-
|
594 |
-
</div>
|
595 |
-
|
596 |
-
<?php
|
597 |
-
|
598 |
-
} // rows loop
|
599 |
-
|
600 |
-
} // if fields exist
|
601 |
-
|
602 |
-
}
|
603 |
-
|
604 |
-
|
605 |
-
/**
|
606 |
-
*
|
607 |
-
*/
|
608 |
-
function update_field() {
|
609 |
-
UM()->admin()->check_ajax_nonce();
|
610 |
-
|
611 |
-
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
612 |
-
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
613 |
-
}
|
614 |
-
|
615 |
-
$output['error'] = null;
|
616 |
-
|
617 |
-
$array = array(
|
618 |
-
'field_type' => sanitize_key( $_POST['_type'] ),
|
619 |
-
'form_id' => absint( $_POST['post_id'] ),
|
620 |
-
'args' => UM()->builtin()->get_core_field_attrs( sanitize_key( $_POST['_type'] ) ),
|
621 |
-
'post' => UM()->admin()->sanitize_builder_field_meta( $_POST ),
|
622 |
-
);
|
623 |
-
|
624 |
-
/**
|
625 |
-
* UM hook
|
626 |
-
*
|
627 |
-
* @type filter
|
628 |
-
* @title um_admin_pre_save_fields_hook
|
629 |
-
* @description Filter field data before save
|
630 |
-
* @input_vars
|
631 |
-
* [{"var":"$array","type":"array","desc":"Save Field data"}]
|
632 |
-
* @change_log
|
633 |
-
* ["Since: 2.0"]
|
634 |
-
* @usage add_filter( 'um_admin_pre_save_fields_hook', 'function_name', 10, 1 );
|
635 |
-
* @example
|
636 |
-
* <?php
|
637 |
-
* add_filter( 'um_admin_pre_save_fields_hook', 'my_admin_pre_save_fields', 10, 1 );
|
638 |
-
* function my_admin_pre_save_fields( $array ) {
|
639 |
-
* // your code here
|
640 |
-
* return $array;
|
641 |
-
* }
|
642 |
-
* ?>
|
643 |
-
*/
|
644 |
-
$array = apply_filters( 'um_admin_pre_save_fields_hook', $array );
|
645 |
-
|
646 |
-
/**
|
647 |
-
* UM hook
|
648 |
-
*
|
649 |
-
* @type filter
|
650 |
-
* @title um_admin_field_update_error_handling
|
651 |
-
* @description Change error string on save field
|
652 |
-
* @input_vars
|
653 |
-
* [{"var":"$error","type":"string","desc":"Error String"},
|
654 |
-
* {"var":"$array","type":"array","desc":"Save Field data"}]
|
655 |
-
* @change_log
|
656 |
-
* ["Since: 2.0"]
|
657 |
-
* @usage add_filter( 'um_admin_field_update_error_handling', 'function_name', 10, 2 );
|
658 |
-
* @example
|
659 |
-
* <?php
|
660 |
-
* add_filter( 'um_admin_field_update_error_handling', 'my_admin_field_update_error', 10, 2 );
|
661 |
-
* function my_admin_field_update_error( $error, $array ) {
|
662 |
-
* // your code here
|
663 |
-
* return $error;
|
664 |
-
* }
|
665 |
-
* ?>
|
666 |
-
*/
|
667 |
-
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
|
668 |
-
|
669 |
-
/**
|
670 |
-
* @var $_metakey
|
671 |
-
* @var $post_id
|
672 |
-
*/
|
673 |
-
extract( $array['post'] );
|
674 |
-
|
675 |
-
if ( empty( $output['error'] ) ) {
|
676 |
-
|
677 |
-
$save = array();
|
678 |
-
$save[ $_metakey ] = null;
|
679 |
-
foreach ( $array['post'] as $key => $val ) {
|
680 |
-
|
681 |
-
if ( substr( $key, 0, 1 ) === '_' && $val !== '' ) { // field attribute
|
682 |
-
$new_key = ltrim ( $key, '_' );
|
683 |
-
|
684 |
-
if ( $new_key == 'options' ) {
|
685 |
-
//$save[ $_metakey ][$new_key] = explode(PHP_EOL, $val);
|
686 |
-
$save[ $_metakey ][ $new_key ] = preg_split( '/[\r\n]+/', $val, -1, PREG_SPLIT_NO_EMPTY );
|
687 |
-
} else {
|
688 |
-
$save[ $_metakey ][ $new_key ] = $val;
|
689 |
-
}
|
690 |
-
|
691 |
-
} elseif ( strstr( $key, 'um_editor' ) ) {
|
692 |
-
|
693 |
-
if ( 'block' === $array['post']['_type'] ) {
|
694 |
-
$save[ $_metakey ]['content'] = wp_kses_post( $val );
|
695 |
-
} else {
|
696 |
-
$save[ $_metakey ]['content'] = sanitize_textarea_field( $val );
|
697 |
-
}
|
698 |
-
}
|
699 |
-
|
700 |
-
}
|
701 |
-
|
702 |
-
$field_ID = $_metakey;
|
703 |
-
$field_args = $save[ $_metakey ];
|
704 |
-
|
705 |
-
/**
|
706 |
-
* UM hook
|
707 |
-
*
|
708 |
-
* @type filter
|
709 |
-
* @title um_admin_pre_save_field_to_form
|
710 |
-
* @description Change field options before save to form
|
711 |
-
* @input_vars
|
712 |
-
* [{"var":"$field_args","type":"array","desc":"Field Options"}]
|
713 |
-
* @change_log
|
714 |
-
* ["Since: 2.0"]
|
715 |
-
* @usage add_filter( 'um_admin_pre_save_field_to_form', 'function_name', 10, 1 );
|
716 |
-
* @example
|
717 |
-
* <?php
|
718 |
-
* add_filter( 'um_admin_pre_save_field_to_form', 'my_admin_pre_save_field_to_form', 10, 1 );
|
719 |
-
* function my_admin_pre_save_field_to_form( $field_args ) {
|
720 |
-
* // your code here
|
721 |
-
* return $field_args;
|
722 |
-
* }
|
723 |
-
* ?>
|
724 |
-
*/
|
725 |
-
$field_args = apply_filters( 'um_admin_pre_save_field_to_form', $field_args );
|
726 |
-
|
727 |
-
UM()->fields()->update_field( $field_ID, $field_args, $post_id );
|
728 |
-
|
729 |
-
/**
|
730 |
-
* UM hook
|
731 |
-
*
|
732 |
-
* @type filter
|
733 |
-
* @title um_admin_pre_save_field_to_db
|
734 |
-
* @description Change field options before save to DB
|
735 |
-
* @input_vars
|
736 |
-
* [{"var":"$field_args","type":"array","desc":"Field Options"}]
|
737 |
-
* @change_log
|
738 |
-
* ["Since: 2.0"]
|
739 |
-
* @usage add_filter( 'um_admin_pre_save_field_to_db', 'function_name', 10, 1 );
|
740 |
-
* @example
|
741 |
-
* <?php
|
742 |
-
* add_filter( 'um_admin_pre_save_field_to_db', 'my_admin_pre_save_field_to_db', 10, 1 );
|
743 |
-
* function my_admin_pre_save_field_to_form( $field_args ) {
|
744 |
-
* // your code here
|
745 |
-
* return $field_args;
|
746 |
-
* }
|
747 |
-
* ?>
|
748 |
-
*/
|
749 |
-
$field_args = apply_filters( 'um_admin_pre_save_field_to_db', $field_args );
|
750 |
-
|
751 |
-
if ( ! isset( $array['args']['form_only'] ) ) {
|
752 |
-
if ( ! isset( UM()->builtin()->predefined_fields[ $field_ID ] ) ) {
|
753 |
-
UM()->fields()->globally_update_field( $field_ID, $field_args );
|
754 |
-
}
|
755 |
-
}
|
756 |
-
|
757 |
-
}
|
758 |
-
|
759 |
-
$output = json_encode( $output );
|
760 |
-
if ( is_array( $output ) ) {
|
761 |
-
print_r( $output );
|
762 |
-
} else {
|
763 |
-
echo $output;
|
764 |
-
}
|
765 |
-
die;
|
766 |
-
}
|
767 |
-
|
768 |
-
|
769 |
-
/**
|
770 |
-
*
|
771 |
-
*/
|
772 |
-
function dynamic_modal_content() {
|
773 |
-
UM()->admin()->check_ajax_nonce();
|
774 |
-
|
775 |
-
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
776 |
-
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
777 |
-
}
|
778 |
-
|
779 |
-
$metabox = UM()->metabox();
|
780 |
-
|
781 |
-
/**
|
782 |
-
* @var $act_id
|
783 |
-
* @var $arg1
|
784 |
-
* @var $arg2
|
785 |
-
* @var $arg3
|
786 |
-
*/
|
787 |
-
extract( $_POST );
|
788 |
-
|
789 |
-
if ( isset( $arg1 ) ) {
|
790 |
-
$arg1 = sanitize_text_field( $arg1 );
|
791 |
-
}
|
792 |
-
|
793 |
-
if ( isset( $arg2 ) ) {
|
794 |
-
$arg2 = sanitize_text_field( $arg2 );
|
795 |
-
}
|
796 |
-
|
797 |
-
if ( isset( $arg3 ) ) {
|
798 |
-
$arg3 = sanitize_text_field( $arg3 );
|
799 |
-
}
|
800 |
-
|
801 |
-
switch ( sanitize_key( $act_id ) ) {
|
802 |
-
|
803 |
-
default:
|
804 |
-
|
805 |
-
ob_start();
|
806 |
-
|
807 |
-
/**
|
808 |
-
* UM hook
|
809 |
-
*
|
810 |
-
* @type action
|
811 |
-
* @title um_admin_ajax_modal_content__hook
|
812 |
-
* @description Integration hook on ajax popup admin builder modal content
|
813 |
-
* @input_vars
|
814 |
-
* [{"var":"$act_id","type":"string","desc":"Ajax Action"}]
|
815 |
-
* @change_log
|
816 |
-
* ["Since: 2.0"]
|
817 |
-
* @usage add_action( 'um_admin_ajax_modal_content__hook', 'function_name', 10, 1 );
|
818 |
-
* @example
|
819 |
-
* <?php
|
820 |
-
* add_action( 'um_admin_ajax_modal_content__hook', 'my_admin_custom_hook', 10, 1 );
|
821 |
-
* function um_admin_ajax_modal_content__hook( $act_id ) {
|
822 |
-
* // your code here
|
823 |
-
* }
|
824 |
-
* ?>
|
825 |
-
*/
|
826 |
-
do_action( 'um_admin_ajax_modal_content__hook', sanitize_key( $act_id ) );
|
827 |
-
/**
|
828 |
-
* UM hook
|
829 |
-
*
|
830 |
-
* @type action
|
831 |
-
* @title um_admin_ajax_modal_content__hook_{$act_id}
|
832 |
-
* @description Integration hook on ajax popup admin builder modal content
|
833 |
-
* @change_log
|
834 |
-
* ["Since: 2.0"]
|
835 |
-
* @usage add_action( 'um_admin_ajax_modal_content__hook_{$act_id}', 'function_name', 10 );
|
836 |
-
* @example
|
837 |
-
* <?php
|
838 |
-
* add_action( 'um_admin_ajax_modal_content__hook_{$act_id}', 'my_admin_ajax_modal_content', 10 );
|
839 |
-
* function my_admin_ajax_modal_content() {
|
840 |
-
* // your code here
|
841 |
-
* }
|
842 |
-
* ?>
|
843 |
-
*/
|
844 |
-
do_action( "um_admin_ajax_modal_content__hook_" . sanitize_key( $act_id ) );
|
845 |
-
|
846 |
-
$output = ob_get_clean();
|
847 |
-
break;
|
848 |
-
|
849 |
-
case 'um_admin_fonticon_selector':
|
850 |
-
|
851 |
-
ob_start(); ?>
|
852 |
-
|
853 |
-
<div class="um-admin-metabox">
|
854 |
-
<p class="_icon_search"><input type="text" name="_icon_search" id="_icon_search" value="" placeholder="<?php esc_attr_e('Search Icons...', 'ultimate-member' ); ?>" /></p>
|
855 |
-
</div>
|
856 |
-
|
857 |
-
<div class="um-admin-icons">
|
858 |
-
<?php foreach( UM()->fonticons()->all as $icon ) { ?>
|
859 |
-
<span data-code="<?php echo esc_attr( $icon ); ?>" title="<?php echo esc_attr( $icon ); ?>" class="um-admin-tipsy-n"><i class="<?php echo $icon; ?>"></i></span>
|
860 |
-
<?php } ?>
|
861 |
-
</div><div class="um-admin-clear"></div>
|
862 |
-
|
863 |
-
<?php $output = ob_get_clean();
|
864 |
-
break;
|
865 |
-
|
866 |
-
case 'um_admin_show_fields':
|
867 |
-
|
868 |
-
ob_start();
|
869 |
-
$form_fields = UM()->query()->get_attr( 'custom_fields', $arg2 );
|
870 |
-
$form_fields = array_values( array_filter( array_keys( $form_fields ) ) );
|
871 |
-
//$form_fields = array_keys( $form_fields );
|
872 |
-
?>
|
873 |
-
|
874 |
-
<h4><?php _e('Setup New Field','ultimate-member'); ?></h4>
|
875 |
-
<div class="um-admin-btns">
|
876 |
-
|
877 |
-
<?php if ( UM()->builtin()->core_fields ) {
|
878 |
-
foreach ( UM()->builtin()->core_fields as $field_type => $array ) {
|
879 |
-
|
880 |
-
if ( isset( $array['in_fields'] ) && $array['in_fields'] == false ) {
|
881 |
-
continue;
|
882 |
-
} ?>
|
883 |
-
|
884 |
-
<a href="javascript:void(0);" class="button" data-modal="UM_add_field" data-modal-size="normal" data-dynamic-content="um_admin_new_field_popup" data-arg1="<?php echo esc_attr( $field_type ); ?>" data-arg2="<?php echo esc_attr( $arg2 ) ?>"><?php echo esc_html( $array['name'] ); ?></a>
|
885 |
-
|
886 |
-
<?php }
|
887 |
-
} ?>
|
888 |
-
|
889 |
-
</div>
|
890 |
-
|
891 |
-
<h4><?php _e('Predefined Fields','ultimate-member'); ?></h4>
|
892 |
-
<div class="um-admin-btns">
|
893 |
-
|
894 |
-
<?php if ( UM()->builtin()->predefined_fields ) {
|
895 |
-
foreach ( UM()->builtin()->predefined_fields as $field_key => $array ) {
|
896 |
-
if ( ! isset( $array['account_only'] ) && ! isset( $array['private_use'] ) ) { ?>
|
897 |
-
|
898 |
-
<a href="javascript:void(0);" class="button" <?php disabled( in_array( $field_key, $form_fields, true ) ) ?> data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo esc_attr( $field_key ); ?>" data-arg2="<?php echo esc_attr( $arg2 ); ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?></a>
|
899 |
-
|
900 |
-
<?php }
|
901 |
-
}
|
902 |
-
} else {
|
903 |
-
echo '<p>' . __( 'None', 'ultimate-member' ) . '</p>';
|
904 |
-
} ?>
|
905 |
-
|
906 |
-
</div>
|
907 |
-
|
908 |
-
<h4><?php _e( 'Custom Fields', 'ultimate-member' ); ?></h4>
|
909 |
-
<div class="um-admin-btns">
|
910 |
-
|
911 |
-
<?php
|
912 |
-
if ( UM()->builtin()->custom_fields ) {
|
913 |
-
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
|
914 |
-
if ( empty( $array['title'] ) || empty( $array['type'] ) ) {
|
915 |
-
continue;
|
916 |
-
} ?>
|
917 |
-
|
918 |
-
<a href="javascript:void(0);" class="button with-icon" <?php disabled( in_array( $field_key, $form_fields, true ) ) ?> data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo esc_attr( $field_key ); ?>" data-arg2="<?php echo esc_attr( $arg2 ); ?>" title="<?php echo __( 'Meta Key', 'ultimate-member' ) . ' - ' . esc_attr( $field_key ); ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?> <small>(<?php echo ucfirst( $array['type'] ); ?>)</small><span class="remove"></span></a>
|
919 |
-
|
920 |
-
<?php }
|
921 |
-
} else {
|
922 |
-
echo '<p>' . __( 'You did not create any custom fields', 'ultimate-member' ) . '</p>';
|
923 |
-
} ?>
|
924 |
-
|
925 |
-
</div>
|
926 |
-
|
927 |
-
<?php $output = ob_get_clean();
|
928 |
-
break;
|
929 |
-
|
930 |
-
case 'um_admin_edit_field_popup':
|
931 |
-
|
932 |
-
ob_start();
|
933 |
-
|
934 |
-
$args = UM()->builtin()->get_core_field_attrs( $arg1 );
|
935 |
-
|
936 |
-
$form_fields = UM()->query()->get_attr( 'custom_fields', $arg2 );
|
937 |
-
|
938 |
-
$metabox->set_field_type = $arg1;
|
939 |
-
$metabox->in_edit = true;
|
940 |
-
$metabox->edit_array = $form_fields[ $arg3 ];
|
941 |
-
|
942 |
-
if ( !isset( $metabox->edit_array['metakey'] ) ){
|
943 |
-
$metabox->edit_array['metakey'] = $metabox->edit_array['id'];
|
944 |
-
}
|
945 |
-
|
946 |
-
if ( !isset( $metabox->edit_array['position'] ) ){
|
947 |
-
$metabox->edit_array['position'] = $metabox->edit_array['id'];
|
948 |
-
}
|
949 |
-
|
950 |
-
extract( $args );
|
951 |
-
|
952 |
-
if ( ! isset( $col1 ) ) {
|
953 |
-
|
954 |
-
echo '<p>'. __( 'This field type is not setup correcty.', 'ultimate-member' ) . '</p>';
|
955 |
-
|
956 |
-
} else {
|
957 |
-
|
958 |
-
?>
|
959 |
-
|
960 |
-
<?php if ( isset( $metabox->edit_array['in_group'] ) ) { ?>
|
961 |
-
<input type="hidden" name="_in_row" id="_in_row" value="<?php echo $metabox->edit_array['in_row']; ?>" />
|
962 |
-
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo $metabox->edit_array['in_sub_row']; ?>" />
|
963 |
-
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo $metabox->edit_array['in_column']; ?>" />
|
964 |
-
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo $metabox->edit_array['in_group']; ?>" />
|
965 |
-
<?php } ?>
|
966 |
-
|
967 |
-
<input type="hidden" name="_type" id="_type" value="<?php echo $arg1; ?>" />
|
968 |
-
|
969 |
-
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
|
970 |
-
|
971 |
-
<input type="hidden" name="edit_mode" id="edit_mode" value="true" />
|
972 |
-
|
973 |
-
<input type="hidden" name="_metakey" id="_metakey" value="<?php echo $metabox->edit_array['metakey']; ?>" />
|
974 |
-
|
975 |
-
<input type="hidden" name="_position" id="_position" value="<?php echo $metabox->edit_array['position']; ?>" />
|
976 |
-
|
977 |
-
<?php if ( isset( $args['mce_content'] ) ) { ?>
|
978 |
-
<div class="dynamic-mce-content"><?php echo ! empty( $metabox->edit_array['content'] ) ? $metabox->edit_array['content'] : ''; ?></div>
|
979 |
-
<?php } ?>
|
980 |
-
|
981 |
-
<?php $this->modal_header(); ?>
|
982 |
-
|
983 |
-
<div class="um-admin-half">
|
984 |
-
|
985 |
-
<?php if ( isset( $col1 ) ) { foreach( $col1 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
986 |
-
|
987 |
-
</div>
|
988 |
-
|
989 |
-
<div class="um-admin-half um-admin-right">
|
990 |
-
|
991 |
-
<?php if ( isset( $col2 ) ) { foreach( $col2 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
992 |
-
|
993 |
-
</div><div class="um-admin-clear"></div>
|
994 |
-
|
995 |
-
<?php if ( isset( $col3 ) ) { foreach( $col3 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
996 |
-
|
997 |
-
<div class="um-admin-clear"></div>
|
998 |
-
|
999 |
-
<?php if ( isset( $col_full ) ) {foreach( $col_full as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
1000 |
-
|
1001 |
-
<?php $this->modal_footer( $arg2, $args, $metabox ); ?>
|
1002 |
-
|
1003 |
-
<?php
|
1004 |
-
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
$output = ob_get_clean();
|
1008 |
-
break;
|
1009 |
-
|
1010 |
-
case 'um_admin_new_field_popup':
|
1011 |
-
|
1012 |
-
ob_start();
|
1013 |
-
|
1014 |
-
$args = UM()->builtin()->get_core_field_attrs( $arg1 );
|
1015 |
-
|
1016 |
-
$metabox->set_field_type = $arg1;
|
1017 |
-
|
1018 |
-
/**
|
1019 |
-
* @var $in_row
|
1020 |
-
* @var $in_sub_row
|
1021 |
-
* @var $in_column
|
1022 |
-
* @var $in_group
|
1023 |
-
*/
|
1024 |
-
extract( $args );
|
1025 |
-
|
1026 |
-
if ( ! isset( $col1 ) ) {
|
1027 |
-
|
1028 |
-
echo '<p>'. __( 'This field type is not setup correcty.', 'ultimate-member' ) . '</p>';
|
1029 |
-
|
1030 |
-
} else {
|
1031 |
-
|
1032 |
-
if ( $in_column ) { ?>
|
1033 |
-
<input type="hidden" name="_in_row" id="_in_row" value="_um_row_<?php echo $in_row + 1; ?>" />
|
1034 |
-
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo $in_sub_row; ?>" />
|
1035 |
-
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo $in_column; ?>" />
|
1036 |
-
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo $in_group; ?>" />
|
1037 |
-
<?php } ?>
|
1038 |
-
|
1039 |
-
<input type="hidden" name="_type" id="_type" value="<?php echo $arg1; ?>" />
|
1040 |
-
|
1041 |
-
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
|
1042 |
-
|
1043 |
-
<?php $this->modal_header(); ?>
|
1044 |
-
|
1045 |
-
<div class="um-admin-half">
|
1046 |
-
|
1047 |
-
<?php if ( isset( $col1 ) ) { foreach( $col1 as $opt ) $metabox->field_input ( $opt ); } ?>
|
1048 |
-
|
1049 |
-
</div>
|
1050 |
-
|
1051 |
-
<div class="um-admin-half um-admin-right">
|
1052 |
-
|
1053 |
-
<?php if ( isset( $col2 ) ) { foreach( $col2 as $opt ) $metabox->field_input ( $opt ); } ?>
|
1054 |
-
|
1055 |
-
</div><div class="um-admin-clear"></div>
|
1056 |
-
|
1057 |
-
<?php if ( isset( $col3 ) ) { foreach( $col3 as $opt ) $metabox->field_input ( $opt ); } ?>
|
1058 |
-
|
1059 |
-
<div class="um-admin-clear"></div>
|
1060 |
-
|
1061 |
-
<?php if ( isset( $col_full ) ) { foreach( $col_full as $opt ) $metabox->field_input ( $opt ); } ?>
|
1062 |
-
|
1063 |
-
<?php $this->modal_footer( $arg2, $args, $metabox ); ?>
|
1064 |
-
|
1065 |
-
<?php
|
1066 |
-
|
1067 |
-
}
|
1068 |
-
|
1069 |
-
$output = ob_get_clean();
|
1070 |
-
break;
|
1071 |
-
|
1072 |
-
case 'um_admin_preview_form':
|
1073 |
-
|
1074 |
-
UM()->user()->preview = true;
|
1075 |
-
|
1076 |
-
$mode = UM()->query()->get_attr('mode', $arg1 );
|
1077 |
-
|
1078 |
-
if ( $mode == 'profile' ) {
|
1079 |
-
UM()->fields()->editing = true;
|
1080 |
-
}
|
1081 |
-
|
1082 |
-
$output = '<div class="um-admin-preview-overlay"></div>';
|
1083 |
-
|
1084 |
-
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
1085 |
-
$output .= do_shortcode('[ultimatemember form_id="' . $arg1 . '" /]');
|
1086 |
-
} else {
|
1087 |
-
$output .= apply_shortcodes('[ultimatemember form_id="' . $arg1 . '" /]');
|
1088 |
-
}
|
1089 |
-
|
1090 |
-
break;
|
1091 |
-
|
1092 |
-
case 'um_admin_review_registration':
|
1093 |
-
//$user_id = $arg1;
|
1094 |
-
|
1095 |
-
if ( ! current_user_can( 'administrator' ) ) {
|
1096 |
-
if ( ! um_can_view_profile( $arg1 ) ) {
|
1097 |
-
$output = '';
|
1098 |
-
break;
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
|
1102 |
-
um_fetch_user( $arg1 );
|
1103 |
-
|
1104 |
-
UM()->user()->preview = true;
|
1105 |
-
|
1106 |
-
$output = um_user_submitted_registration_formatted( true );
|
1107 |
-
|
1108 |
-
um_reset_user();
|
1109 |
-
|
1110 |
-
break;
|
1111 |
-
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
if ( is_array( $output ) ) {
|
1115 |
-
print_r( $output );
|
1116 |
-
} else {
|
1117 |
-
echo $output;
|
1118 |
-
}
|
1119 |
-
die;
|
1120 |
-
}
|
1121 |
-
|
1122 |
-
|
1123 |
-
/**
|
1124 |
-
*
|
1125 |
-
*/
|
1126 |
-
function modal_header() {
|
1127 |
-
/**
|
1128 |
-
* UM hook
|
1129 |
-
*
|
1130 |
-
* @type action
|
1131 |
-
* @title um_admin_field_modal_header
|
1132 |
-
* @description Modal Window Header
|
1133 |
-
* @change_log
|
1134 |
-
* ["Since: 2.0"]
|
1135 |
-
* @usage add_action( 'um_admin_field_modal_header', 'function_name', 10 );
|
1136 |
-
* @example
|
1137 |
-
* <?php
|
1138 |
-
* add_action( 'um_admin_field_modal_header', 'my_admin_field_modal_header', 10 );
|
1139 |
-
* function my_admin_field_modal_header() {
|
1140 |
-
* // your code here
|
1141 |
-
* }
|
1142 |
-
* ?>
|
1143 |
-
*/
|
1144 |
-
do_action( 'um_admin_field_modal_header' );
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
|
1148 |
-
/**
|
1149 |
-
* Modal Footer loading
|
1150 |
-
*
|
1151 |
-
* @param $arg2
|
1152 |
-
* @param $args
|
1153 |
-
* @param $metabox
|
1154 |
-
*/
|
1155 |
-
function modal_footer( $arg2, $args, $metabox ) {
|
1156 |
-
/**
|
1157 |
-
* UM hook
|
1158 |
-
*
|
1159 |
-
* @type action
|
1160 |
-
* @title um_admin_field_modal_footer
|
1161 |
-
* @description Modal Window Footer
|
1162 |
-
* @input_vars
|
1163 |
-
* [{"var":"$arg2","type":"string","desc":"Ajax Action"},
|
1164 |
-
* {"var":"$args","type":"array","desc":"Modal window arguments"},
|
1165 |
-
* {"var":"$in_edit","type":"bool","desc":"Is edit mode?"},
|
1166 |
-
* {"var":"$edit_array","type":"array","desc":"Edit Array"}]
|
1167 |
-
* @change_log
|
1168 |
-
* ["Since: 2.0"]
|
1169 |
-
* @usage add_action( 'um_admin_field_modal_footer', 'function_name', 10, 4 );
|
1170 |
-
* @example
|
1171 |
-
* <?php
|
1172 |
-
* add_action( 'um_admin_field_modal_footer', 'my_admin_field_modal_footer', 10, 4 );
|
1173 |
-
* function my_admin_field_modal_footer( $arg2, $args, $in_edit, $edit_array ) {
|
1174 |
-
* // your code here
|
1175 |
-
* }
|
1176 |
-
* ?>
|
1177 |
-
*/
|
1178 |
-
do_action( 'um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, ( isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' );
|
1179 |
-
}
|
1180 |
-
|
1181 |
-
|
1182 |
-
/**
|
1183 |
-
* Skip field validation for:
|
1184 |
-
* - '_options' if Choices Callback specified
|
1185 |
-
*
|
1186 |
-
* @param boolean $skip
|
1187 |
-
* @param string $post_input
|
1188 |
-
* @param array $array
|
1189 |
-
* @return boolean
|
1190 |
-
*/
|
1191 |
-
public function skip_field_validation( $skip, $post_input, $array ) {
|
1192 |
-
if ( $post_input === '_options' && isset( $array['post']['_custom_dropdown_options_source'] ) ) {
|
1193 |
-
$skip = function_exists( $array['post']['_custom_dropdown_options_source'] );
|
1194 |
-
}
|
1195 |
-
|
1196 |
-
return $skip;
|
1197 |
-
}
|
1198 |
-
|
1199 |
-
|
1200 |
-
/**
|
1201 |
-
* Retrieves dropdown/multi-select options from a callback function
|
1202 |
-
*/
|
1203 |
-
function populate_dropdown_options() {
|
1204 |
-
UM()->admin()->check_ajax_nonce();
|
1205 |
-
|
1206 |
-
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
1207 |
-
wp_send_json_error( __( 'This is not possible for security reasons.', 'ultimate-member' ) );
|
1208 |
-
}
|
1209 |
-
|
1210 |
-
$arr_options = array();
|
1211 |
-
|
1212 |
-
$um_callback_func = sanitize_key( $_POST['um_option_callback'] );
|
1213 |
-
if ( empty( $um_callback_func ) ) {
|
1214 |
-
$arr_options['status'] = 'empty';
|
1215 |
-
$arr_options['function_name'] = $um_callback_func;
|
1216 |
-
$arr_options['function_exists'] = function_exists( $um_callback_func );
|
1217 |
-
}
|
1218 |
-
|
1219 |
-
$arr_options['data'] = array();
|
1220 |
-
if ( function_exists( $um_callback_func ) ) {
|
1221 |
-
$arr_options['data'] = call_user_func( $um_callback_func );
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
wp_send_json( $arr_options );
|
1225 |
-
}
|
1226 |
-
|
1227 |
-
}
|
1228 |
-
}
|
1 |
+
<?php
|
2 |
+
namespace um\admin\core;
|
3 |
+
|
4 |
+
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_Builder
|
13 |
+
* @package um\admin\core
|
14 |
+
*/
|
15 |
+
class Admin_Builder {
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var
|
20 |
+
*/
|
21 |
+
var $form_id;
|
22 |
+
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Admin_Builder constructor.
|
26 |
+
*/
|
27 |
+
function __construct() {
|
28 |
+
add_action( 'um_admin_field_modal_header', array( &$this, 'add_message_handlers' ) );
|
29 |
+
add_action( 'um_admin_field_modal_footer', array( &$this, 'add_conditional_support' ), 10, 4 );
|
30 |
+
add_filter( 'um_admin_builder_skip_field_validation', array( &$this, 'skip_field_validation' ), 10, 3 );
|
31 |
+
add_filter( 'um_admin_pre_save_field_to_form', array( &$this, 'um_admin_pre_save_field_to_form' ), 1 );
|
32 |
+
add_filter( 'um_admin_pre_save_fields_hook', array( &$this, 'um_admin_pre_save_fields_hook' ), 1 );
|
33 |
+
add_filter( 'um_admin_field_update_error_handling', array( &$this, 'um_admin_field_update_error_handling' ), 1, 2 );
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Apply a filter to handle errors for field updating in backend
|
39 |
+
*
|
40 |
+
* @param $errors
|
41 |
+
* @param $array
|
42 |
+
*
|
43 |
+
* @return mixed
|
44 |
+
*/
|
45 |
+
function um_admin_field_update_error_handling( $errors, $array ) {
|
46 |
+
/**
|
47 |
+
* @var $field_type
|
48 |
+
*/
|
49 |
+
extract( $array );
|
50 |
+
|
51 |
+
$field_attr = UM()->builtin()->get_core_field_attrs( $field_type );
|
52 |
+
|
53 |
+
if ( isset( $field_attr['validate'] ) ) {
|
54 |
+
|
55 |
+
$validate = $field_attr['validate'];
|
56 |
+
foreach ( $validate as $post_input => $arr ) {
|
57 |
+
|
58 |
+
$skip = apply_filters( 'um_admin_builder_skip_field_validation', false, $post_input, $array );
|
59 |
+
if ( $skip ) {
|
60 |
+
continue;
|
61 |
+
}
|
62 |
+
|
63 |
+
$mode = $arr['mode'];
|
64 |
+
|
65 |
+
switch ( $mode ) {
|
66 |
+
|
67 |
+
case 'numeric':
|
68 |
+
if ( ! empty( $array['post'][ $post_input ] ) && ! is_numeric( $array['post'][ $post_input ] ) ){
|
69 |
+
$errors[ $post_input ] = $validate[ $post_input ]['error'];
|
70 |
+
}
|
71 |
+
break;
|
72 |
+
|
73 |
+
case 'unique':
|
74 |
+
if ( ! isset( $array['post']['edit_mode'] ) ) {
|
75 |
+
if ( UM()->builtin()->unique_field_err( $array['post'][ $post_input ] ) ) {
|
76 |
+
$errors[ $post_input ] = UM()->builtin()->unique_field_err( $array['post'][ $post_input ] );
|
77 |
+
}
|
78 |
+
}
|
79 |
+
break;
|
80 |
+
|
81 |
+
case 'required':
|
82 |
+
if ( $array['post'][ $post_input ] == '' ) {
|
83 |
+
$errors[ $post_input ] = $validate[ $post_input ]['error'];
|
84 |
+
}
|
85 |
+
break;
|
86 |
+
|
87 |
+
case 'range-start':
|
88 |
+
if ( UM()->builtin()->date_range_start_err( $array['post'][ $post_input ] ) && $array['post']['_range'] == 'date_range' ) {
|
89 |
+
$errors[ $post_input ] = UM()->builtin()->date_range_start_err( $array['post'][ $post_input ] );
|
90 |
+
}
|
91 |
+
break;
|
92 |
+
|
93 |
+
case 'range-end':
|
94 |
+
if ( UM()->builtin()->date_range_end_err( $array['post'][ $post_input ], $array['post']['_range_start'] ) && $array['post']['_range'] == 'date_range' ) {
|
95 |
+
$errors[ $post_input ] = UM()->builtin()->date_range_end_err( $array['post'][ $post_input ], $array['post']['_range_start'] );
|
96 |
+
}
|
97 |
+
break;
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
return $errors;
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Some fields may require extra fields before saving
|
112 |
+
*
|
113 |
+
* @param $array
|
114 |
+
*
|
115 |
+
* @return mixed
|
116 |
+
*/
|
117 |
+
function um_admin_pre_save_fields_hook( $array ) {
|
118 |
+
/**
|
119 |
+
* @var $form_id
|
120 |
+
* @var $field_type
|
121 |
+
*/
|
122 |
+
extract( $array );
|
123 |
+
|
124 |
+
$fields_without_metakey = UM()->builtin()->get_fields_without_metakey();
|
125 |
+
|
126 |
+
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
127 |
+
$count = 1;
|
128 |
+
if ( ! empty( $fields ) ) {
|
129 |
+
$count = count( $fields ) + 1;
|
130 |
+
}
|
131 |
+
|
132 |
+
// set unique meta key
|
133 |
+
if ( in_array( $field_type, $fields_without_metakey ) && ! isset( $array['post']['_metakey'] ) ) {
|
134 |
+
$array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
|
135 |
+
}
|
136 |
+
|
137 |
+
// set position
|
138 |
+
if ( ! isset( $array['post']['_position'] ) ) {
|
139 |
+
$array['post']['_position'] = $count;
|
140 |
+
}
|
141 |
+
|
142 |
+
return $array;
|
143 |
+
}
|
144 |
+
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Modify field args just before it is saved into form
|
148 |
+
*
|
149 |
+
* @param $array
|
150 |
+
*
|
151 |
+
* @return mixed
|
152 |
+
*/
|
153 |
+
function um_admin_pre_save_field_to_form( $array ){
|
154 |
+
unset( $array['conditions'] );
|
155 |
+
if ( isset($array['conditional_field']) && ! empty( $array['conditional_action'] ) && ! empty( $array['conditional_operator'] ) ) {
|
156 |
+
$array['conditional_value'] = isset( $array['conditional_value'] ) ? $array['conditional_value'] : '';
|
157 |
+
$array['conditions'][] = array( $array['conditional_action'], $array['conditional_field'], $array['conditional_operator'], $array['conditional_value'] );
|
158 |
+
}
|
159 |
+
|
160 |
+
if ( isset( $array['conditional_field1'] ) && ! empty( $array['conditional_action1'] ) && ! empty( $array['conditional_operator1'] ) ) {
|
161 |
+
$array['conditional_value1'] = isset( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
|
162 |
+
$array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
|
163 |
+
}
|
164 |
+
|
165 |
+
if ( isset( $array['conditional_field2'] ) && ! empty( $array['conditional_action2'] ) && ! empty( $array['conditional_operator2'] ) ) {
|
166 |
+
$array['conditional_value2'] = isset( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
|
167 |
+
$array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( isset( $array['conditional_field3'] ) && ! empty( $array['conditional_action3'] ) && ! empty( $array['conditional_operator3'] ) ) {
|
171 |
+
$array['conditional_value3'] = isset( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
|
172 |
+
$array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( isset( $array['conditional_field4'] ) && ! empty( $array['conditional_action4'] ) && ! empty( $array['conditional_operator4'] ) ) {
|
176 |
+
$array['conditional_value4'] = isset( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
|
177 |
+
$array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
|
178 |
+
}
|
179 |
+
|
180 |
+
return $array;
|
181 |
+
}
|
182 |
+
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Put status handler in modal
|
186 |
+
*/
|
187 |
+
function add_message_handlers() {
|
188 |
+
?>
|
189 |
+
<div class="um-admin-error-block"></div>
|
190 |
+
<div class="um-admin-success-block"></div>
|
191 |
+
<?php
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Footer of modal
|
197 |
+
*
|
198 |
+
* @param $form_id
|
199 |
+
* @param $field_args
|
200 |
+
* @param $in_edit
|
201 |
+
* @param $edit_array
|
202 |
+
*/
|
203 |
+
function add_conditional_support( $form_id, $field_args, $in_edit, $edit_array ) {
|
204 |
+
$metabox = UM()->metabox();
|
205 |
+
|
206 |
+
if ( isset( $field_args['conditional_support'] ) && $field_args['conditional_support'] == 0 ) {
|
207 |
+
return;
|
208 |
+
} ?>
|
209 |
+
|
210 |
+
<div class="um-admin-btn-toggle">
|
211 |
+
|
212 |
+
<?php if ( $in_edit ) { $metabox->in_edit = true; $metabox->edit_array = $edit_array; ?>
|
213 |
+
<a href="javascript:void(0);"><i class="um-icon-plus"></i><?php _e( 'Manage conditional fields support' ); ?></a> <?php UM()->tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
|
214 |
+
<?php } else { ?>
|
215 |
+
<a href="javascript:void(0);"><i class="um-icon-plus"></i><?php _e( 'Add conditional fields support' ); ?></a> <?php UM()->tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
|
216 |
+
<?php } ?>
|
217 |
+
|
218 |
+
<div class="um-admin-btn-content">
|
219 |
+
<div class="um-admin-cur-condition-template">
|
220 |
+
|
221 |
+
<?php $metabox->field_input( '_conditional_action', $form_id ); ?>
|
222 |
+
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
223 |
+
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
224 |
+
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
225 |
+
|
226 |
+
<p><a href="javascript:void(0);" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
227 |
+
|
228 |
+
<div class="um-admin-clear"></div>
|
229 |
+
</div>
|
230 |
+
<p class="um-admin-conditions-notice">
|
231 |
+
<small>
|
232 |
+
<?php _e( 'Use the condition operator `equals to` or `not equals` if the parent field has a single option.', 'ultimate-member' ); ?>
|
233 |
+
<br><?php _e( 'Use the condition operator `greater than` or `less than` if the parent field is a number.', 'ultimate-member' ); ?>
|
234 |
+
<br><?php _e( 'Use the condition operator `contains` if the parent field has multiple options.', 'ultimate-member' ); ?>
|
235 |
+
</small>
|
236 |
+
</p>
|
237 |
+
<p><a href="javascript:void(0);" class="um-admin-new-condition button button-primary um-admin-tipsy-n" title="Add new condition"><?php _e( 'Add new rule', 'ultimate-member' ); ?></a></p>
|
238 |
+
<p class="um-admin-reset-conditions"><a href="javascript:void(0);" class="button"><?php _e( 'Reset all rules', 'ultimate-member' ); ?></a></p>
|
239 |
+
|
240 |
+
<div class="um-admin-clear"></div>
|
241 |
+
|
242 |
+
<?php if ( isset( $edit_array['conditions'] ) && count( $edit_array['conditions'] ) != 0 ) {
|
243 |
+
|
244 |
+
foreach ( $edit_array['conditions'] as $k => $arr ) {
|
245 |
+
|
246 |
+
if ( $k == 0 ) $k = ''; ?>
|
247 |
+
|
248 |
+
<div class="um-admin-cur-condition">
|
249 |
+
|
250 |
+
<?php $metabox->field_input( '_conditional_action' . $k, $form_id ); ?>
|
251 |
+
<?php $metabox->field_input( '_conditional_field' . $k , $form_id ); ?>
|
252 |
+
<?php $metabox->field_input( '_conditional_operator' . $k, $form_id ); ?>
|
253 |
+
<?php $metabox->field_input( '_conditional_value' . $k, $form_id ); ?>
|
254 |
+
|
255 |
+
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
256 |
+
|
257 |
+
<div class="um-admin-clear"></div>
|
258 |
+
</div>
|
259 |
+
|
260 |
+
<?php
|
261 |
+
}
|
262 |
+
|
263 |
+
} else { ?>
|
264 |
+
|
265 |
+
<div class="um-admin-cur-condition">
|
266 |
+
|
267 |
+
<?php $metabox->field_input( '_conditional_action', $form_id ); ?>
|
268 |
+
<?php $metabox->field_input( '_conditional_field', $form_id ); ?>
|
269 |
+
<?php $metabox->field_input( '_conditional_operator', $form_id ); ?>
|
270 |
+
<?php $metabox->field_input( '_conditional_value', $form_id ); ?>
|
271 |
+
|
272 |
+
<p><a href="#" class="um-admin-remove-condition button um-admin-tipsy-n" title="Remove condition"><i class="um-icon-close" style="margin-right:0!important"></i></a></p>
|
273 |
+
|
274 |
+
<div class="um-admin-clear"></div>
|
275 |
+
</div>
|
276 |
+
|
277 |
+
<?php } ?>
|
278 |
+
</div>
|
279 |
+
</div>
|
280 |
+
|
281 |
+
<?php
|
282 |
+
}
|
283 |
+
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Update the builder area
|
287 |
+
*/
|
288 |
+
function update_builder() {
|
289 |
+
UM()->admin()->check_ajax_nonce();
|
290 |
+
|
291 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
292 |
+
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
293 |
+
}
|
294 |
+
|
295 |
+
ob_start();
|
296 |
+
|
297 |
+
$this->form_id = absint( $_POST['form_id'] );
|
298 |
+
|
299 |
+
$this->show_builder();
|
300 |
+
|
301 |
+
$output = ob_get_clean();
|
302 |
+
|
303 |
+
if ( is_array( $output ) ) {
|
304 |
+
print_r( $output );
|
305 |
+
} else {
|
306 |
+
echo $output;
|
307 |
+
}
|
308 |
+
die;
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Sort array function
|
314 |
+
*
|
315 |
+
* @param array $arr
|
316 |
+
* @param string $col
|
317 |
+
* @param int $dir
|
318 |
+
*
|
319 |
+
* @return array
|
320 |
+
*/
|
321 |
+
function array_sort_by_column( $arr, $col, $dir = SORT_ASC ) {
|
322 |
+
$sort_col = array();
|
323 |
+
|
324 |
+
foreach ( $arr as $key => $row ) {
|
325 |
+
if ( ! empty( $row[ $col ] ) ) {
|
326 |
+
$sort_col[ $key ] = $row[ $col ];
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
if ( ! empty( $sort_col ) ) {
|
331 |
+
array_multisort( $sort_col, $dir, $arr );
|
332 |
+
}
|
333 |
+
|
334 |
+
return $arr;
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Get fields in row
|
340 |
+
*
|
341 |
+
* @param $row_id
|
342 |
+
*
|
343 |
+
* @return string
|
344 |
+
*/
|
345 |
+
function get_fields_by_row( $row_id ) {
|
346 |
+
|
347 |
+
if ( empty( $this->global_fields ) || ! is_array( $this->global_fields ) ) {
|
348 |
+
$this->global_fields = array();
|
349 |
+
}
|
350 |
+
|
351 |
+
foreach ( $this->global_fields as $key => $array ) {
|
352 |
+
if ( ! isset( $array['in_row'] ) || ( isset( $array['in_row'] ) && $array['in_row'] == $row_id ) ) {
|
353 |
+
$results[ $key ] = $array;
|
354 |
+
unset( $this->global_fields[ $key ] );
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
return ( isset ( $results ) ) ? $results : '';
|
359 |
+
}
|
360 |
+
|
361 |
+
|
362 |
+
/**
|
363 |
+
* Get fields by sub row
|
364 |
+
*
|
365 |
+
* @param $row_fields
|
366 |
+
* @param $subrow_id
|
367 |
+
*
|
368 |
+
* @return string
|
369 |
+
*/
|
370 |
+
function get_fields_in_subrow( $row_fields, $subrow_id ) {
|
371 |
+
if ( ! is_array( $row_fields ) ) {
|
372 |
+
return '';
|
373 |
+
}
|
374 |
+
|
375 |
+
foreach( $row_fields as $key => $array ) {
|
376 |
+
if ( ! isset( $array['in_sub_row'] ) || ( isset( $array['in_sub_row'] ) && $array['in_sub_row'] == $subrow_id ) ) {
|
377 |
+
$results[ $key ] = $array;
|
378 |
+
unset( $this->global_fields[ $key ] );
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
return ( isset ( $results ) ) ? $results : '';
|
383 |
+
}
|
384 |
+
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Display the builder
|
388 |
+
*/
|
389 |
+
function show_builder() {
|
390 |
+
|
391 |
+
$fields = UM()->query()->get_attr( 'custom_fields', $this->form_id );
|
392 |
+
|
393 |
+
if ( !isset( $fields ) || empty( $fields ) ) { ?>
|
394 |
+
|
395 |
+
<div class="um-admin-drag-row">
|
396 |
+
|
397 |
+
<!-- Master Row Actions -->
|
398 |
+
<div class="um-admin-drag-row-icons">
|
399 |
+
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
400 |
+
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="_um_row_1"><i class="um-faicon-pencil"></i></a>
|
401 |
+
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
402 |
+
</div>
|
403 |
+
<div class="um-admin-clear"></div>
|
404 |
+
|
405 |
+
<div class="um-admin-drag-rowsubs">
|
406 |
+
<div class="um-admin-drag-rowsub">
|
407 |
+
|
408 |
+
<!-- Column Layout -->
|
409 |
+
<div class="um-admin-drag-ctrls columns">
|
410 |
+
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
411 |
+
<a href="javascript:void(0);" data-cols="2"></a>
|
412 |
+
<a href="javascript:void(0);" data-cols="3"></a>
|
413 |
+
</div>
|
414 |
+
|
415 |
+
<!-- Sub Row Actions -->
|
416 |
+
<div class="um-admin-drag-rowsub-icons">
|
417 |
+
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
418 |
+
</div><div class="um-admin-clear"></div>
|
419 |
+
|
420 |
+
<!-- Columns -->
|
421 |
+
<div class="um-admin-drag-col">
|
422 |
+
|
423 |
+
</div>
|
424 |
+
|
425 |
+
<div class="um-admin-drag-col-dynamic"></div>
|
426 |
+
|
427 |
+
<div class="um-admin-clear"></div>
|
428 |
+
|
429 |
+
</div>
|
430 |
+
</div>
|
431 |
+
|
432 |
+
</div>
|
433 |
+
|
434 |
+
<?php
|
435 |
+
|
436 |
+
} else {
|
437 |
+
|
438 |
+
if ( empty( $fields ) || ! is_array( $fields ) ) {
|
439 |
+
$this->global_fields = array();
|
440 |
+
} else {
|
441 |
+
$this->global_fields = $fields;
|
442 |
+
}
|
443 |
+
|
444 |
+
foreach ( $this->global_fields as $key => $array ) {
|
445 |
+
if ( $array['type'] == 'row' ) {
|
446 |
+
$rows[ $key ] = $array;
|
447 |
+
unset( $this->global_fields[ $key ] ); // not needed now
|
448 |
+
}
|
449 |
+
|
450 |
+
}
|
451 |
+
|
452 |
+
if ( ! isset( $rows ) ) {
|
453 |
+
$rows = array(
|
454 |
+
'_um_row_1' => array(
|
455 |
+
'type' => 'row',
|
456 |
+
'id' => '_um_row_1',
|
457 |
+
'sub_rows' => 1,
|
458 |
+
'cols' => 1
|
459 |
+
),
|
460 |
+
);
|
461 |
+
}
|
462 |
+
|
463 |
+
foreach ( $rows as $row_id => $array ) { ?>
|
464 |
+
|
465 |
+
<div class="um-admin-drag-row" data-original="<?php echo esc_attr( $row_id ); ?>">
|
466 |
+
|
467 |
+
<!-- Master Row Actions -->
|
468 |
+
<div class="um-admin-drag-row-icons">
|
469 |
+
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
470 |
+
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member'); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( $this->form_id ); ?>" data-arg3="<?php echo esc_attr( $row_id ); ?>"><i class="um-faicon-pencil"></i></a>
|
471 |
+
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
472 |
+
<?php if ( $row_id != '_um_row_1' ) {?>
|
473 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
|
474 |
+
<?php } ?>
|
475 |
+
</div><div class="um-admin-clear"></div>
|
476 |
+
|
477 |
+
<div class="um-admin-drag-rowsubs">
|
478 |
+
|
479 |
+
<?php $row_fields = $this->get_fields_by_row( $row_id );
|
480 |
+
|
481 |
+
$sub_rows = ( isset( $array['sub_rows'] ) ) ? $array['sub_rows'] : 1;
|
482 |
+
for ( $c = 0; $c < $sub_rows; $c++ ) {
|
483 |
+
|
484 |
+
$subrow_fields = $this->get_fields_in_subrow( $row_fields, $c );
|
485 |
+
|
486 |
+
?>
|
487 |
+
|
488 |
+
<div class="um-admin-drag-rowsub">
|
489 |
+
|
490 |
+
<!-- Column Layout -->
|
491 |
+
<div class="um-admin-drag-ctrls columns">
|
492 |
+
|
493 |
+
<?php
|
494 |
+
|
495 |
+
if ( ! isset( $array['cols'] ) ) {
|
496 |
+
$col_num = 1;
|
497 |
+
} elseif ( is_numeric( $array['cols'] ) ) {
|
498 |
+
$col_num = (int) $array['cols'];
|
499 |
+
} else {
|
500 |
+
$col_split = explode( ':', $array['cols'] );
|
501 |
+
$col_num = $col_split[ $c ];
|
502 |
+
}
|
503 |
+
|
504 |
+
for ( $i = 1; $i <= 3; $i++ ) {
|
505 |
+
echo '<a href="javascript:void(0);" data-cols="'.$i.'" ';
|
506 |
+
if ( $col_num == $i ) echo 'class="active"';
|
507 |
+
echo '></a>';
|
508 |
+
}
|
509 |
+
|
510 |
+
?>
|
511 |
+
|
512 |
+
</div>
|
513 |
+
|
514 |
+
<!-- Sub Row Actions -->
|
515 |
+
<div class="um-admin-drag-rowsub-icons">
|
516 |
+
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
517 |
+
<?php if ( $c > 0 ) { ?><a href="javascript:void(0);" class="um-admin-tipsy-n" title="Delete Row" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a><?php } ?>
|
518 |
+
</div>
|
519 |
+
<div class="um-admin-clear"></div>
|
520 |
+
|
521 |
+
<!-- Columns -->
|
522 |
+
<div class="um-admin-drag-col">
|
523 |
+
|
524 |
+
<?php
|
525 |
+
|
526 |
+
if ( is_array( $subrow_fields ) ) {
|
527 |
+
|
528 |
+
$subrow_fields = $this->array_sort_by_column( $subrow_fields, 'position');
|
529 |
+
|
530 |
+
foreach( $subrow_fields as $key => $keyarray ) {
|
531 |
+
/**
|
532 |
+
* @var $type
|
533 |
+
* @var $title
|
534 |
+
*/
|
535 |
+
extract( $keyarray );
|
536 |
+
|
537 |
+
?>
|
538 |
+
|
539 |
+
<div class="um-admin-drag-fld um-admin-delete-area um-field-type-<?php echo $type; ?> <?php echo $key; ?>" data-group="<?php echo (isset($keyarray['in_group'])) ? $keyarray['in_group'] : ''; ?>" data-key="<?php echo $key; ?>" data-column="<?php echo ( isset($keyarray['in_column']) ) ? $keyarray['in_column'] : 1; ?>">
|
540 |
+
|
541 |
+
<div class="um-admin-drag-fld-title um-field-type-<?php echo $type; ?>">
|
542 |
+
<?php if ( $type == 'group' ) { ?>
|
543 |
+
<i class="um-icon-plus"></i>
|
544 |
+
<?php } else if ( isset($keyarray['icon']) && !empty( $keyarray['icon'] ) ) { ?>
|
545 |
+
<i class="<?php echo $keyarray['icon']; ?>"></i>
|
546 |
+
<?php } ?><?php echo ! empty( $keyarray['title'] ) ? $keyarray['title'] : __( '(no title)', 'ultimate-member' ); ?></div>
|
547 |
+
<?php $field_name = isset( UM()->builtin()->core_fields[$type]['name'] ) ? UM()->builtin()->core_fields[$type]['name'] : ''; ?>
|
548 |
+
<div class="um-admin-drag-fld-type um-field-type-<?php echo $type; ?>"><?php echo $field_name; ?></div>
|
549 |
+
<div class="um-admin-drag-fld-icons um-field-type-<?php echo $type; ?>">
|
550 |
+
|
551 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit', 'ultimate-member' ) ?>" data-modal="UM_edit_field" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="<?php echo $type; ?>" data-arg2="<?php echo $this->form_id; ?>" data-arg3="<?php echo $key; ?>"><i class="um-faicon-pencil"></i></a>
|
552 |
+
|
553 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n um_admin_duplicate_field" title="<?php esc_attr_e( 'Duplicate', 'ultimate-member' ) ?>" data-silent_action="um_admin_duplicate_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-files-o"></i></a>
|
554 |
+
|
555 |
+
<?php if ( $type == 'group' ) { ?>
|
556 |
+
|
557 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Group', 'ultimate-member' ) ?>" data-remove_element="um-admin-drag-fld.um-field-type-group" data-silent_action="um_admin_remove_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-trash-o"></i></a>
|
558 |
+
<?php } else { ?>
|
559 |
+
|
560 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete', 'ultimate-member' ) ?>" data-silent_action="um_admin_remove_field" data-arg1="<?php echo $key; ?>" data-arg2="<?php echo $this->form_id; ?>"><i class="um-faicon-trash-o"></i></a>
|
561 |
+
|
562 |
+
<?php } ?>
|
563 |
+
|
564 |
+
</div><div class="um-admin-clear"></div>
|
565 |
+
|
566 |
+
<?php if ( $type == 'group' ) { ?>
|
567 |
+
<div class="um-admin-drag-group">
|
568 |
+
|
569 |
+
</div>
|
570 |
+
<?php } ?>
|
571 |
+
|
572 |
+
</div>
|
573 |
+
|
574 |
+
<?php
|
575 |
+
|
576 |
+
} // end foreach
|
577 |
+
|
578 |
+
} // end if
|
579 |
+
|
580 |
+
?>
|
581 |
+
|
582 |
+
</div>
|
583 |
+
|
584 |
+
<div class="um-admin-drag-col-dynamic"></div>
|
585 |
+
|
586 |
+
<div class="um-admin-clear"></div>
|
587 |
+
|
588 |
+
</div>
|
589 |
+
|
590 |
+
<?php } ?>
|
591 |
+
|
592 |
+
</div>
|
593 |
+
|
594 |
+
</div>
|
595 |
+
|
596 |
+
<?php
|
597 |
+
|
598 |
+
} // rows loop
|
599 |
+
|
600 |
+
} // if fields exist
|
601 |
+
|
602 |
+
}
|
603 |
+
|
604 |
+
|
605 |
+
/**
|
606 |
+
*
|
607 |
+
*/
|
608 |
+
function update_field() {
|
609 |
+
UM()->admin()->check_ajax_nonce();
|
610 |
+
|
611 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
612 |
+
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
613 |
+
}
|
614 |
+
|
615 |
+
$output['error'] = null;
|
616 |
+
|
617 |
+
$array = array(
|
618 |
+
'field_type' => sanitize_key( $_POST['_type'] ),
|
619 |
+
'form_id' => absint( $_POST['post_id'] ),
|
620 |
+
'args' => UM()->builtin()->get_core_field_attrs( sanitize_key( $_POST['_type'] ) ),
|
621 |
+
'post' => UM()->admin()->sanitize_builder_field_meta( $_POST ),
|
622 |
+
);
|
623 |
+
|
624 |
+
/**
|
625 |
+
* UM hook
|
626 |
+
*
|
627 |
+
* @type filter
|
628 |
+
* @title um_admin_pre_save_fields_hook
|
629 |
+
* @description Filter field data before save
|
630 |
+
* @input_vars
|
631 |
+
* [{"var":"$array","type":"array","desc":"Save Field data"}]
|
632 |
+
* @change_log
|
633 |
+
* ["Since: 2.0"]
|
634 |
+
* @usage add_filter( 'um_admin_pre_save_fields_hook', 'function_name', 10, 1 );
|
635 |
+
* @example
|
636 |
+
* <?php
|
637 |
+
* add_filter( 'um_admin_pre_save_fields_hook', 'my_admin_pre_save_fields', 10, 1 );
|
638 |
+
* function my_admin_pre_save_fields( $array ) {
|
639 |
+
* // your code here
|
640 |
+
* return $array;
|
641 |
+
* }
|
642 |
+
* ?>
|
643 |
+
*/
|
644 |
+
$array = apply_filters( 'um_admin_pre_save_fields_hook', $array );
|
645 |
+
|
646 |
+
/**
|
647 |
+
* UM hook
|
648 |
+
*
|
649 |
+
* @type filter
|
650 |
+
* @title um_admin_field_update_error_handling
|
651 |
+
* @description Change error string on save field
|
652 |
+
* @input_vars
|
653 |
+
* [{"var":"$error","type":"string","desc":"Error String"},
|
654 |
+
* {"var":"$array","type":"array","desc":"Save Field data"}]
|
655 |
+
* @change_log
|
656 |
+
* ["Since: 2.0"]
|
657 |
+
* @usage add_filter( 'um_admin_field_update_error_handling', 'function_name', 10, 2 );
|
658 |
+
* @example
|
659 |
+
* <?php
|
660 |
+
* add_filter( 'um_admin_field_update_error_handling', 'my_admin_field_update_error', 10, 2 );
|
661 |
+
* function my_admin_field_update_error( $error, $array ) {
|
662 |
+
* // your code here
|
663 |
+
* return $error;
|
664 |
+
* }
|
665 |
+
* ?>
|
666 |
+
*/
|
667 |
+
$output['error'] = apply_filters( 'um_admin_field_update_error_handling', $output['error'], $array );
|
668 |
+
|
669 |
+
/**
|
670 |
+
* @var $_metakey
|
671 |
+
* @var $post_id
|
672 |
+
*/
|
673 |
+
extract( $array['post'] );
|
674 |
+
|
675 |
+
if ( empty( $output['error'] ) ) {
|
676 |
+
|
677 |
+
$save = array();
|
678 |
+
$save[ $_metakey ] = null;
|
679 |
+
foreach ( $array['post'] as $key => $val ) {
|
680 |
+
|
681 |
+
if ( substr( $key, 0, 1 ) === '_' && $val !== '' ) { // field attribute
|
682 |
+
$new_key = ltrim ( $key, '_' );
|
683 |
+
|
684 |
+
if ( $new_key == 'options' ) {
|
685 |
+
//$save[ $_metakey ][$new_key] = explode(PHP_EOL, $val);
|
686 |
+
$save[ $_metakey ][ $new_key ] = preg_split( '/[\r\n]+/', $val, -1, PREG_SPLIT_NO_EMPTY );
|
687 |
+
} else {
|
688 |
+
$save[ $_metakey ][ $new_key ] = $val;
|
689 |
+
}
|
690 |
+
|
691 |
+
} elseif ( strstr( $key, 'um_editor' ) ) {
|
692 |
+
|
693 |
+
if ( 'block' === $array['post']['_type'] ) {
|
694 |
+
$save[ $_metakey ]['content'] = wp_kses_post( $val );
|
695 |
+
} else {
|
696 |
+
$save[ $_metakey ]['content'] = sanitize_textarea_field( $val );
|
697 |
+
}
|
698 |
+
}
|
699 |
+
|
700 |
+
}
|
701 |
+
|
702 |
+
$field_ID = $_metakey;
|
703 |
+
$field_args = $save[ $_metakey ];
|
704 |
+
|
705 |
+
/**
|
706 |
+
* UM hook
|
707 |
+
*
|
708 |
+
* @type filter
|
709 |
+
* @title um_admin_pre_save_field_to_form
|
710 |
+
* @description Change field options before save to form
|
711 |
+
* @input_vars
|
712 |
+
* [{"var":"$field_args","type":"array","desc":"Field Options"}]
|
713 |
+
* @change_log
|
714 |
+
* ["Since: 2.0"]
|
715 |
+
* @usage add_filter( 'um_admin_pre_save_field_to_form', 'function_name', 10, 1 );
|
716 |
+
* @example
|
717 |
+
* <?php
|
718 |
+
* add_filter( 'um_admin_pre_save_field_to_form', 'my_admin_pre_save_field_to_form', 10, 1 );
|
719 |
+
* function my_admin_pre_save_field_to_form( $field_args ) {
|
720 |
+
* // your code here
|
721 |
+
* return $field_args;
|
722 |
+
* }
|
723 |
+
* ?>
|
724 |
+
*/
|
725 |
+
$field_args = apply_filters( 'um_admin_pre_save_field_to_form', $field_args );
|
726 |
+
|
727 |
+
UM()->fields()->update_field( $field_ID, $field_args, $post_id );
|
728 |
+
|
729 |
+
/**
|
730 |
+
* UM hook
|
731 |
+
*
|
732 |
+
* @type filter
|
733 |
+
* @title um_admin_pre_save_field_to_db
|
734 |
+
* @description Change field options before save to DB
|
735 |
+
* @input_vars
|
736 |
+
* [{"var":"$field_args","type":"array","desc":"Field Options"}]
|
737 |
+
* @change_log
|
738 |
+
* ["Since: 2.0"]
|
739 |
+
* @usage add_filter( 'um_admin_pre_save_field_to_db', 'function_name', 10, 1 );
|
740 |
+
* @example
|
741 |
+
* <?php
|
742 |
+
* add_filter( 'um_admin_pre_save_field_to_db', 'my_admin_pre_save_field_to_db', 10, 1 );
|
743 |
+
* function my_admin_pre_save_field_to_form( $field_args ) {
|
744 |
+
* // your code here
|
745 |
+
* return $field_args;
|
746 |
+
* }
|
747 |
+
* ?>
|
748 |
+
*/
|
749 |
+
$field_args = apply_filters( 'um_admin_pre_save_field_to_db', $field_args );
|
750 |
+
|
751 |
+
if ( ! isset( $array['args']['form_only'] ) ) {
|
752 |
+
if ( ! isset( UM()->builtin()->predefined_fields[ $field_ID ] ) ) {
|
753 |
+
UM()->fields()->globally_update_field( $field_ID, $field_args );
|
754 |
+
}
|
755 |
+
}
|
756 |
+
|
757 |
+
}
|
758 |
+
|
759 |
+
$output = json_encode( $output );
|
760 |
+
if ( is_array( $output ) ) {
|
761 |
+
print_r( $output );
|
762 |
+
} else {
|
763 |
+
echo $output;
|
764 |
+
}
|
765 |
+
die;
|
766 |
+
}
|
767 |
+
|
768 |
+
|
769 |
+
/**
|
770 |
+
*
|
771 |
+
*/
|
772 |
+
function dynamic_modal_content() {
|
773 |
+
UM()->admin()->check_ajax_nonce();
|
774 |
+
|
775 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
776 |
+
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
777 |
+
}
|
778 |
+
|
779 |
+
$metabox = UM()->metabox();
|
780 |
+
|
781 |
+
/**
|
782 |
+
* @var $act_id
|
783 |
+
* @var $arg1
|
784 |
+
* @var $arg2
|
785 |
+
* @var $arg3
|
786 |
+
*/
|
787 |
+
extract( $_POST );
|
788 |
+
|
789 |
+
if ( isset( $arg1 ) ) {
|
790 |
+
$arg1 = sanitize_text_field( $arg1 );
|
791 |
+
}
|
792 |
+
|
793 |
+
if ( isset( $arg2 ) ) {
|
794 |
+
$arg2 = sanitize_text_field( $arg2 );
|
795 |
+
}
|
796 |
+
|
797 |
+
if ( isset( $arg3 ) ) {
|
798 |
+
$arg3 = sanitize_text_field( $arg3 );
|
799 |
+
}
|
800 |
+
|
801 |
+
switch ( sanitize_key( $act_id ) ) {
|
802 |
+
|
803 |
+
default:
|
804 |
+
|
805 |
+
ob_start();
|
806 |
+
|
807 |
+
/**
|
808 |
+
* UM hook
|
809 |
+
*
|
810 |
+
* @type action
|
811 |
+
* @title um_admin_ajax_modal_content__hook
|
812 |
+
* @description Integration hook on ajax popup admin builder modal content
|
813 |
+
* @input_vars
|
814 |
+
* [{"var":"$act_id","type":"string","desc":"Ajax Action"}]
|
815 |
+
* @change_log
|
816 |
+
* ["Since: 2.0"]
|
817 |
+
* @usage add_action( 'um_admin_ajax_modal_content__hook', 'function_name', 10, 1 );
|
818 |
+
* @example
|
819 |
+
* <?php
|
820 |
+
* add_action( 'um_admin_ajax_modal_content__hook', 'my_admin_custom_hook', 10, 1 );
|
821 |
+
* function um_admin_ajax_modal_content__hook( $act_id ) {
|
822 |
+
* // your code here
|
823 |
+
* }
|
824 |
+
* ?>
|
825 |
+
*/
|
826 |
+
do_action( 'um_admin_ajax_modal_content__hook', sanitize_key( $act_id ) );
|
827 |
+
/**
|
828 |
+
* UM hook
|
829 |
+
*
|
830 |
+
* @type action
|
831 |
+
* @title um_admin_ajax_modal_content__hook_{$act_id}
|
832 |
+
* @description Integration hook on ajax popup admin builder modal content
|
833 |
+
* @change_log
|
834 |
+
* ["Since: 2.0"]
|
835 |
+
* @usage add_action( 'um_admin_ajax_modal_content__hook_{$act_id}', 'function_name', 10 );
|
836 |
+
* @example
|
837 |
+
* <?php
|
838 |
+
* add_action( 'um_admin_ajax_modal_content__hook_{$act_id}', 'my_admin_ajax_modal_content', 10 );
|
839 |
+
* function my_admin_ajax_modal_content() {
|
840 |
+
* // your code here
|
841 |
+
* }
|
842 |
+
* ?>
|
843 |
+
*/
|
844 |
+
do_action( "um_admin_ajax_modal_content__hook_" . sanitize_key( $act_id ) );
|
845 |
+
|
846 |
+
$output = ob_get_clean();
|
847 |
+
break;
|
848 |
+
|
849 |
+
case 'um_admin_fonticon_selector':
|
850 |
+
|
851 |
+
ob_start(); ?>
|
852 |
+
|
853 |
+
<div class="um-admin-metabox">
|
854 |
+
<p class="_icon_search"><input type="text" name="_icon_search" id="_icon_search" value="" placeholder="<?php esc_attr_e('Search Icons...', 'ultimate-member' ); ?>" /></p>
|
855 |
+
</div>
|
856 |
+
|
857 |
+
<div class="um-admin-icons">
|
858 |
+
<?php foreach( UM()->fonticons()->all as $icon ) { ?>
|
859 |
+
<span data-code="<?php echo esc_attr( $icon ); ?>" title="<?php echo esc_attr( $icon ); ?>" class="um-admin-tipsy-n"><i class="<?php echo $icon; ?>"></i></span>
|
860 |
+
<?php } ?>
|
861 |
+
</div><div class="um-admin-clear"></div>
|
862 |
+
|
863 |
+
<?php $output = ob_get_clean();
|
864 |
+
break;
|
865 |
+
|
866 |
+
case 'um_admin_show_fields':
|
867 |
+
|
868 |
+
ob_start();
|
869 |
+
$form_fields = UM()->query()->get_attr( 'custom_fields', $arg2 );
|
870 |
+
$form_fields = array_values( array_filter( array_keys( $form_fields ) ) );
|
871 |
+
//$form_fields = array_keys( $form_fields );
|
872 |
+
?>
|
873 |
+
|
874 |
+
<h4><?php _e('Setup New Field','ultimate-member'); ?></h4>
|
875 |
+
<div class="um-admin-btns">
|
876 |
+
|
877 |
+
<?php if ( UM()->builtin()->core_fields ) {
|
878 |
+
foreach ( UM()->builtin()->core_fields as $field_type => $array ) {
|
879 |
+
|
880 |
+
if ( isset( $array['in_fields'] ) && $array['in_fields'] == false ) {
|
881 |
+
continue;
|
882 |
+
} ?>
|
883 |
+
|
884 |
+
<a href="javascript:void(0);" class="button" data-modal="UM_add_field" data-modal-size="normal" data-dynamic-content="um_admin_new_field_popup" data-arg1="<?php echo esc_attr( $field_type ); ?>" data-arg2="<?php echo esc_attr( $arg2 ) ?>"><?php echo esc_html( $array['name'] ); ?></a>
|
885 |
+
|
886 |
+
<?php }
|
887 |
+
} ?>
|
888 |
+
|
889 |
+
</div>
|
890 |
+
|
891 |
+
<h4><?php _e('Predefined Fields','ultimate-member'); ?></h4>
|
892 |
+
<div class="um-admin-btns">
|
893 |
+
|
894 |
+
<?php if ( UM()->builtin()->predefined_fields ) {
|
895 |
+
foreach ( UM()->builtin()->predefined_fields as $field_key => $array ) {
|
896 |
+
if ( ! isset( $array['account_only'] ) && ! isset( $array['private_use'] ) ) { ?>
|
897 |
+
|
898 |
+
<a href="javascript:void(0);" class="button" <?php disabled( in_array( $field_key, $form_fields, true ) ) ?> data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php echo esc_attr( $field_key ); ?>" data-arg2="<?php echo esc_attr( $arg2 ); ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?></a>
|
899 |
+
|
900 |
+
<?php }
|
901 |
+
}
|
902 |
+
} else {
|
903 |
+
echo '<p>' . __( 'None', 'ultimate-member' ) . '</p>';
|
904 |
+
} ?>
|
905 |
+
|
906 |
+
</div>
|
907 |
+
|
908 |
+
<h4><?php _e( 'Custom Fields', 'ultimate-member' ); ?></h4>
|
909 |
+
<div class="um-admin-btns">
|
910 |
+
|
911 |
+
<?php
|
912 |
+
if ( UM()->builtin()->custom_fields ) {
|
913 |
+
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
|
914 |
+
if ( empty( $array['title'] ) || empty( $array['type'] ) ) {
|
915 |
+
continue;
|
916 |
+
} ?>
|
917 |
+
|
918 |
+
<a href="javascript:void(0);" class="button with-icon" <?php disabled( in_array( $field_key, $form_fields, true ) ) ?> data-silent_action="um_admin_add_field_from_list" data-arg1="<?php echo esc_attr( $field_key ); ?>" data-arg2="<?php echo esc_attr( $arg2 ); ?>" title="<?php echo __( 'Meta Key', 'ultimate-member' ) . ' - ' . esc_attr( $field_key ); ?>"><?php echo um_trim_string( stripslashes( $array['title'] ), 20 ); ?> <small>(<?php echo ucfirst( $array['type'] ); ?>)</small><span class="remove"></span></a>
|
919 |
+
|
920 |
+
<?php }
|
921 |
+
} else {
|
922 |
+
echo '<p>' . __( 'You did not create any custom fields', 'ultimate-member' ) . '</p>';
|
923 |
+
} ?>
|
924 |
+
|
925 |
+
</div>
|
926 |
+
|
927 |
+
<?php $output = ob_get_clean();
|
928 |
+
break;
|
929 |
+
|
930 |
+
case 'um_admin_edit_field_popup':
|
931 |
+
|
932 |
+
ob_start();
|
933 |
+
|
934 |
+
$args = UM()->builtin()->get_core_field_attrs( $arg1 );
|
935 |
+
|
936 |
+
$form_fields = UM()->query()->get_attr( 'custom_fields', $arg2 );
|
937 |
+
|
938 |
+
$metabox->set_field_type = $arg1;
|
939 |
+
$metabox->in_edit = true;
|
940 |
+
$metabox->edit_array = $form_fields[ $arg3 ];
|
941 |
+
|
942 |
+
if ( !isset( $metabox->edit_array['metakey'] ) ){
|
943 |
+
$metabox->edit_array['metakey'] = $metabox->edit_array['id'];
|
944 |
+
}
|
945 |
+
|
946 |
+
if ( !isset( $metabox->edit_array['position'] ) ){
|
947 |
+
$metabox->edit_array['position'] = $metabox->edit_array['id'];
|
948 |
+
}
|
949 |
+
|
950 |
+
extract( $args );
|
951 |
+
|
952 |
+
if ( ! isset( $col1 ) ) {
|
953 |
+
|
954 |
+
echo '<p>'. __( 'This field type is not setup correcty.', 'ultimate-member' ) . '</p>';
|
955 |
+
|
956 |
+
} else {
|
957 |
+
|
958 |
+
?>
|
959 |
+
|
960 |
+
<?php if ( isset( $metabox->edit_array['in_group'] ) ) { ?>
|
961 |
+
<input type="hidden" name="_in_row" id="_in_row" value="<?php echo $metabox->edit_array['in_row']; ?>" />
|
962 |
+
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo $metabox->edit_array['in_sub_row']; ?>" />
|
963 |
+
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo $metabox->edit_array['in_column']; ?>" />
|
964 |
+
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo $metabox->edit_array['in_group']; ?>" />
|
965 |
+
<?php } ?>
|
966 |
+
|
967 |
+
<input type="hidden" name="_type" id="_type" value="<?php echo $arg1; ?>" />
|
968 |
+
|
969 |
+
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
|
970 |
+
|
971 |
+
<input type="hidden" name="edit_mode" id="edit_mode" value="true" />
|
972 |
+
|
973 |
+
<input type="hidden" name="_metakey" id="_metakey" value="<?php echo $metabox->edit_array['metakey']; ?>" />
|
974 |
+
|
975 |
+
<input type="hidden" name="_position" id="_position" value="<?php echo $metabox->edit_array['position']; ?>" />
|
976 |
+
|
977 |
+
<?php if ( isset( $args['mce_content'] ) ) { ?>
|
978 |
+
<div class="dynamic-mce-content"><?php echo ! empty( $metabox->edit_array['content'] ) ? $metabox->edit_array['content'] : ''; ?></div>
|
979 |
+
<?php } ?>
|
980 |
+
|
981 |
+
<?php $this->modal_header(); ?>
|
982 |
+
|
983 |
+
<div class="um-admin-half">
|
984 |
+
|
985 |
+
<?php if ( isset( $col1 ) ) { foreach( $col1 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
986 |
+
|
987 |
+
</div>
|
988 |
+
|
989 |
+
<div class="um-admin-half um-admin-right">
|
990 |
+
|
991 |
+
<?php if ( isset( $col2 ) ) { foreach( $col2 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
992 |
+
|
993 |
+
</div><div class="um-admin-clear"></div>
|
994 |
+
|
995 |
+
<?php if ( isset( $col3 ) ) { foreach( $col3 as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
996 |
+
|
997 |
+
<div class="um-admin-clear"></div>
|
998 |
+
|
999 |
+
<?php if ( isset( $col_full ) ) {foreach( $col_full as $opt ) $metabox->field_input ( $opt, null, $metabox->edit_array ); } ?>
|
1000 |
+
|
1001 |
+
<?php $this->modal_footer( $arg2, $args, $metabox ); ?>
|
1002 |
+
|
1003 |
+
<?php
|
1004 |
+
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
$output = ob_get_clean();
|
1008 |
+
break;
|
1009 |
+
|
1010 |
+
case 'um_admin_new_field_popup':
|
1011 |
+
|
1012 |
+
ob_start();
|
1013 |
+
|
1014 |
+
$args = UM()->builtin()->get_core_field_attrs( $arg1 );
|
1015 |
+
|
1016 |
+
$metabox->set_field_type = $arg1;
|
1017 |
+
|
1018 |
+
/**
|
1019 |
+
* @var $in_row
|
1020 |
+
* @var $in_sub_row
|
1021 |
+
* @var $in_column
|
1022 |
+
* @var $in_group
|
1023 |
+
*/
|
1024 |
+
extract( $args );
|
1025 |
+
|
1026 |
+
if ( ! isset( $col1 ) ) {
|
1027 |
+
|
1028 |
+
echo '<p>'. __( 'This field type is not setup correcty.', 'ultimate-member' ) . '</p>';
|
1029 |
+
|
1030 |
+
} else {
|
1031 |
+
|
1032 |
+
if ( $in_column ) { ?>
|
1033 |
+
<input type="hidden" name="_in_row" id="_in_row" value="_um_row_<?php echo $in_row + 1; ?>" />
|
1034 |
+
<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php echo $in_sub_row; ?>" />
|
1035 |
+
<input type="hidden" name="_in_column" id="_in_column" value="<?php echo $in_column; ?>" />
|
1036 |
+
<input type="hidden" name="_in_group" id="_in_group" value="<?php echo $in_group; ?>" />
|
1037 |
+
<?php } ?>
|
1038 |
+
|
1039 |
+
<input type="hidden" name="_type" id="_type" value="<?php echo $arg1; ?>" />
|
1040 |
+
|
1041 |
+
<input type="hidden" name="post_id" id="post_id" value="<?php echo $arg2; ?>" />
|
1042 |
+
|
1043 |
+
<?php $this->modal_header(); ?>
|
1044 |
+
|
1045 |
+
<div class="um-admin-half">
|
1046 |
+
|
1047 |
+
<?php if ( isset( $col1 ) ) { foreach( $col1 as $opt ) $metabox->field_input ( $opt ); } ?>
|
1048 |
+
|
1049 |
+
</div>
|
1050 |
+
|
1051 |
+
<div class="um-admin-half um-admin-right">
|
1052 |
+
|
1053 |
+
<?php if ( isset( $col2 ) ) { foreach( $col2 as $opt ) $metabox->field_input ( $opt ); } ?>
|
1054 |
+
|
1055 |
+
</div><div class="um-admin-clear"></div>
|
1056 |
+
|
1057 |
+
<?php if ( isset( $col3 ) ) { foreach( $col3 as $opt ) $metabox->field_input ( $opt ); } ?>
|
1058 |
+
|
1059 |
+
<div class="um-admin-clear"></div>
|
1060 |
+
|
1061 |
+
<?php if ( isset( $col_full ) ) { foreach( $col_full as $opt ) $metabox->field_input ( $opt ); } ?>
|
1062 |
+
|
1063 |
+
<?php $this->modal_footer( $arg2, $args, $metabox ); ?>
|
1064 |
+
|
1065 |
+
<?php
|
1066 |
+
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
$output = ob_get_clean();
|
1070 |
+
break;
|
1071 |
+
|
1072 |
+
case 'um_admin_preview_form':
|
1073 |
+
|
1074 |
+
UM()->user()->preview = true;
|
1075 |
+
|
1076 |
+
$mode = UM()->query()->get_attr('mode', $arg1 );
|
1077 |
+
|
1078 |
+
if ( $mode == 'profile' ) {
|
1079 |
+
UM()->fields()->editing = true;
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
$output = '<div class="um-admin-preview-overlay"></div>';
|
1083 |
+
|
1084 |
+
if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
|
1085 |
+
$output .= do_shortcode('[ultimatemember form_id="' . $arg1 . '" /]');
|
1086 |
+
} else {
|
1087 |
+
$output .= apply_shortcodes('[ultimatemember form_id="' . $arg1 . '" /]');
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
break;
|
1091 |
+
|
1092 |
+
case 'um_admin_review_registration':
|
1093 |
+
//$user_id = $arg1;
|
1094 |
+
|
1095 |
+
if ( ! current_user_can( 'administrator' ) ) {
|
1096 |
+
if ( ! um_can_view_profile( $arg1 ) ) {
|
1097 |
+
$output = '';
|
1098 |
+
break;
|
1099 |
+
}
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
um_fetch_user( $arg1 );
|
1103 |
+
|
1104 |
+
UM()->user()->preview = true;
|
1105 |
+
|
1106 |
+
$output = um_user_submitted_registration_formatted( true );
|
1107 |
+
|
1108 |
+
um_reset_user();
|
1109 |
+
|
1110 |
+
break;
|
1111 |
+
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
if ( is_array( $output ) ) {
|
1115 |
+
print_r( $output );
|
1116 |
+
} else {
|
1117 |
+
echo $output;
|
1118 |
+
}
|
1119 |
+
die;
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
|
1123 |
+
/**
|
1124 |
+
*
|
1125 |
+
*/
|
1126 |
+
function modal_header() {
|
1127 |
+
/**
|
1128 |
+
* UM hook
|
1129 |
+
*
|
1130 |
+
* @type action
|
1131 |
+
* @title um_admin_field_modal_header
|
1132 |
+
* @description Modal Window Header
|
1133 |
+
* @change_log
|
1134 |
+
* ["Since: 2.0"]
|
1135 |
+
* @usage add_action( 'um_admin_field_modal_header', 'function_name', 10 );
|
1136 |
+
* @example
|
1137 |
+
* <?php
|
1138 |
+
* add_action( 'um_admin_field_modal_header', 'my_admin_field_modal_header', 10 );
|
1139 |
+
* function my_admin_field_modal_header() {
|
1140 |
+
* // your code here
|
1141 |
+
* }
|
1142 |
+
* ?>
|
1143 |
+
*/
|
1144 |
+
do_action( 'um_admin_field_modal_header' );
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
|
1148 |
+
/**
|
1149 |
+
* Modal Footer loading
|
1150 |
+
*
|
1151 |
+
* @param $arg2
|
1152 |
+
* @param $args
|
1153 |
+
* @param $metabox
|
1154 |
+
*/
|
1155 |
+
function modal_footer( $arg2, $args, $metabox ) {
|
1156 |
+
/**
|
1157 |
+
* UM hook
|
1158 |
+
*
|
1159 |
+
* @type action
|
1160 |
+
* @title um_admin_field_modal_footer
|
1161 |
+
* @description Modal Window Footer
|
1162 |
+
* @input_vars
|
1163 |
+
* [{"var":"$arg2","type":"string","desc":"Ajax Action"},
|
1164 |
+
* {"var":"$args","type":"array","desc":"Modal window arguments"},
|
1165 |
+
* {"var":"$in_edit","type":"bool","desc":"Is edit mode?"},
|
1166 |
+
* {"var":"$edit_array","type":"array","desc":"Edit Array"}]
|
1167 |
+
* @change_log
|
1168 |
+
* ["Since: 2.0"]
|
1169 |
+
* @usage add_action( 'um_admin_field_modal_footer', 'function_name', 10, 4 );
|
1170 |
+
* @example
|
1171 |
+
* <?php
|
1172 |
+
* add_action( 'um_admin_field_modal_footer', 'my_admin_field_modal_footer', 10, 4 );
|
1173 |
+
* function my_admin_field_modal_footer( $arg2, $args, $in_edit, $edit_array ) {
|
1174 |
+
* // your code here
|
1175 |
+
* }
|
1176 |
+
* ?>
|
1177 |
+
*/
|
1178 |
+
do_action( 'um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, ( isset( $metabox->edit_array ) ) ? $metabox->edit_array : '' );
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
|
1182 |
+
/**
|
1183 |
+
* Skip field validation for:
|
1184 |
+
* - '_options' if Choices Callback specified
|
1185 |
+
*
|
1186 |
+
* @param boolean $skip
|
1187 |
+
* @param string $post_input
|
1188 |
+
* @param array $array
|
1189 |
+
* @return boolean
|
1190 |
+
*/
|
1191 |
+
public function skip_field_validation( $skip, $post_input, $array ) {
|
1192 |
+
if ( $post_input === '_options' && isset( $array['post']['_custom_dropdown_options_source'] ) ) {
|
1193 |
+
$skip = function_exists( $array['post']['_custom_dropdown_options_source'] );
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
return $skip;
|
1197 |
+
}
|
1198 |
+
|
1199 |
+
|
1200 |
+
/**
|
1201 |
+
* Retrieves dropdown/multi-select options from a callback function
|
1202 |
+
*/
|
1203 |
+
function populate_dropdown_options() {
|
1204 |
+
UM()->admin()->check_ajax_nonce();
|
1205 |
+
|
1206 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
1207 |
+
wp_send_json_error( __( 'This is not possible for security reasons.', 'ultimate-member' ) );
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
$arr_options = array();
|
1211 |
+
|
1212 |
+
$um_callback_func = sanitize_key( $_POST['um_option_callback'] );
|
1213 |
+
if ( empty( $um_callback_func ) ) {
|
1214 |
+
$arr_options['status'] = 'empty';
|
1215 |
+
$arr_options['function_name'] = $um_callback_func;
|
1216 |
+
$arr_options['function_exists'] = function_exists( $um_callback_func );
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
$arr_options['data'] = array();
|
1220 |
+
if ( function_exists( $um_callback_func ) ) {
|
1221 |
+
$arr_options['data'] = call_user_func( $um_callback_func );
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
wp_send_json( $arr_options );
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
}
|
1228 |
+
}
|
includes/admin/core/class-admin-dragdrop.php
CHANGED
@@ -1,243 +1,249 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_DragDrop
|
13 |
-
* @package um\admin\core
|
14 |
-
*/
|
15 |
-
class Admin_DragDrop {
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Admin_DragDrop constructor.
|
20 |
-
*/
|
21 |
-
function __construct() {
|
22 |
-
add_action( 'admin_footer', array( &$this, 'load_field_order' ), 9 );
|
23 |
-
}
|
24 |
-
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Update order of fields
|
28 |
-
*/
|
29 |
-
public function update_order() {
|
30 |
-
UM()->admin()->check_ajax_nonce();
|
31 |
-
|
32 |
-
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
33 |
-
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @var $form_id
|
38 |
-
*/
|
39 |
-
extract( $_POST );
|
40 |
-
|
41 |
-
if ( isset( $form_id ) ) {
|
42 |
-
$form_id = absint( $form_id );
|
43 |
-
}
|
44 |
-
|
45 |
-
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
46 |
-
|
47 |
-
$this->row_data = get_option( 'um_form_rowdata_' . $form_id, array() );
|
48 |
-
$this->exist_rows = array();
|
49 |
-
|
50 |
-
if ( ! empty( $fields ) ) {
|
51 |
-
foreach ( $fields as $key => $array ) {
|
52 |
-
if ( 'row' === $array['type'] ) {
|
53 |
-
$this->row_data[ $key ] = $array;
|
54 |
-
unset( $fields[ $key ] );
|
55 |
-
}
|
56 |
-
}
|
57 |
-
} else {
|
58 |
-
$fields = array();
|
59 |
-
}
|
60 |
-
|
61 |
-
foreach ( $_POST as $key => $value ) {
|
62 |
-
|
63 |
-
$key = sanitize_key( $key );
|
64 |
-
|
65 |
-
// adding rows
|
66 |
-
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
67 |
-
|
68 |
-
$update_args = null;
|
69 |
-
|
70 |
-
$row_id = str_replace( '_um_row_', '', $key );
|
71 |
-
|
72 |
-
$
|
73 |
-
'
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
|
146 |
-
|
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 |
-
<div class="um-admin-
|
176 |
-
|
177 |
-
|
178 |
-
<
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
<div class="um-admin-drag-
|
187 |
-
<
|
188 |
-
<a href="javascript:void(0);"
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
<div class="um-admin-drag-
|
212 |
-
<
|
213 |
-
<a href="javascript:void(0);"
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
namespace um\admin\core;
|
3 |
+
|
4 |
+
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\admin\core\Admin_DragDrop' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_DragDrop
|
13 |
+
* @package um\admin\core
|
14 |
+
*/
|
15 |
+
class Admin_DragDrop {
|
16 |
+
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Admin_DragDrop constructor.
|
20 |
+
*/
|
21 |
+
function __construct() {
|
22 |
+
add_action( 'admin_footer', array( &$this, 'load_field_order' ), 9 );
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Update order of fields
|
28 |
+
*/
|
29 |
+
public function update_order() {
|
30 |
+
UM()->admin()->check_ajax_nonce();
|
31 |
+
|
32 |
+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
33 |
+
wp_send_json_error( __( 'Please login as administrator', 'ultimate-member' ) );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var $form_id
|
38 |
+
*/
|
39 |
+
extract( $_POST );
|
40 |
+
|
41 |
+
if ( isset( $form_id ) ) {
|
42 |
+
$form_id = absint( $form_id );
|
43 |
+
}
|
44 |
+
|
45 |
+
$fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
46 |
+
|
47 |
+
$this->row_data = get_option( 'um_form_rowdata_' . $form_id, array() );
|
48 |
+
$this->exist_rows = array();
|
49 |
+
|
50 |
+
if ( ! empty( $fields ) ) {
|
51 |
+
foreach ( $fields as $key => $array ) {
|
52 |
+
if ( 'row' === $array['type'] ) {
|
53 |
+
$this->row_data[ $key ] = $array;
|
54 |
+
unset( $fields[ $key ] );
|
55 |
+
}
|
56 |
+
}
|
57 |
+
} else {
|
58 |
+
$fields = array();
|
59 |
+
}
|
60 |
+
|
61 |
+
foreach ( $_POST as $key => $value ) {
|
62 |
+
|
63 |
+
$key = sanitize_key( $key );
|
64 |
+
|
65 |
+
// adding rows
|
66 |
+
if ( 0 === strpos( $key, '_um_row_' ) ) {
|
67 |
+
|
68 |
+
$update_args = null;
|
69 |
+
|
70 |
+
$row_id = str_replace( '_um_row_', '', $key );
|
71 |
+
|
72 |
+
if ( strstr( $_POST[ '_um_rowcols_' . $row_id . '_cols' ], ':' ) ) {
|
73 |
+
$cols = sanitize_text_field( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
74 |
+
} else {
|
75 |
+
$cols = absint( $_POST[ '_um_rowcols_' . $row_id . '_cols' ] );
|
76 |
+
}
|
77 |
+
|
78 |
+
$row_array = array(
|
79 |
+
'type' => 'row',
|
80 |
+
'id' => sanitize_key( $value ),
|
81 |
+
'sub_rows' => absint( $_POST[ '_um_rowsub_' . $row_id . '_rows' ] ),
|
82 |
+
'cols' => $cols,
|
83 |
+
'origin' => sanitize_key( $_POST[ '_um_roworigin_' . $row_id . '_val' ] ),
|
84 |
+
);
|
85 |
+
|
86 |
+
$row_args = $row_array;
|
87 |
+
|
88 |
+
if ( isset( $this->row_data[ $row_array['origin'] ] ) ) {
|
89 |
+
foreach ( $this->row_data[ $row_array['origin'] ] as $k => $v ) {
|
90 |
+
if ( 'position' !== $k && 'metakey' !== $k ) {
|
91 |
+
$update_args[ $k ] = $v;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
if ( isset( $update_args ) ) {
|
95 |
+
$row_args = array_merge( $update_args, $row_array );
|
96 |
+
}
|
97 |
+
$this->exist_rows[] = $key;
|
98 |
+
}
|
99 |
+
|
100 |
+
$fields[ $key ] = $row_args;
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
// change field position
|
105 |
+
if ( 0 === strpos( $key, 'um_position_' ) ) {
|
106 |
+
$field_key = str_replace( 'um_position_', '', $key );
|
107 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
108 |
+
$fields[ $field_key ]['position'] = absint( $value );
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
// change field master row
|
113 |
+
if ( 0 === strpos( $key, 'um_row_' ) ) {
|
114 |
+
$field_key = str_replace( 'um_row_', '', $key );
|
115 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
116 |
+
$fields[ $field_key ]['in_row'] = sanitize_key( $value );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
// change field sub row
|
121 |
+
if ( 0 === strpos( $key, 'um_subrow_' ) ) {
|
122 |
+
$field_key = str_replace( 'um_subrow_', '', $key );
|
123 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
124 |
+
$fields[ $field_key ]['in_sub_row'] = sanitize_key( $value );
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
// change field column
|
129 |
+
if ( 0 === strpos( $key, 'um_col_' ) ) {
|
130 |
+
$field_key = str_replace( 'um_col_', '', $key );
|
131 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
132 |
+
$fields[ $field_key ]['in_column'] = absint( $value );
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
// add field to group
|
137 |
+
if ( 0 === strpos( $key, 'um_group_' ) ) {
|
138 |
+
$field_key = str_replace( 'um_group_', '', $key );
|
139 |
+
if ( isset( $fields[ $field_key ] ) ) {
|
140 |
+
$fields[ $field_key ]['in_group'] = ! empty( $value ) ? absint( $value ) : '';
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
foreach ( $this->row_data as $k => $v ) {
|
146 |
+
if ( ! in_array( $k, $this->exist_rows, true ) ) {
|
147 |
+
unset( $this->row_data[ $k ] );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
update_option( 'um_existing_rows_' . $form_id, $this->exist_rows );
|
152 |
+
|
153 |
+
update_option( 'um_form_rowdata_' . $form_id, $this->row_data );
|
154 |
+
|
155 |
+
UM()->query()->update_attr( 'custom_fields', $form_id, $fields );
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Load form to maintain form order
|
162 |
+
*/
|
163 |
+
public function load_field_order() {
|
164 |
+
|
165 |
+
$screen = get_current_screen();
|
166 |
+
|
167 |
+
if ( ! isset( $screen->id ) || 'um_form' !== $screen->id ) {
|
168 |
+
return;
|
169 |
+
} ?>
|
170 |
+
|
171 |
+
<div class="um-col-demon-settings" data-in_row="" data-in_sub_row="" data-in_column="" data-in_group=""></div>
|
172 |
+
|
173 |
+
<div class="um-col-demon-row" style="display:none;">
|
174 |
+
|
175 |
+
<div class="um-admin-drag-row-icons">
|
176 |
+
<a href="javascript:void(0);" class="um-admin-drag-rowsub-add um-admin-tipsy-n" title="<?php esc_attr_e( 'Add Row', 'ultimate-member' ); ?>" data-row_action="add_subrow"><i class="um-icon-plus"></i></a>
|
177 |
+
<a href="javascript:void(0);" class="um-admin-drag-row-edit um-admin-tipsy-n" title="<?php esc_attr_e( 'Edit Row', 'ultimate-member' ); ?>" data-modal="UM_edit_row" data-modal-size="normal" data-dynamic-content="um_admin_edit_field_popup" data-arg1="row" data-arg2="<?php echo esc_attr( get_the_ID() ); ?>"><i class="um-faicon-pencil"></i></a>
|
178 |
+
<span class="um-admin-drag-row-start"><i class="um-icon-arrow-move"></i></span>
|
179 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-row"><i class="um-faicon-trash-o"></i></a>
|
180 |
+
</div>
|
181 |
+
<div class="um-admin-clear"></div>
|
182 |
+
|
183 |
+
<div class="um-admin-drag-rowsubs">
|
184 |
+
<div class="um-admin-drag-rowsub">
|
185 |
+
|
186 |
+
<div class="um-admin-drag-ctrls columns">
|
187 |
+
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
188 |
+
<a href="javascript:void(0);" data-cols="2"></a>
|
189 |
+
<a href="javascript:void(0);" data-cols="3"></a>
|
190 |
+
</div>
|
191 |
+
|
192 |
+
<div class="um-admin-drag-rowsub-icons">
|
193 |
+
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
194 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
|
195 |
+
</div><div class="um-admin-clear"></div>
|
196 |
+
|
197 |
+
<div class="um-admin-drag-col">
|
198 |
+
</div>
|
199 |
+
|
200 |
+
<div class="um-admin-drag-col-dynamic"></div>
|
201 |
+
|
202 |
+
<div class="um-admin-clear"></div>
|
203 |
+
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
</div>
|
208 |
+
|
209 |
+
<div class="um-col-demon-subrow" style="display:none;">
|
210 |
+
|
211 |
+
<div class="um-admin-drag-ctrls columns">
|
212 |
+
<a href="javascript:void(0);" class="active" data-cols="1"></a>
|
213 |
+
<a href="javascript:void(0);" data-cols="2"></a>
|
214 |
+
<a href="javascript:void(0);" data-cols="3"></a>
|
215 |
+
</div>
|
216 |
+
|
217 |
+
<div class="um-admin-drag-rowsub-icons">
|
218 |
+
<span class="um-admin-drag-rowsub-start"><i class="um-icon-arrow-move"></i></span>
|
219 |
+
<a href="javascript:void(0);" class="um-admin-tipsy-n" title="<?php esc_attr_e( 'Delete Row', 'ultimate-member' ); ?>" data-remove_element="um-admin-drag-rowsub"><i class="um-faicon-trash-o"></i></a>
|
220 |
+
</div><div class="um-admin-clear"></div>
|
221 |
+
|
222 |
+
<div class="um-admin-drag-col">
|
223 |
+
</div>
|
224 |
+
|
225 |
+
<div class="um-admin-drag-col-dynamic"></div>
|
226 |
+
|
227 |
+
<div class="um-admin-clear"></div>
|
228 |
+
|
229 |
+
</div>
|
230 |
+
|
231 |
+
|
232 |
+
<form action="" method="post" class="um_update_order">
|
233 |
+
|
234 |
+
<input type="hidden" name="form_id" id="form_id" value="<?php echo esc_attr( get_the_ID() ); ?>" />
|
235 |
+
<input type="hidden" name="action" value="um_update_order" />
|
236 |
+
<input type="hidden" name="nonce" value="<?php echo esc_attr( wp_create_nonce( 'um-admin-nonce' ) ) ?>" />
|
237 |
+
|
238 |
+
<div class="um_update_order_fields">
|
239 |
+
|
240 |
+
</div>
|
241 |
+
|
242 |
+
</form>
|
243 |
+
|
244 |
+
<?php
|
245 |
+
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
249 |
+
}
|
includes/admin/core/class-admin-metabox.php
CHANGED
@@ -1,2437 +1,2427 @@
|
|
1 |
-
<?php
|
2 |
-
namespace um\admin\core;
|
3 |
-
|
4 |
-
|
5 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
-
|
7 |
-
|
8 |
-
if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Class Admin_Metabox
|
13 |
-
*
|
14 |
-
* @package um\admin\core
|
15 |
-
*/
|
16 |
-
class Admin_Metabox {
|
17 |
-
|
18 |
-
|
19 |
-
/**
|
20 |
-
* @var bool
|
21 |
-
*/
|
22 |
-
private $form_nonce_added = false;
|
23 |
-
|
24 |
-
|
25 |
-
/**
|
26 |
-
* @var bool
|
27 |
-
*/
|
28 |
-
private $directory_nonce_added = false;
|
29 |
-
|
30 |
-
|
31 |
-
/**
|
32 |
-
* @var bool
|
33 |
-
*/
|
34 |
-
private $custom_nonce_added = false;
|
35 |
-
|
36 |
-
|
37 |
-
var $init_icon = false;
|
38 |
-
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Admin_Metabox constructor.
|
42 |
-
*/
|
43 |
-
function __construct() {
|
44 |
-
$this->in_edit = false;
|
45 |
-
$this->edit_mode_value = null;
|
46 |
-
$this->edit_array = [];
|
47 |
-
|
48 |
-
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
|
49 |
-
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 );
|
50 |
-
|
51 |
-
add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 );
|
52 |
-
add_action( 'load-post-new.php', array( &$this, 'add_metabox' ), 9 );
|
53 |
-
|
54 |
-
add_action( 'admin_init', array( &$this, 'add_taxonomy_metabox' ), 9 );
|
55 |
-
|
56 |
-
//roles metaboxes
|
57 |
-
add_action( 'um_roles_add_meta_boxes', array( &$this, 'add_metabox_role' ) );
|
58 |
-
|
59 |
-
add_filter( 'um_builtin_validation_types_continue_loop', array( &$this, 'validation_types_continue_loop' ), 1, 4 );
|
60 |
-
add_filter( 'um_restrict_content_hide_metabox', array( &$this, 'hide_metabox_restrict_content_shop' ), 10, 1 );
|
61 |
-
|
62 |
-
add_filter( 'um_member_directory_meta_value_before_save', array( UM()->member_directory(), 'before_save_data' ), 10, 3 );
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Hide Woocommerce Shop page restrict content metabox
|
68 |
-
* @param $hide
|
69 |
-
*
|
70 |
-
* @return bool
|
71 |
-
*/
|
72 |
-
function hide_metabox_restrict_content_shop( $hide ) {
|
73 |
-
if ( function_exists( 'wc_get_page_id' ) && ! empty( $_GET['post'] ) &&
|
74 |
-
absint( $_GET['post'] ) == wc_get_page_id( 'shop' ) ) {
|
75 |
-
return true;
|
76 |
-
}
|
77 |
-
|
78 |
-
return $hide;
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Filter validation types on loop
|
84 |
-
*
|
85 |
-
* @param $break
|
86 |
-
* @param $key
|
87 |
-
* @param $form_id
|
88 |
-
* @param $field_array
|
89 |
-
*
|
90 |
-
* @return bool
|
91 |
-
*/
|
92 |
-
function validation_types_continue_loop( $break, $key, $form_id, $field_array ) {
|
93 |
-
|
94 |
-
// show unique username validation only for user_login field
|
95 |
-
if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ) {
|
96 |
-
return false;
|
97 |
-
}
|
98 |
-
|
99 |
-
return $break;
|
100 |
-
}
|
101 |
-
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Gets the role meta
|
105 |
-
*
|
106 |
-
* @param $id
|
107 |
-
*
|
108 |
-
* @return mixed
|
109 |
-
*/
|
110 |
-
function get_custom_post_meta( $id ) {
|
111 |
-
$all_meta = get_post_custom( $id );
|
112 |
-
foreach ( $all_meta as $k => $v ) {
|
113 |
-
if ( strstr( $k, '_um_' ) ) {
|
114 |
-
$um_meta[ $k ] = $v;
|
115 |
-
}
|
116 |
-
}
|
117 |
-
if ( isset( $um_meta ) ) {
|
118 |
-
return $um_meta;
|
119 |
-
}
|
120 |
-
|
121 |
-
return false;
|
122 |
-
}
|
123 |
-
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Runs on admin head
|
127 |
-
*/
|
128 |
-
function admin_head(){
|
129 |
-
global $post;
|
130 |
-
if ( UM()->admin()->is_plugin_post_type() && isset($post->ID) ){
|
131 |
-
$this->postmeta = $this->get_custom_post_meta($post->ID);
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Init the metaboxes
|
138 |
-
*/
|
139 |
-
function add_metabox() {
|
140 |
-
global $current_screen;
|
141 |
-
|
142 |
-
if ( $current_screen->id == 'um_form' ) {
|
143 |
-
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_form'), 1 );
|
144 |
-
add_action( 'save_post', array(&$this, 'save_metabox_form'), 10, 2 );
|
145 |
-
}
|
146 |
-
|
147 |
-
if ( $current_screen->id == 'um_directory' ) {
|
148 |
-
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_directory'), 1 );
|
149 |
-
add_action( 'save_post', array(&$this, 'save_metabox_directory'), 10, 2 );
|
150 |
-
}
|
151 |
-
|
152 |
-
//restrict content metabox
|
153 |
-
$post_types = UM()->options()->get( 'restricted_access_post_metabox' );
|
154 |
-
if ( ! empty( $post_types[ $current_screen->id ] ) ) {
|
155 |
-
|
156 |
-
/**
|
157 |
-
* UM hook
|
158 |
-
*
|
159 |
-
* @type filter
|
160 |
-
* @title um_restrict_content_hide_metabox
|
161 |
-
* @description Show/Hide Restrict content metabox
|
162 |
-
* @input_vars
|
163 |
-
* [{"var":"$show","type":"bool","desc":"Show Metabox"}]
|
164 |
-
* @change_log
|
165 |
-
* ["Since: 2.0"]
|
166 |
-
* @usage add_filter( 'um_restrict_content_hide_metabox', 'function_name', 10, 1 );
|
167 |
-
* @example
|
168 |
-
* <?php
|
169 |
-
* add_filter( 'um_restrict_content_hide_metabox', 'my_restrict_content_hide_metabox', 10, 1 );
|
170 |
-
* function my_restrict_content_hide_metabox( $show ) {
|
171 |
-
* // your code here
|
172 |
-
* return $show;
|
173 |
-
* }
|
174 |
-
* ?>
|
175 |
-
*/
|
176 |
-
$hide_metabox = apply_filters( 'um_restrict_content_hide_metabox', false );
|
177 |
-
|
178 |
-
if ( ! $hide_metabox ) {
|
179 |
-
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_restrict_content'), 1 );
|
180 |
-
add_action( 'save_post', array( &$this, 'save_metabox_restrict_content' ), 10, 2 );
|
181 |
-
}
|
182 |
-
|
183 |
-
if ( $current_screen->id == 'attachment' ) {
|
184 |
-
add_action( 'add_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
185 |
-
add_action( 'edit_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
186 |
-
}
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
add_action( 'save_post', array( &$this, 'save_metabox_custom' ), 10, 2 );
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
/**
|
195 |
-
* @param $post_id
|
196 |
-
* @param $post
|
197 |
-
*/
|
198 |
-
public function save_metabox_custom( $post_id, $post ) {
|
199 |
-
// validate nonce
|
200 |
-
if ( ! isset( $_POST['um_admin_save_metabox_custom_nonce'] ) ||
|
201 |
-
! wp_verify_nonce( $_POST['um_admin_save_metabox_custom_nonce'], basename( __FILE__ ) ) ) {
|
202 |
-
return;
|
203 |
-
}
|
204 |
-
|
205 |
-
/**
|
206 |
-
* UM hook
|
207 |
-
*
|
208 |
-
* @type action
|
209 |
-
* @title um_admin_custom_restrict_content_metaboxes
|
210 |
-
* @description Save metabox custom with restrict content
|
211 |
-
* @input_vars
|
212 |
-
* [{"var":"$post_id","type":"int","desc":"Post ID"},
|
213 |
-
* {"var":"$post","type":"array","desc":"Post data"}]
|
214 |
-
* @change_log
|
215 |
-
* ["Since: 2.0"]
|
216 |
-
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10, 2 );
|
217 |
-
* @example
|
218 |
-
* <?php
|
219 |
-
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10, 2 );
|
220 |
-
* function my_admin_custom_restrict_content( $post_id, $post ) {
|
221 |
-
* // your code here
|
222 |
-
* }
|
223 |
-
* ?>
|
224 |
-
*/
|
225 |
-
do_action( 'um_admin_custom_restrict_content_metaboxes', $post_id, $post );
|
226 |
-
}
|
227 |
-
|
228 |
-
|
229 |
-
/**
|
230 |
-
*
|
231 |
-
*/
|
232 |
-
function add_metabox_restrict_content() {
|
233 |
-
global $current_screen;
|
234 |
-
|
235 |
-
add_meta_box(
|
236 |
-
'um-admin-restrict-content',
|
237 |
-
__( '
|
238 |
-
array( &$this, 'restrict_content_cb' ),
|
239 |
-
$current_screen->id,
|
240 |
-
'normal',
|
241 |
-
'default'
|
242 |
-
);
|
243 |
-
|
244 |
-
/**
|
245 |
-
* UM hook
|
246 |
-
*
|
247 |
-
* @type action
|
248 |
-
* @title um_admin_custom_restrict_content_metaboxes
|
249 |
-
* @description Add restrict content custom metabox
|
250 |
-
* @change_log
|
251 |
-
* ["Since: 2.0"]
|
252 |
-
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10 );
|
253 |
-
* @example
|
254 |
-
* <?php
|
255 |
-
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10 );
|
256 |
-
* function my_admin_custom_restrict_content() {
|
257 |
-
* // your code here
|
258 |
-
* }
|
259 |
-
* ?>
|
260 |
-
*/
|
261 |
-
do_action( 'um_admin_custom_restrict_content_metaboxes' );
|
262 |
-
}
|
263 |
-
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Content restriction metabox
|
267 |
-
*
|
268 |
-
* @param $object
|
269 |
-
* @param $box
|
270 |
-
*/
|
271 |
-
function restrict_content_cb( $object, $box ) {
|
272 |
-
include_once UM()->admin()->templates_path . 'access/restrict_content.php';
|
273 |
-
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_restrict_content_nonce' );
|
274 |
-
}
|
275 |
-
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Init the metaboxes
|
279 |
-
*/
|
280 |
-
function add_taxonomy_metabox() {
|
281 |
-
//restrict content metabox
|
282 |
-
$all_taxonomies = get_taxonomies( array( 'public' => true ) );
|
283 |
-
$tax_types = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
284 |
-
$exclude_taxonomies = UM()->excluded_taxonomies();
|
285 |
-
|
286 |
-
foreach ( $all_taxonomies as $key => $taxonomy ) {
|
287 |
-
if ( in_array( $key, $exclude_taxonomies ) || empty( $tax_types[$key] ) )
|
288 |
-
continue;
|
289 |
-
|
290 |
-
add_action( $taxonomy . '_add_form_fields', array( &$this, 'um_category_access_fields_create' ) );
|
291 |
-
add_action( $taxonomy . '_edit_form_fields', array( &$this, 'um_category_access_fields_edit' ) );
|
292 |
-
add_action( 'create_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
|
293 |
-
add_action( 'edited_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
|
294 |
-
}
|
295 |
-
}
|
296 |
-
|
297 |
-
|
298 |
-
/**
|
299 |
-
* @param $post_id
|
300 |
-
* @param $post
|
301 |
-
*/
|
302 |
-
function save_metabox_restrict_content( $post_id, $post ) {
|
303 |
-
// validate nonce
|
304 |
-
if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] ) ||
|
305 |
-
! wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
306 |
-
return;
|
307 |
-
}
|
308 |
-
|
309 |
-
// validate user
|
310 |
-
$post_type = get_post_type_object( $post->post_type );
|
311 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
312 |
-
return;
|
313 |
-
}
|
314 |
-
|
315 |
-
if ( ! empty( $_POST['um_content_restriction'] ) && is_array( $_POST['um_content_restriction'] ) ) {
|
316 |
-
$restriction_meta = UM()->admin()->sanitize_post_restriction_meta( $_POST['um_content_restriction'] );
|
317 |
-
|
318 |
-
update_post_meta( $post_id, 'um_content_restriction', $restriction_meta );
|
319 |
-
} else {
|
320 |
-
delete_post_meta( $post_id, 'um_content_restriction' );
|
321 |
-
}
|
322 |
-
}
|
323 |
-
|
324 |
-
|
325 |
-
/**
|
326 |
-
* @param $post_id
|
327 |
-
*
|
328 |
-
*/
|
329 |
-
function save_attachment_metabox_restrict_content( $post_id ) {
|
330 |
-
// validate nonce
|
331 |
-
if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] )
|
332 |
-
|| ! wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
333 |
-
return;
|
334 |
-
}
|
335 |
-
|
336 |
-
$post = get_post( $post_id );
|
337 |
-
|
338 |
-
// validate user
|
339 |
-
$post_type = get_post_type_object( $post->post_type );
|
340 |
-
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
341 |
-
return;
|
342 |
-
}
|
343 |
-
|
344 |
-
if ( ! empty( $_POST['um_content_restriction'] ) && is_array( $_POST['um_content_restriction'] ) ) {
|
345 |
-
$restriction_meta = UM()->admin()->sanitize_post_restriction_meta( $_POST['um_content_restriction'] );
|
346 |
-
|
347 |
-
update_post_meta( $post_id, 'um_content_restriction', $restriction_meta );
|
348 |
-
} else {
|
349 |
-
delete_post_meta( $post_id, 'um_content_restriction' );
|
350 |
-
}
|
351 |
-
}
|
352 |
-
|
353 |
-
|
354 |
-
/**
|
355 |
-
*
|
356 |
-
*/
|
357 |
-
function um_category_access_fields_create() {
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
*
|
362 |
-
*
|
363 |
-
* @
|
364 |
-
* @
|
365 |
-
*
|
366 |
-
*
|
367 |
-
*
|
368 |
-
*
|
369 |
-
*
|
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 |
-
|
432 |
-
|
433 |
-
|
434 |
-
'
|
435 |
-
|
436 |
-
|
437 |
-
'
|
438 |
-
|
439 |
-
|
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 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
'
|
470 |
-
|
471 |
-
|
472 |
-
'
|
473 |
-
'
|
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 |
-
* {"var":"$
|
519 |
-
*
|
520 |
-
*
|
521 |
-
*
|
522 |
-
* @
|
523 |
-
*
|
524 |
-
*
|
525 |
-
*
|
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 |
-
'label'
|
604 |
-
'description'
|
605 |
-
'value'
|
606 |
-
'conditional'
|
607 |
-
),
|
608 |
-
array(
|
609 |
-
'id'
|
610 |
-
'type'
|
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 |
-
|
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 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
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 |
-
* $roles_metaboxes
|
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 |
-
|
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 |
-
delete_post_meta( $post_id, '
|
1091 |
-
delete_post_meta( $post_id, '
|
1092 |
-
|
1093 |
-
delete_post_meta( $post_id, '
|
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 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
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 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
if (
|
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 |
-
|
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 |
-
|
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 |
-
|
1399 |
-
case '
|
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 |
-
</p>
|
1450 |
-
|
1451 |
-
<?php
|
1452 |
-
break;
|
1453 |
-
|
1454 |
-
case '
|
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 |
-
|
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 |
-
<?php
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
break;
|
1522 |
-
|
1523 |
-
case '
|
1524 |
-
?>
|
1525 |
-
|
1526 |
-
<p><label for="
|
1527 |
-
<input type="text" name="
|
1528 |
-
</p>
|
1529 |
-
|
1530 |
-
<?php
|
1531 |
-
break;
|
1532 |
-
|
1533 |
-
case '
|
1534 |
-
?>
|
1535 |
-
|
1536 |
-
<p><label for="
|
1537 |
-
<input type="text" name="
|
1538 |
-
</p>
|
1539 |
-
|
1540 |
-
<?php
|
1541 |
-
break;
|
1542 |
-
|
1543 |
-
case '
|
1544 |
-
?>
|
1545 |
-
|
1546 |
-
<p><label for="
|
1547 |
-
<input type="text" name="
|
1548 |
-
</p>
|
1549 |
-
|
1550 |
-
<?php
|
1551 |
-
break;
|
1552 |
-
|
1553 |
-
case '
|
1554 |
-
?>
|
1555 |
-
|
1556 |
-
<p><label for="
|
1557 |
-
<input type="text" name="
|
1558 |
-
</p>
|
1559 |
-
|
1560 |
-
<?php
|
1561 |
-
break;
|
1562 |
-
|
1563 |
-
case '
|
1564 |
-
?>
|
1565 |
-
|
1566 |
-
<p><label for="
|
1567 |
-
<input type="text" name="
|
1568 |
-
</p>
|
1569 |
-
|
1570 |
-
<?php
|
1571 |
-
break;
|
1572 |
-
|
1573 |
-
case '
|
1574 |
-
?>
|
1575 |
-
|
1576 |
-
<p><label for="
|
1577 |
-
<
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
</p>
|
1594 |
-
|
1595 |
-
<?php
|
1596 |
-
break;
|
1597 |
-
|
1598 |
-
case '
|
1599 |
-
?>
|
1600 |
-
|
1601 |
-
<p><label for="
|
1602 |
-
<input type="text" name="
|
1603 |
-
</p>
|
1604 |
-
|
1605 |
-
<?php
|
1606 |
-
break;
|
1607 |
-
|
1608 |
-
case '
|
1609 |
-
?>
|
1610 |
-
|
1611 |
-
<p><label for="
|
1612 |
-
<input type="
|
1613 |
-
</p>
|
1614 |
-
|
1615 |
-
<?php
|
1616 |
-
break;
|
1617 |
-
|
1618 |
-
case '
|
1619 |
-
?>
|
1620 |
-
|
1621 |
-
<p><label for="
|
1622 |
-
<input type="
|
1623 |
-
</p>
|
1624 |
-
|
1625 |
-
<?php
|
1626 |
-
break;
|
1627 |
-
|
1628 |
-
case '
|
1629 |
-
?>
|
1630 |
-
|
1631 |
-
<p
|
1632 |
-
<input type="text" name="
|
1633 |
-
</p>
|
1634 |
-
|
1635 |
-
<?php
|
1636 |
-
break;
|
1637 |
-
|
1638 |
-
case '
|
1639 |
-
?>
|
1640 |
-
|
1641 |
-
<p><label for="
|
1642 |
-
<input type="text" name="
|
1643 |
-
</p>
|
1644 |
-
|
1645 |
-
<?php
|
1646 |
-
break;
|
1647 |
-
|
1648 |
-
case '
|
1649 |
-
?>
|
1650 |
-
|
1651 |
-
<p class="_heading_text"><label for="
|
1652 |
-
<input type="text" name="
|
1653 |
-
</p>
|
1654 |
-
|
1655 |
-
<?php
|
1656 |
-
break;
|
1657 |
-
|
1658 |
-
case '
|
1659 |
-
?>
|
1660 |
-
|
1661 |
-
<p
|
1662 |
-
<input type="text" name="
|
1663 |
-
</p>
|
1664 |
-
|
1665 |
-
<?php
|
1666 |
-
break;
|
1667 |
-
|
1668 |
-
case '
|
1669 |
-
?>
|
1670 |
-
|
1671 |
-
<p><label for="
|
1672 |
-
<input type="text" name="
|
1673 |
-
</p>
|
1674 |
-
|
1675 |
-
<?php
|
1676 |
-
break;
|
1677 |
-
|
1678 |
-
case '
|
1679 |
-
?>
|
1680 |
-
|
1681 |
-
<p
|
1682 |
-
<input type="text" name="
|
1683 |
-
</p>
|
1684 |
-
|
1685 |
-
<?php
|
1686 |
-
break;
|
1687 |
-
|
1688 |
-
case '
|
1689 |
-
?>
|
1690 |
-
|
1691 |
-
<p><label for="
|
1692 |
-
<input type="text" name="
|
1693 |
-
</p>
|
1694 |
-
|
1695 |
-
<?php
|
1696 |
-
break;
|
1697 |
-
|
1698 |
-
case '
|
1699 |
-
?>
|
1700 |
-
|
1701 |
-
<p><label for="
|
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 |
-
</p>
|
1730 |
-
|
1731 |
-
<?php
|
1732 |
-
break;
|
1733 |
-
|
1734 |
-
case '
|
1735 |
-
?>
|
1736 |
-
|
1737 |
-
<p><label for="
|
1738 |
-
<input type="checkbox" name="
|
1739 |
-
</p>
|
1740 |
-
|
1741 |
-
<?php
|
1742 |
-
break;
|
1743 |
-
|
1744 |
-
case '
|
1745 |
-
?>
|
1746 |
-
|
1747 |
-
<p><label for="
|
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 |
-
<option value="
|
1790 |
-
<option value="
|
1791 |
-
<option value="
|
1792 |
-
</select>
|
1793 |
-
</p>
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
break;
|
1808 |
-
|
1809 |
-
case '
|
1810 |
-
?>
|
1811 |
-
|
1812 |
-
<p><label for="
|
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 |
-
</p>
|
1852 |
-
|
1853 |
-
<?php
|
1854 |
-
break;
|
1855 |
-
|
1856 |
-
case '
|
1857 |
-
?>
|
1858 |
-
|
1859 |
-
<p class="_years"><label for="
|
1860 |
-
<
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
</p>
|
1876 |
-
|
1877 |
-
<?php
|
1878 |
-
break;
|
1879 |
-
|
1880 |
-
case '
|
1881 |
-
?>
|
1882 |
-
|
1883 |
-
<p class="_date_range"><label for="
|
1884 |
-
<input type="text" name="
|
1885 |
-
</p>
|
1886 |
-
|
1887 |
-
<?php
|
1888 |
-
break;
|
1889 |
-
|
1890 |
-
case '
|
1891 |
-
?>
|
1892 |
-
|
1893 |
-
<p
|
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 |
-
<?php
|
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 |
-
<?php
|
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 |
-
<p><label for="
|
2007 |
-
<input type="text" name="
|
2008 |
-
</p>
|
2009 |
-
|
2010 |
-
<?php
|
2011 |
-
break;
|
2012 |
-
|
2013 |
-
case '
|
2014 |
-
?>
|
2015 |
-
|
2016 |
-
<p><label for="
|
2017 |
-
<input type="text" name="
|
2018 |
-
</p>
|
2019 |
-
|
2020 |
-
<?php
|
2021 |
-
break;
|
2022 |
-
|
2023 |
-
case '
|
2024 |
-
?>
|
2025 |
-
|
2026 |
-
<p><label for="
|
2027 |
-
<input type="text" name="
|
2028 |
-
</p>
|
2029 |
-
|
2030 |
-
<?php
|
2031 |
-
break;
|
2032 |
-
|
2033 |
-
case '
|
2034 |
-
?>
|
2035 |
-
|
2036 |
-
<p><label for="
|
2037 |
-
<input type="text" name="
|
2038 |
-
</p>
|
2039 |
-
|
2040 |
-
<?php
|
2041 |
-
break;
|
2042 |
-
|
2043 |
-
case '
|
2044 |
-
?>
|
2045 |
-
|
2046 |
-
<p><label for="
|
2047 |
-
<input type="text" name="
|
2048 |
-
</p>
|
2049 |
-
|
2050 |
-
<?php
|
2051 |
-
break;
|
2052 |
-
|
2053 |
-
case '
|
2054 |
-
?>
|
2055 |
-
|
2056 |
-
<p><label for="
|
2057 |
-
<input type="
|
2058 |
-
</p>
|
2059 |
-
|
2060 |
-
<?php
|
2061 |
-
break;
|
2062 |
-
|
2063 |
-
case '
|
2064 |
-
?>
|
2065 |
-
|
2066 |
-
<p><label for="
|
2067 |
-
<input type="
|
2068 |
-
</p>
|
2069 |
-
|
2070 |
-
<?php
|
2071 |
-
break;
|
2072 |
-
|
2073 |
-
case '
|
2074 |
-
?>
|
2075 |
-
|
2076 |
-
<p class="
|
2077 |
-
<input type="text" name="
|
2078 |
-
</p>
|
2079 |
-
|
2080 |
-
<?php
|
2081 |
-
break;
|
2082 |
-
|
2083 |
-
case '
|
2084 |
-
?>
|
2085 |
-
|
2086 |
-
<p class="
|
2087 |
-
<input type="text" name="
|
2088 |
-
</p>
|
2089 |
-
|
2090 |
-
<?php
|
2091 |
-
break;
|
2092 |
-
|
2093 |
-
case '
|
2094 |
-
?>
|
2095 |
-
|
2096 |
-
<p
|
2097 |
-
<input type="text" name="
|
2098 |
-
</p>
|
2099 |
-
|
2100 |
-
<?php
|
2101 |
-
break;
|
2102 |
-
|
2103 |
-
case '
|
2104 |
-
?>
|
2105 |
-
|
2106 |
-
<p><label for="
|
2107 |
-
<input type="text" name="
|
2108 |
-
</p>
|
2109 |
-
|
2110 |
-
<?php
|
2111 |
-
break;
|
2112 |
-
|
2113 |
-
case '
|
2114 |
-
?>
|
2115 |
-
|
2116 |
-
<p><label for="
|
2117 |
-
<input type="text" name="
|
2118 |
-
</p>
|
2119 |
-
|
2120 |
-
<?php
|
2121 |
-
break;
|
2122 |
-
|
2123 |
-
case '
|
2124 |
-
?>
|
2125 |
-
|
2126 |
-
<p><label for="
|
2127 |
-
<input type="text" name="
|
2128 |
-
</p>
|
2129 |
-
|
2130 |
-
<?php
|
2131 |
-
break;
|
2132 |
-
|
2133 |
-
case '
|
2134 |
-
?>
|
2135 |
-
|
2136 |
-
<p><label for="
|
2137 |
-
<input type="text" name="
|
2138 |
-
</p>
|
2139 |
-
|
2140 |
-
<?php
|
2141 |
-
break;
|
2142 |
-
|
2143 |
-
case '
|
2144 |
-
?>
|
2145 |
-
|
2146 |
-
<p><label for="
|
2147 |
-
<input type="
|
2148 |
-
</p>
|
2149 |
-
|
2150 |
-
<?php
|
2151 |
-
break;
|
2152 |
-
|
2153 |
-
case '
|
2154 |
-
|
2155 |
-
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
|
2165 |
-
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
2172 |
-
|
2173 |
-
<p><label for="
|
2174 |
-
<
|
2175 |
-
</p>
|
2176 |
-
|
2177 |
-
<?php
|
2178 |
-
break;
|
2179 |
-
|
2180 |
-
case '
|
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 |
-
<?php
|
2219 |
-
|
2220 |
-
|
2221 |
-
|
2222 |
-
break;
|
2223 |
-
|
2224 |
-
case '
|
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 |
-
<?php
|
2270 |
-
break;
|
2271 |
-
|
2272 |
-
case '
|
2273 |
-
?>
|
2274 |
-
|
2275 |
-
<p><label for="
|
2276 |
-
<input type="text" name="
|
2277 |
-
</p>
|
2278 |
-
|
2279 |
-
<?php
|
2280 |
-
break;
|
2281 |
-
|
2282 |
-
case '
|
2283 |
-
?>
|
2284 |
-
|
2285 |
-
<p><label for="
|
2286 |
-
<input type="text" name="
|
2287 |
-
</p>
|
2288 |
-
|
2289 |
-
<?php
|
2290 |
-
break;
|
2291 |
-
|
2292 |
-
case '
|
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 |
-
</p>
|
2396 |
-
|
2397 |
-
<?php
|
2398 |
-
break;
|
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 |
-
<?php
|
2429 |
-
break;
|
2430 |
-
|
2431 |
-
|
2432 |
-
}
|
2433 |
-
|
2434 |
-
}
|
2435 |
-
|
2436 |
-
}
|
2437 |
-
}
|
1 |
+
<?php
|
2 |
+
namespace um\admin\core;
|
3 |
+
|
4 |
+
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
6 |
+
|
7 |
+
|
8 |
+
if ( ! class_exists( 'um\admin\core\Admin_Metabox' ) ) {
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class Admin_Metabox
|
13 |
+
*
|
14 |
+
* @package um\admin\core
|
15 |
+
*/
|
16 |
+
class Admin_Metabox {
|
17 |
+
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var bool
|
21 |
+
*/
|
22 |
+
private $form_nonce_added = false;
|
23 |
+
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var bool
|
27 |
+
*/
|
28 |
+
private $directory_nonce_added = false;
|
29 |
+
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var bool
|
33 |
+
*/
|
34 |
+
private $custom_nonce_added = false;
|
35 |
+
|
36 |
+
|
37 |
+
var $init_icon = false;
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Admin_Metabox constructor.
|
42 |
+
*/
|
43 |
+
function __construct() {
|
44 |
+
$this->in_edit = false;
|
45 |
+
$this->edit_mode_value = null;
|
46 |
+
$this->edit_array = [];
|
47 |
+
|
48 |
+
add_action( 'admin_head', array( &$this, 'admin_head' ), 9);
|
49 |
+
add_action( 'admin_footer', array( &$this, 'load_modal_content' ), 9 );
|
50 |
+
|
51 |
+
add_action( 'load-post.php', array( &$this, 'add_metabox' ), 9 );
|
52 |
+
add_action( 'load-post-new.php', array( &$this, 'add_metabox' ), 9 );
|
53 |
+
|
54 |
+
add_action( 'admin_init', array( &$this, 'add_taxonomy_metabox' ), 9 );
|
55 |
+
|
56 |
+
//roles metaboxes
|
57 |
+
add_action( 'um_roles_add_meta_boxes', array( &$this, 'add_metabox_role' ) );
|
58 |
+
|
59 |
+
add_filter( 'um_builtin_validation_types_continue_loop', array( &$this, 'validation_types_continue_loop' ), 1, 4 );
|
60 |
+
add_filter( 'um_restrict_content_hide_metabox', array( &$this, 'hide_metabox_restrict_content_shop' ), 10, 1 );
|
61 |
+
|
62 |
+
add_filter( 'um_member_directory_meta_value_before_save', array( UM()->member_directory(), 'before_save_data' ), 10, 3 );
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Hide Woocommerce Shop page restrict content metabox
|
68 |
+
* @param $hide
|
69 |
+
*
|
70 |
+
* @return bool
|
71 |
+
*/
|
72 |
+
function hide_metabox_restrict_content_shop( $hide ) {
|
73 |
+
if ( function_exists( 'wc_get_page_id' ) && ! empty( $_GET['post'] ) &&
|
74 |
+
absint( $_GET['post'] ) == wc_get_page_id( 'shop' ) ) {
|
75 |
+
return true;
|
76 |
+
}
|
77 |
+
|
78 |
+
return $hide;
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Filter validation types on loop
|
84 |
+
*
|
85 |
+
* @param $break
|
86 |
+
* @param $key
|
87 |
+
* @param $form_id
|
88 |
+
* @param $field_array
|
89 |
+
*
|
90 |
+
* @return bool
|
91 |
+
*/
|
92 |
+
function validation_types_continue_loop( $break, $key, $form_id, $field_array ) {
|
93 |
+
|
94 |
+
// show unique username validation only for user_login field
|
95 |
+
if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ) {
|
96 |
+
return false;
|
97 |
+
}
|
98 |
+
|
99 |
+
return $break;
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Gets the role meta
|
105 |
+
*
|
106 |
+
* @param $id
|
107 |
+
*
|
108 |
+
* @return mixed
|
109 |
+
*/
|
110 |
+
function get_custom_post_meta( $id ) {
|
111 |
+
$all_meta = get_post_custom( $id );
|
112 |
+
foreach ( $all_meta as $k => $v ) {
|
113 |
+
if ( strstr( $k, '_um_' ) ) {
|
114 |
+
$um_meta[ $k ] = $v;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
if ( isset( $um_meta ) ) {
|
118 |
+
return $um_meta;
|
119 |
+
}
|
120 |
+
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Runs on admin head
|
127 |
+
*/
|
128 |
+
function admin_head(){
|
129 |
+
global $post;
|
130 |
+
if ( UM()->admin()->is_plugin_post_type() && isset($post->ID) ){
|
131 |
+
$this->postmeta = $this->get_custom_post_meta($post->ID);
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Init the metaboxes
|
138 |
+
*/
|
139 |
+
function add_metabox() {
|
140 |
+
global $current_screen;
|
141 |
+
|
142 |
+
if ( $current_screen->id == 'um_form' ) {
|
143 |
+
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_form'), 1 );
|
144 |
+
add_action( 'save_post', array(&$this, 'save_metabox_form'), 10, 2 );
|
145 |
+
}
|
146 |
+
|
147 |
+
if ( $current_screen->id == 'um_directory' ) {
|
148 |
+
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_directory'), 1 );
|
149 |
+
add_action( 'save_post', array(&$this, 'save_metabox_directory'), 10, 2 );
|
150 |
+
}
|
151 |
+
|
152 |
+
//restrict content metabox
|
153 |
+
$post_types = UM()->options()->get( 'restricted_access_post_metabox' );
|
154 |
+
if ( ! empty( $post_types[ $current_screen->id ] ) ) {
|
155 |
+
|
156 |
+
/**
|
157 |
+
* UM hook
|
158 |
+
*
|
159 |
+
* @type filter
|
160 |
+
* @title um_restrict_content_hide_metabox
|
161 |
+
* @description Show/Hide Restrict content metabox
|
162 |
+
* @input_vars
|
163 |
+
* [{"var":"$show","type":"bool","desc":"Show Metabox"}]
|
164 |
+
* @change_log
|
165 |
+
* ["Since: 2.0"]
|
166 |
+
* @usage add_filter( 'um_restrict_content_hide_metabox', 'function_name', 10, 1 );
|
167 |
+
* @example
|
168 |
+
* <?php
|
169 |
+
* add_filter( 'um_restrict_content_hide_metabox', 'my_restrict_content_hide_metabox', 10, 1 );
|
170 |
+
* function my_restrict_content_hide_metabox( $show ) {
|
171 |
+
* // your code here
|
172 |
+
* return $show;
|
173 |
+
* }
|
174 |
+
* ?>
|
175 |
+
*/
|
176 |
+
$hide_metabox = apply_filters( 'um_restrict_content_hide_metabox', false );
|
177 |
+
|
178 |
+
if ( ! $hide_metabox ) {
|
179 |
+
add_action( 'add_meta_boxes', array(&$this, 'add_metabox_restrict_content'), 1 );
|
180 |
+
add_action( 'save_post', array( &$this, 'save_metabox_restrict_content' ), 10, 2 );
|
181 |
+
}
|
182 |
+
|
183 |
+
if ( $current_screen->id == 'attachment' ) {
|
184 |
+
add_action( 'add_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
185 |
+
add_action( 'edit_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
|
190 |
+
add_action( 'save_post', array( &$this, 'save_metabox_custom' ), 10, 2 );
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
/**
|
195 |
+
* @param $post_id
|
196 |
+
* @param $post
|
197 |
+
*/
|
198 |
+
public function save_metabox_custom( $post_id, $post ) {
|
199 |
+
// validate nonce
|
200 |
+
if ( ! isset( $_POST['um_admin_save_metabox_custom_nonce'] ) ||
|
201 |
+
! wp_verify_nonce( $_POST['um_admin_save_metabox_custom_nonce'], basename( __FILE__ ) ) ) {
|
202 |
+
return;
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* UM hook
|
207 |
+
*
|
208 |
+
* @type action
|
209 |
+
* @title um_admin_custom_restrict_content_metaboxes
|
210 |
+
* @description Save metabox custom with restrict content
|
211 |
+
* @input_vars
|
212 |
+
* [{"var":"$post_id","type":"int","desc":"Post ID"},
|
213 |
+
* {"var":"$post","type":"array","desc":"Post data"}]
|
214 |
+
* @change_log
|
215 |
+
* ["Since: 2.0"]
|
216 |
+
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10, 2 );
|
217 |
+
* @example
|
218 |
+
* <?php
|
219 |
+
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10, 2 );
|
220 |
+
* function my_admin_custom_restrict_content( $post_id, $post ) {
|
221 |
+
* // your code here
|
222 |
+
* }
|
223 |
+
* ?>
|
224 |
+
*/
|
225 |
+
do_action( 'um_admin_custom_restrict_content_metaboxes', $post_id, $post );
|
226 |
+
}
|
227 |
+
|
228 |
+
|
229 |
+
/**
|
230 |
+
*
|
231 |
+
*/
|
232 |
+
function add_metabox_restrict_content() {
|
233 |
+
global $current_screen;
|
234 |
+
|
235 |
+
add_meta_box(
|
236 |
+
'um-admin-restrict-content',
|
237 |
+
__( 'Ultimate Member: Content Restriction', 'ultimate-member' ),
|
238 |
+
array( &$this, 'restrict_content_cb' ),
|
239 |
+
$current_screen->id,
|
240 |
+
'normal',
|
241 |
+
'default'
|
242 |
+
);
|
243 |
+
|
244 |
+
/**
|
245 |
+
* UM hook
|
246 |
+
*
|
247 |
+
* @type action
|
248 |
+
* @title um_admin_custom_restrict_content_metaboxes
|
249 |
+
* @description Add restrict content custom metabox
|
250 |
+
* @change_log
|
251 |
+
* ["Since: 2.0"]
|
252 |
+
* @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10 );
|
253 |
+
* @example
|
254 |
+
* <?php
|
255 |
+
* add_action( 'um_admin_custom_restrict_content_metaboxes', 'my_admin_custom_restrict_content', 10 );
|
256 |
+
* function my_admin_custom_restrict_content() {
|
257 |
+
* // your code here
|
258 |
+
* }
|
259 |
+
* ?>
|
260 |
+
*/
|
261 |
+
do_action( 'um_admin_custom_restrict_content_metaboxes' );
|
262 |
+
}
|
263 |
+
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Content restriction metabox
|
267 |
+
*
|
268 |
+
* @param $object
|
269 |
+
* @param $box
|
270 |
+
*/
|
271 |
+
function restrict_content_cb( $object, $box ) {
|
272 |
+
include_once UM()->admin()->templates_path . 'access/restrict_content.php';
|
273 |
+
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_restrict_content_nonce' );
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Init the metaboxes
|
279 |
+
*/
|
280 |
+
function add_taxonomy_metabox() {
|
281 |
+
//restrict content metabox
|
282 |
+
$all_taxonomies = get_taxonomies( array( 'public' => true ) );
|
283 |
+
$tax_types = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
|
284 |
+
$exclude_taxonomies = UM()->excluded_taxonomies();
|
285 |
+
|
286 |
+
foreach ( $all_taxonomies as $key => $taxonomy ) {
|
287 |
+
if ( in_array( $key, $exclude_taxonomies ) || empty( $tax_types[$key] ) )
|
288 |
+
continue;
|
289 |
+
|
290 |
+
add_action( $taxonomy . '_add_form_fields', array( &$this, 'um_category_access_fields_create' ) );
|
291 |
+
add_action( $taxonomy . '_edit_form_fields', array( &$this, 'um_category_access_fields_edit' ) );
|
292 |
+
add_action( 'create_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
|
293 |
+
add_action( 'edited_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
|
298 |
+
/**
|
299 |
+
* @param $post_id
|
300 |
+
* @param $post
|
301 |
+
*/
|
302 |
+
function save_metabox_restrict_content( $post_id, $post ) {
|
303 |
+
// validate nonce
|
304 |
+
if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] ) ||
|
305 |
+
! wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
306 |
+
return;
|
307 |
+
}
|
308 |
+
|
309 |
+
// validate user
|
310 |
+
$post_type = get_post_type_object( $post->post_type );
|
311 |
+
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
312 |
+
return;
|
313 |
+
}
|
314 |
+
|
315 |
+
if ( ! empty( $_POST['um_content_restriction'] ) && is_array( $_POST['um_content_restriction'] ) ) {
|
316 |
+
$restriction_meta = UM()->admin()->sanitize_post_restriction_meta( $_POST['um_content_restriction'] );
|
317 |
+
|
318 |
+
update_post_meta( $post_id, 'um_content_restriction', $restriction_meta );
|
319 |
+
} else {
|
320 |
+
delete_post_meta( $post_id, 'um_content_restriction' );
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
|
325 |
+
/**
|
326 |
+
* @param $post_id
|
327 |
+
*
|
328 |
+
*/
|
329 |
+
function save_attachment_metabox_restrict_content( $post_id ) {
|
330 |
+
// validate nonce
|
331 |
+
if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] )
|
332 |
+
|| ! wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
333 |
+
return;
|
334 |
+
}
|
335 |
+
|
336 |
+
$post = get_post( $post_id );
|
337 |
+
|
338 |
+
// validate user
|
339 |
+
$post_type = get_post_type_object( $post->post_type );
|
340 |
+
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
341 |
+
return;
|
342 |
+
}
|
343 |
+
|
344 |
+
if ( ! empty( $_POST['um_content_restriction'] ) && is_array( $_POST['um_content_restriction'] ) ) {
|
345 |
+
$restriction_meta = UM()->admin()->sanitize_post_restriction_meta( $_POST['um_content_restriction'] );
|
346 |
+
|
347 |
+
update_post_meta( $post_id, 'um_content_restriction', $restriction_meta );
|
348 |
+
} else {
|
349 |
+
delete_post_meta( $post_id, 'um_content_restriction' );
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
|
354 |
+
/**
|
355 |
+
*
|
356 |
+
*/
|
357 |
+
function um_category_access_fields_create() {
|
358 |
+
/**
|
359 |
+
* UM hook
|
360 |
+
*
|
361 |
+
* @type filter
|
362 |
+
* @title um_admin_category_access_settings_fields
|
363 |
+
* @description Settings fields for terms
|
364 |
+
* @input_vars
|
365 |
+
* [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
|
366 |
+
* {"var":"$data","type":"array","desc":"Settings Data"},
|
367 |
+
* {"var":"$screen","type":"string","desc":"Category Screen"}]
|
368 |
+
* @change_log
|
369 |
+
* ["Since: 2.0"]
|
370 |
+
* @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
|
371 |
+
* @example
|
372 |
+
* <?php
|
373 |
+
* add_filter( 'um_admin_category_access_settings_fields', 'my_admin_category_access_settings_fields', 10, 3 );
|
374 |
+
* function my_admin_category_access_settings_fields( $access_settings_fields, $data, $screen ) {
|
375 |
+
* // your code here
|
376 |
+
* $access_settings_fields[] = array(
|
377 |
+
* 'id' => 'my-field-key',
|
378 |
+
* 'type' => 'my-field-type',
|
379 |
+
* 'label' => __( 'My field Label', 'ultimate-member' ),
|
380 |
+
* 'description' => __( 'My Field Description', 'ultimate-member' ),
|
381 |
+
* 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
382 |
+
* );
|
383 |
+
* return $access_settings_fields;
|
384 |
+
* }
|
385 |
+
* ?>
|
386 |
+
*/
|
387 |
+
$fields = apply_filters( 'um_admin_category_access_settings_fields', array(
|
388 |
+
array(
|
389 |
+
'id' => '_um_custom_access_settings',
|
390 |
+
'type' => 'checkbox',
|
391 |
+
'label' => __( 'Restrict access to this term and its posts?', 'ultimate-member' ),
|
392 |
+
'description' => __( 'Activate content restriction for this term and its posts. Affects only posts that do not have individual Restriction Content settings', 'ultimate-member' ),
|
393 |
+
'value' => 0,
|
394 |
+
),
|
395 |
+
array(
|
396 |
+
'id' => '_um_accessible',
|
397 |
+
'type' => 'select',
|
398 |
+
'label' => __( 'Who can access this term and its posts?', 'ultimate-member' ),
|
399 |
+
'value' => '0',
|
400 |
+
'options' => array(
|
401 |
+
'0' => __( 'Everyone', 'ultimate-member' ),
|
402 |
+
'1' => __( 'Logged out users', 'ultimate-member' ),
|
403 |
+
'2' => __( 'Logged in users', 'ultimate-member' ),
|
404 |
+
),
|
405 |
+
'conditional' => array( '_um_custom_access_settings', '=', '1' ),
|
406 |
+
),
|
407 |
+
array(
|
408 |
+
'id' => '_um_access_roles',
|
409 |
+
'type' => 'multi_checkbox',
|
410 |
+
'label' => __( 'Select which roles can access this term and its posts', 'ultimate-member' ),
|
411 |
+
'description' => __( 'Leave empty if you want to display a term for all logged in users', 'ultimate-member' ),
|
412 |
+
'options' => UM()->roles()->get_roles( false ),
|
413 |
+
'columns' => 3,
|
414 |
+
'conditional' => array( '_um_accessible', '=', '2' ),
|
415 |
+
),
|
416 |
+
array(
|
417 |
+
'id' => '_um_access_hide_from_queries',
|
418 |
+
'type' => 'checkbox',
|
419 |
+
'label' => __( 'Would you like to display 404 error on the term\'s archive page and terms\' posts single pages when users haven\'t access?', 'ultimate-member' ),
|
420 |
+
'description' => __( 'Recommended to be enabled. Restricted term\'s archive page and all terms\' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
|
421 |
+
'value' => 1,
|
422 |
+
'conditional' => array( '_um_accessible', '!=', '0' ),
|
423 |
+
),
|
424 |
+
array(
|
425 |
+
'id' => '_um_noaccess_action',
|
426 |
+
'type' => 'select',
|
427 |
+
'label' => __( 'What happens when users without access try to view the term\'s post?', 'ultimate-member' ),
|
428 |
+
'description' => __( 'Action when users without access tries to view the term\'s post', 'ultimate-member' ),
|
429 |
+
'value' => '0',
|
430 |
+
'options' => array(
|
431 |
+
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
432 |
+
'1' => __( 'Redirect user', 'ultimate-member' ),
|
433 |
+
),
|
434 |
+
'conditional' => array( '_um_access_hide_from_queries', '=', '0' ),
|
435 |
+
),
|
436 |
+
array(
|
437 |
+
'id' => '_um_restrict_by_custom_message',
|
438 |
+
'type' => 'select',
|
439 |
+
'label' => __( 'Restricted access message type', 'ultimate-member' ),
|
440 |
+
'description' => __( 'Would you like to use the global default message or apply a custom message to this term\'s post?', 'ultimate-member' ),
|
441 |
+
'value' => '0',
|
442 |
+
'options' => array(
|
443 |
+
'0' => __( 'Global default message', 'ultimate-member' ),
|
444 |
+
'1' => __( 'Custom message', 'ultimate-member' ),
|
445 |
+
),
|
446 |
+
'conditional' => array( '_um_noaccess_action', '=', '0' ),
|
447 |
+
),
|
448 |
+
array(
|
449 |
+
'id' => '_um_restrict_custom_message',
|
450 |
+
'type' => 'wp_editor',
|
451 |
+
'label' => __( 'Custom restricted access message', 'ultimate-member' ),
|
452 |
+
'description' => __( 'You may replace global restricted access message here', 'ultimate-member' ),
|
453 |
+
'value' => '',
|
454 |
+
'conditional' => array( '_um_restrict_by_custom_message', '=', '1' ),
|
455 |
+
),
|
456 |
+
array(
|
457 |
+
'id' => '_um_access_redirect',
|
458 |
+
'type' => 'select',
|
459 |
+
'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
|
460 |
+
'description' => __( 'Select redirect to page when user hasn\'t access to the term\'s post', 'ultimate-member' ),
|
461 |
+
'value' => '0',
|
462 |
+
'conditional' => array( '_um_noaccess_action', '=', '1' ),
|
463 |
+
'options' => array(
|
464 |
+
'0' => __( 'Login page', 'ultimate-member' ),
|
465 |
+
'1' => __( 'Custom URL', 'ultimate-member' ),
|
466 |
+
),
|
467 |
+
),
|
468 |
+
array(
|
469 |
+
'id' => '_um_access_redirect_url',
|
470 |
+
'type' => 'text',
|
471 |
+
'label' => __( 'Redirect URL', 'ultimate-member' ),
|
472 |
+
'description' => __( 'Set full URL where do you want to redirect the user', 'ultimate-member' ),
|
473 |
+
'value' => '',
|
474 |
+
'conditional' => array( '_um_access_redirect', '=', '1' ),
|
475 |
+
),
|
476 |
+
), array(), 'create' );
|
477 |
+
|
478 |
+
UM()->admin_forms(
|
479 |
+
array(
|
480 |
+
'class' => 'um-restrict-content um-third-column',
|
481 |
+
'prefix_id' => 'um_content_restriction',
|
482 |
+
'without_wrapper' => true,
|
483 |
+
'div_line' => true,
|
484 |
+
'fields' => $fields,
|
485 |
+
)
|
486 |
+
)->render_form();
|
487 |
+
|
488 |
+
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
|
489 |
+
}
|
490 |
+
|
491 |
+
|
492 |
+
/**
|
493 |
+
* @param $term
|
494 |
+
*/
|
495 |
+
function um_category_access_fields_edit( $term ) {
|
496 |
+
$termID = $term->term_id;
|
497 |
+
|
498 |
+
$data = get_term_meta( $termID, 'um_content_restriction', true );
|
499 |
+
|
500 |
+
$_um_access_roles_value = array();
|
501 |
+
if ( ! empty( $data['_um_access_roles'] ) ) {
|
502 |
+
foreach ( $data['_um_access_roles'] as $key => $value ) {
|
503 |
+
if ( $value ) {
|
504 |
+
$_um_access_roles_value[] = $key;
|
505 |
+
}
|
506 |
+
}
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* UM hook
|
511 |
+
*
|
512 |
+
* @type filter
|
513 |
+
* @title um_admin_category_access_settings_fields
|
514 |
+
* @description Settings fields for terms
|
515 |
+
* @input_vars
|
516 |
+
* [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
|
517 |
+
* {"var":"$data","type":"array","desc":"Settings Data"},
|
518 |
+
* {"var":"$screen","type":"string","desc":"Category Screen"}]
|
519 |
+
* @change_log
|
520 |
+
* ["Since: 2.0"]
|
521 |
+
* @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
|
522 |
+
* @example
|
523 |
+
* <?php
|
524 |
+
* add_filter( 'um_admin_category_access_settings_fields', 'my_admin_category_access_settings_fields', 10, 3 );
|
525 |
+
* function my_admin_category_access_settings_fields( $access_settings_fields, $data, $screen ) {
|
526 |
+
* // your code here
|
527 |
+
* $access_settings_fields[] = array(
|
528 |
+
* 'id' => 'my-field-key',
|
529 |
+
* 'type' => 'my-field-type',
|
530 |
+
* 'label' => __( 'My field Label', 'ultimate-member' ),
|
531 |
+
* 'description' => __( 'My Field Description', 'ultimate-member' ),
|
532 |
+
* 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
533 |
+
* );
|
534 |
+
* return $access_settings_fields;
|
535 |
+
* }
|
536 |
+
* ?>
|
537 |
+
*/
|
538 |
+
$fields = apply_filters( 'um_admin_category_access_settings_fields', array(
|
539 |
+
array(
|
540 |
+
'id' => '_um_custom_access_settings',
|
541 |
+
'type' => 'checkbox',
|
542 |
+
'label' => __( 'Restrict access to this term and its posts?', 'ultimate-member' ),
|
543 |
+
'description' => __( 'Activate content restriction for this term and its posts. Affects only posts that do not have individual Restriction Content settings', 'ultimate-member' ),
|
544 |
+
'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
545 |
+
),
|
546 |
+
array(
|
547 |
+
'id' => '_um_accessible',
|
548 |
+
'type' => 'select',
|
549 |
+
'label' => __( 'Who can access this term and its posts?', 'ultimate-member' ),
|
550 |
+
'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : '0',
|
551 |
+
'options' => array(
|
552 |
+
'0' => __( 'Everyone', 'ultimate-member' ),
|
553 |
+
'1' => __( 'Logged out users', 'ultimate-member' ),
|
554 |
+
'2' => __( 'Logged in users', 'ultimate-member' ),
|
555 |
+
),
|
556 |
+
'conditional' => array( '_um_custom_access_settings', '=', '1' ),
|
557 |
+
),
|
558 |
+
array(
|
559 |
+
'id' => '_um_access_roles',
|
560 |
+
'type' => 'multi_checkbox',
|
561 |
+
'label' => __( 'Select which roles can access this term and its posts', 'ultimate-member' ),
|
562 |
+
'description' => __( 'Leave empty if you want to display a term for all logged in users', 'ultimate-member' ),
|
563 |
+
'value' => $_um_access_roles_value,
|
564 |
+
'options' => UM()->roles()->get_roles( false ),
|
565 |
+
'columns' => 3,
|
566 |
+
'conditional' => array( '_um_accessible', '=', '2' ),
|
567 |
+
),
|
568 |
+
array(
|
569 |
+
'id' => '_um_access_hide_from_queries',
|
570 |
+
'type' => 'checkbox',
|
571 |
+
'label' => __( 'Would you like to display 404 error on the term\'s archive page and terms\' posts single pages when users haven\'t access?', 'ultimate-member' ),
|
572 |
+
'description' => __( 'Recommended to be enabled. Restricted term\'s archive page and all terms\' posts will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
|
573 |
+
'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
|
574 |
+
'conditional' => array( '_um_accessible', '!=', '0' ),
|
575 |
+
),
|
576 |
+
array(
|
577 |
+
'id' => '_um_noaccess_action',
|
578 |
+
'type' => 'select',
|
579 |
+
'label' => __( 'What happens when users without access try to view the term\'s post?', 'ultimate-member' ),
|
580 |
+
'description' => __( 'Action when users without access tries to view the term\'s post', 'ultimate-member' ),
|
581 |
+
'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : '0',
|
582 |
+
'options' => array(
|
583 |
+
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
584 |
+
'1' => __( 'Redirect user', 'ultimate-member' ),
|
585 |
+
),
|
586 |
+
'conditional' => array( '_um_access_hide_from_queries', '=', '0' ),
|
587 |
+
),
|
588 |
+
array(
|
589 |
+
'id' => '_um_restrict_by_custom_message',
|
590 |
+
'type' => 'select',
|
591 |
+
'label' => __( 'Restricted access message type', 'ultimate-member' ),
|
592 |
+
'description' => __( 'Would you like to use the global default message or apply a custom message to this term\'s post?', 'ultimate-member' ),
|
593 |
+
'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
|
594 |
+
'options' => array(
|
595 |
+
'0' => __( 'Global default message', 'ultimate-member' ),
|
596 |
+
'1' => __( 'Custom message', 'ultimate-member' ),
|
597 |
+
),
|
598 |
+
'conditional' => array( '_um_noaccess_action', '=', '0' ),
|
599 |
+
),
|
600 |
+
array(
|
601 |
+
'id' => '_um_restrict_custom_message',
|
602 |
+
'type' => 'wp_editor',
|
603 |
+
'label' => __( 'Custom restricted access message', 'ultimate-member' ),
|
604 |
+
'description' => __( 'You may replace global restricted access message here', 'ultimate-member' ),
|
605 |
+
'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
|
606 |
+
'conditional' => array( '_um_restrict_by_custom_message', '=', '1' ),
|
607 |
+
),
|
608 |
+
array(
|
609 |
+
'id' => '_um_access_redirect',
|
610 |
+
'type' => 'select',
|
611 |
+
'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
|
612 |
+
'description' => __( 'Select redirect to page when user hasn\'t access to the term\'s post', 'ultimate-member' ),
|
613 |
+
'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
|
614 |
+
'options' => array(
|
615 |
+
'0' => __( 'Login page', 'ultimate-member' ),
|
616 |
+
'1' => __( 'Custom URL', 'ultimate-member' ),
|
617 |
+
),
|
618 |
+
'conditional' => array( '_um_noaccess_action', '=', '1' ),
|
619 |
+
),
|
620 |
+
array(
|
621 |
+
'id' => '_um_access_redirect_url',
|
622 |
+
'type' => 'text',
|
623 |
+
'label' => __( 'Redirect URL', 'ultimate-member' ),
|
624 |
+
'description' => __( 'Set full URL where do you want to redirect the user', 'ultimate-member' ),
|
625 |
+
'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
|
626 |
+
'conditional' => array( '_um_access_redirect', '=', '1' ),
|
627 |
+
),
|
628 |
+
), $data, 'edit' );
|
629 |
+
|
630 |
+
UM()->admin_forms(
|
631 |
+
array(
|
632 |
+
'class' => 'um-restrict-content um-third-column',
|
633 |
+
'prefix_id' => 'um_content_restriction',
|
634 |
+
'without_wrapper' => true,
|
635 |
+
'fields' => $fields,
|
636 |
+
)
|
637 |
+
)->render_form();
|
638 |
+
|
639 |
+
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
|
640 |
+
}
|
641 |
+
|
642 |
+
|
643 |
+
/**
|
644 |
+
* @param $termID
|
645 |
+
*
|
646 |
+
* @return mixed
|
647 |
+
*/
|
648 |
+
function um_category_access_fields_save( $termID ) {
|
649 |
+
|
650 |
+
// validate nonce
|
651 |
+
if ( ! isset( $_REQUEST['um_admin_save_taxonomy_restrict_content_nonce'] ) || ! wp_verify_nonce( $_REQUEST['um_admin_save_taxonomy_restrict_content_nonce'], basename( __FILE__ ) ) ) {
|
652 |
+
return $termID;
|
653 |
+
}
|
654 |
+
|
655 |
+
// validate user
|
656 |
+
$term = get_term( $termID );
|
657 |
+
$taxonomy = get_taxonomy( $term->taxonomy );
|
658 |
+
|
659 |
+
if ( ! current_user_can( $taxonomy->cap->edit_terms, $termID ) ) {
|
660 |
+
return $termID;
|
661 |
+
}
|
662 |
+
|
663 |
+
if ( ! empty( $_REQUEST['um_content_restriction'] ) && is_array( $_REQUEST['um_content_restriction'] ) ) {
|
664 |
+
$restriction_meta = UM()->admin()->sanitize_term_restriction_meta( $_REQUEST['um_content_restriction'] );
|
665 |
+
|
666 |
+
update_term_meta( $termID, 'um_content_restriction', $restriction_meta );
|
667 |
+
} else {
|
668 |
+
delete_term_meta( $termID, 'um_content_restriction' );
|
669 |
+
}
|
670 |
+
|
671 |
+
return $termID;
|
672 |
+
}
|
673 |
+
|
674 |
+
|
675 |
+
/**
|
676 |
+
* Load a directory metabox
|
677 |
+
*
|
678 |
+
* @param $object
|
679 |
+
* @param $box
|
680 |
+
*/
|
681 |
+
function load_metabox_directory( $object, $box ) {
|
682 |
+
$box['id'] = str_replace( 'um-admin-form-', '', $box['id'] );
|
683 |
+
|
684 |
+
preg_match('#\{.*?\}#s', $box['id'], $matches );
|
685 |
+
|
686 |
+
if ( isset( $matches[0] ) ) {
|
687 |
+
$path = $matches[0];
|
688 |
+
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
689 |
+
} else {
|
690 |
+
$path = um_path;
|
691 |
+
}
|
692 |
+
|
693 |
+
$path = str_replace('{','', $path );
|
694 |
+
$path = str_replace('}','', $path );
|
695 |
+
|
696 |
+
|
697 |
+
include_once $path . 'includes/admin/templates/directory/'. $box['id'] . '.php';
|
698 |
+
if ( ! $this->directory_nonce_added ) {
|
699 |
+
$this->directory_nonce_added = true;
|
700 |
+
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_directory_nonce' );
|
701 |
+
}
|
702 |
+
}
|
703 |
+
|
704 |
+
|
705 |
+
/**
|
706 |
+
* Load a role metabox
|
707 |
+
*
|
708 |
+
* @param $object
|
709 |
+
* @param $box
|
710 |
+
*/
|
711 |
+
function load_metabox_role( $object, $box ) {
|
712 |
+
global $post;
|
713 |
+
|
714 |
+
$box['id'] = str_replace( 'um-admin-form-', '', $box['id'] );
|
715 |
+
|
716 |
+
if ( $box['id'] == 'builder' ) {
|
717 |
+
UM()->builder()->form_id = get_the_ID();
|
718 |
+
}
|
719 |
+
|
720 |
+
preg_match('#\{.*?\}#s', $box['id'], $matches);
|
721 |
+
|
722 |
+
if ( isset($matches[0]) ){
|
723 |
+
$path = $matches[0];
|
724 |
+
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
725 |
+
} else {
|
726 |
+
$path = um_path;
|
727 |
+
}
|
728 |
+
|
729 |
+
$path = str_replace('{','', $path );
|
730 |
+
$path = str_replace('}','', $path );
|
731 |
+
|
732 |
+
include_once $path . 'includes/admin/templates/role/'. $box['id'] . '.php';
|
733 |
+
//wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_role_nonce' );
|
734 |
+
}
|
735 |
+
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Load a form metabox
|
739 |
+
*
|
740 |
+
* @param $object
|
741 |
+
* @param $box
|
742 |
+
*/
|
743 |
+
function load_metabox_form( $object, $box ) {
|
744 |
+
global $post;
|
745 |
+
|
746 |
+
$box['id'] = str_replace( 'um-admin-form-','', $box['id'] );
|
747 |
+
|
748 |
+
if ( $box['id'] == 'builder' ) {
|
749 |
+
UM()->builder()->form_id = get_the_ID();
|
750 |
+
}
|
751 |
+
|
752 |
+
preg_match('#\{.*?\}#s', $box['id'], $matches);
|
753 |
+
|
754 |
+
if ( isset( $matches[0] ) ) {
|
755 |
+
$path = $matches[0];
|
756 |
+
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
757 |
+
} else {
|
758 |
+
$path = um_path;
|
759 |
+
}
|
760 |
+
|
761 |
+
$path = str_replace('{','', $path );
|
762 |
+
$path = str_replace('}','', $path );
|
763 |
+
|
764 |
+
include_once $path . 'includes/admin/templates/form/'. $box['id'] . '.php';
|
765 |
+
|
766 |
+
if ( ! $this->form_nonce_added ) {
|
767 |
+
$this->form_nonce_added = true;
|
768 |
+
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_form_nonce' );
|
769 |
+
}
|
770 |
+
}
|
771 |
+
|
772 |
+
|
773 |
+
/**
|
774 |
+
* Load admin custom metabox
|
775 |
+
*
|
776 |
+
* @param $object
|
777 |
+
* @param $box
|
778 |
+
*/
|
779 |
+
function load_metabox_custom( $object, $box ) {
|
780 |
+
global $post;
|
781 |
+
|
782 |
+
$box['id'] = str_replace('um-admin-custom-','', $box['id']);
|
783 |
+
|
784 |
+
preg_match('#\{.*?\}#s', $box['id'], $matches);
|
785 |
+
|
786 |
+
if ( isset($matches[0]) ){
|
787 |
+
$path = $matches[0];
|
788 |
+
$box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
|
789 |
+
} else {
|
790 |
+
$path = um_path;
|
791 |
+
}
|
792 |
+
|
793 |
+
$path = str_replace('{','', $path );
|
794 |
+
$path = str_replace('}','', $path );
|
795 |
+
|
796 |
+
include_once $path . 'includes/admin/templates/'. $box['id'] . '.php';
|
797 |
+
if ( ! $this->custom_nonce_added ) {
|
798 |
+
$this->custom_nonce_added = true;
|
799 |
+
wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_custom_nonce' );
|
800 |
+
}
|
801 |
+
}
|
802 |
+
|
803 |
+
|
804 |
+
/**
|
805 |
+
* Add directory metabox
|
806 |
+
*/
|
807 |
+
function add_metabox_directory() {
|
808 |
+
add_meta_box( 'um-admin-form-general', __( 'General Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
809 |
+
add_meta_box( 'um-admin-form-sorting', __( 'Sorting', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
810 |
+
add_meta_box( 'um-admin-form-profile', __( 'Profile Card', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
811 |
+
add_meta_box( 'um-admin-form-search', __( 'Search Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
812 |
+
add_meta_box( 'um-admin-form-pagination', __( 'Results & Pagination', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
|
813 |
+
add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'side', 'default' );
|
814 |
+
add_meta_box( 'um-admin-form-appearance', __( 'Styling: General', 'ultimate-member' ), array( &$this, 'load_metabox_directory'), 'um_directory', 'side', 'default' );
|
815 |
+
}
|
816 |
+
|
817 |
+
|
818 |
+
/**
|
819 |
+
* Add role metabox
|
820 |
+
*/
|
821 |
+
function add_metabox_role() {
|
822 |
+
$callback = array( &$this, 'load_metabox_role' );
|
823 |
+
|
824 |
+
$roles_metaboxes = array(
|
825 |
+
array(
|
826 |
+
'id' => 'um-admin-form-admin-permissions',
|
827 |
+
'title' => __( 'Administrative Permissions', 'ultimate-member' ),
|
828 |
+
'callback' => $callback,
|
829 |
+
'screen' => 'um_role_meta',
|
830 |
+
'context' => 'normal',
|
831 |
+
'priority' => 'default'
|
832 |
+
),
|
833 |
+
array(
|
834 |
+
'id' => 'um-admin-form-general',
|
835 |
+
'title' => __( 'General Permissions', 'ultimate-member' ),
|
836 |
+
'callback' => $callback,
|
837 |
+
'screen' => 'um_role_meta',
|
838 |
+
'context' => 'normal',
|
839 |
+
'priority' => 'default'
|
840 |
+
),
|
841 |
+
array(
|
842 |
+
'id' => 'um-admin-form-profile',
|
843 |
+
'title' => __( 'Profile Access', 'ultimate-member' ),
|
844 |
+
'callback' => $callback,
|
845 |
+
'screen' => 'um_role_meta',
|
846 |
+
'context' => 'normal',
|
847 |
+
'priority' => 'default'
|
848 |
+
)
|
849 |
+
);
|
850 |
+
|
851 |
+
if ( ! isset( $_GET['id'] ) || 'administrator' !== sanitize_key( $_GET['id'] ) ) {
|
852 |
+
$roles_metaboxes[] = array(
|
853 |
+
'id' => 'um-admin-form-home',
|
854 |
+
'title' => __( 'Homepage Options', 'ultimate-member' ),
|
855 |
+
'callback' => $callback,
|
856 |
+
'screen' => 'um_role_meta',
|
857 |
+
'context' => 'normal',
|
858 |
+
'priority' => 'default'
|
859 |
+
);
|
860 |
+
}
|
861 |
+
|
862 |
+
$roles_metaboxes = array_merge( $roles_metaboxes, array(
|
863 |
+
array(
|
864 |
+
'id' => 'um-admin-form-register',
|
865 |
+
'title' => __( 'Registration Options', 'ultimate-member' ),
|
866 |
+
'callback' => $callback,
|
867 |
+
'screen' => 'um_role_meta',
|
868 |
+
'context' => 'normal',
|
869 |
+
'priority' => 'default'
|
870 |
+
),
|
871 |
+
array(
|
872 |
+
'id' => 'um-admin-form-login',
|
873 |
+
'title' => __( 'Login Options', 'ultimate-member' ),
|
874 |
+
'callback' => $callback,
|
875 |
+
'screen' => 'um_role_meta',
|
876 |
+
'context' => 'normal',
|
877 |
+
'priority' => 'default'
|
878 |
+
),
|
879 |
+
array(
|
880 |
+
'id' => 'um-admin-form-logout',
|
881 |
+
'title' => __( 'Logout Options', 'ultimate-member' ),
|
882 |
+
'callback' => $callback,
|
883 |
+
'screen' => 'um_role_meta',
|
884 |
+
'context' => 'normal',
|
885 |
+
'priority' => 'default'
|
886 |
+
),
|
887 |
+
array(
|
888 |
+
'id' => 'um-admin-form-delete',
|
889 |
+
'title' => __( 'Delete Options', 'ultimate-member' ),
|
890 |
+
'callback' => $callback,
|
891 |
+
'screen' => 'um_role_meta',
|
892 |
+
'context' => 'normal',
|
893 |
+
'priority' => 'default'
|
894 |
+
),
|
895 |
+
array(
|
896 |
+
'id' => 'um-admin-form-publish',
|
897 |
+
'title' => __( 'Publish', 'ultimate-member' ),
|
898 |
+
'callback' => $callback,
|
899 |
+
'screen' => 'um_role_meta',
|
900 |
+
'context' => 'side',
|
901 |
+
'priority' => 'default'
|
902 |
+
)
|
903 |
+
) );
|
904 |
+
|
905 |
+
/**
|
906 |
+
* UM hook
|
907 |
+
*
|
908 |
+
* @type filter
|
909 |
+
* @title um_admin_role_metaboxes
|
910 |
+
* @description Extend metaboxes at Add/Edit User Role
|
911 |
+
* @input_vars
|
912 |
+
* [{"var":"$roles_metaboxes","type":"array","desc":"Metaboxes at Add/Edit UM Role"}]
|
913 |
+
* @change_log
|
914 |
+
* ["Since: 2.0"]
|
915 |
+
* @usage add_filter( 'um_admin_role_metaboxes', 'function_name', 10, 1 );
|
916 |
+
* @example
|
917 |
+
* <?php
|
918 |
+
* add_filter( 'um_admin_role_metaboxes', 'my_admin_role_metaboxes', 10, 1 );
|
919 |
+
* function my_admin_role_metaboxes( $roles_metaboxes ) {
|
920 |
+
* // your code here
|
921 |
+
* $roles_metaboxes[] = array(
|
922 |
+
* 'id' => 'um-admin-form-your-custom',
|
923 |
+
* 'title' => __( 'My Roles Metabox', 'ultimate-member' ),
|
924 |
+
* 'callback' => 'my-metabox-callback',
|
925 |
+
* 'screen' => 'um_role_meta',
|
926 |
+
* 'context' => 'side',
|
927 |
+
* 'priority' => 'default'
|
928 |
+
* );
|
929 |
+
*
|
930 |
+
* return $roles_metaboxes;
|
931 |
+
* }
|
932 |
+
* ?>
|
933 |
+
*/
|
934 |
+
$roles_metaboxes = apply_filters( 'um_admin_role_metaboxes', $roles_metaboxes );
|
935 |
+
|
936 |
+
$wp_caps_metabox = false;
|
937 |
+
if ( ! empty( $_GET['id'] ) ) {
|
938 |
+
$data = get_option( 'um_role_' . sanitize_key( $_GET['id'] ) . '_meta' );
|
939 |
+
if ( ! empty( $data['_um_is_custom'] ) ) {
|
940 |
+
$wp_caps_metabox = true;
|
941 |
+
}
|
942 |
+
}
|
943 |
+
if ( 'add' == sanitize_key( $_GET['tab'] ) || $wp_caps_metabox ) {
|
944 |
+
$roles_metaboxes[] = array(
|
945 |
+
'id' => 'um-admin-form-wp-capabilities',
|
946 |
+
'title' => __( 'WP Capabilities', 'ultimate-member' ),
|
947 |
+
'callback' => $callback,
|
948 |
+
'screen' => 'um_role_meta',
|
949 |
+
'context' => 'normal',
|
950 |
+
'priority' => 'default'
|
951 |
+
);
|
952 |
+
}
|
953 |
+
|
954 |
+
|
955 |
+
foreach ( $roles_metaboxes as $metabox ) {
|
956 |
+
add_meta_box(
|
957 |
+
$metabox['id'],
|
958 |
+
$metabox['title'],
|
959 |
+
$metabox['callback'],
|
960 |
+
$metabox['screen'],
|
961 |
+
$metabox['context'],
|
962 |
+
$metabox['priority']
|
963 |
+
);
|
964 |
+
}
|
965 |
+
}
|
966 |
+
|
967 |
+
|
968 |
+
/**
|
969 |
+
* Add form metabox
|
970 |
+
*/
|
971 |
+
function add_metabox_form() {
|
972 |
+
|
973 |
+
add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
|
974 |
+
add_meta_box( 'um-admin-form-builder', __( 'Form Builder', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
|
975 |
+
add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
976 |
+
|
977 |
+
add_meta_box( 'um-admin-form-register_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
978 |
+
|
979 |
+
/**
|
980 |
+
* UM hook
|
981 |
+
*
|
982 |
+
* @type action
|
983 |
+
* @title um_admin_custom_register_metaboxes
|
984 |
+
* @description Add custom metaboxes for register form
|
985 |
+
* @change_log
|
986 |
+
* ["Since: 2.0"]
|
987 |
+
* @usage add_action( 'um_admin_custom_register_metaboxes', 'function_name', 10 );
|
988 |
+
* @example
|
989 |
+
* <?php
|
990 |
+
* add_action( 'um_admin_custom_register_metaboxes', 'my_admin_custom_register_metaboxes', 10 );
|
991 |
+
* function my_admin_custom_register_metaboxes() {
|
992 |
+
* // your code here
|
993 |
+
* }
|
994 |
+
* ?>
|
995 |
+
*/
|
996 |
+
do_action( 'um_admin_custom_register_metaboxes' );
|
997 |
+
|
998 |
+
add_meta_box( 'um-admin-form-profile_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
999 |
+
add_meta_box( 'um-admin-form-profile_settings', __( 'User Meta', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
1000 |
+
|
1001 |
+
/**
|
1002 |
+
* UM hook
|
1003 |
+
*
|
1004 |
+
* @type action
|
1005 |
+
* @title um_admin_custom_profile_metaboxes
|
1006 |
+
* @description Add custom metaboxes for profile form
|
1007 |
+
* @change_log
|
1008 |
+
* ["Since: 2.0"]
|
1009 |
+
* @usage add_action( 'um_admin_custom_profile_metaboxes', 'function_name', 10 );
|
1010 |
+
* @example
|
1011 |
+
* <?php
|
1012 |
+
* add_action( 'um_admin_custom_profile_metaboxes', 'my_admin_custom_profile_metaboxes', 10 );
|
1013 |
+
* function my_admin_custom_profile_metaboxes() {
|
1014 |
+
* // your code here
|
1015 |
+
* }
|
1016 |
+
* ?>
|
1017 |
+
*/
|
1018 |
+
do_action( 'um_admin_custom_profile_metaboxes' );
|
1019 |
+
|
1020 |
+
add_meta_box( 'um-admin-form-login_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
1021 |
+
add_meta_box( 'um-admin-form-login_settings', __( 'Options', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
|
1022 |
+
|
1023 |
+
/**
|
1024 |
+
* UM hook
|
1025 |
+
*
|
1026 |
+
* @type action
|
1027 |
+
* @title um_admin_custom_login_metaboxes
|
1028 |
+
* @description Add custom metaboxes for login form
|
1029 |
+
* @change_log
|
1030 |
+
* ["Since: 2.0"]
|
1031 |
+
* @usage add_action( 'um_admin_custom_login_metaboxes', 'function_name', 10 );
|
1032 |
+
* @example
|
1033 |
+
* <?php
|
1034 |
+
* add_action( 'um_admin_custom_login_metaboxes', 'my_admin_custom_login_metaboxes', 10 );
|
1035 |
+
* function my_admin_custom_login_metaboxes() {
|
1036 |
+
* // your code here
|
1037 |
+
* }
|
1038 |
+
* ?>
|
1039 |
+
*/
|
1040 |
+
do_action( 'um_admin_custom_login_metaboxes' );
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
|
1044 |
+
/**
|
1045 |
+
* Save directory metabox
|
1046 |
+
*
|
1047 |
+
* @param $post_id
|
1048 |
+
* @param $post
|
1049 |
+
*/
|
1050 |
+
function save_metabox_directory( $post_id, $post ) {
|
1051 |
+
global $wpdb;
|
1052 |
+
|
1053 |
+
// validate nonce
|
1054 |
+
if ( ! isset( $_POST['um_admin_save_metabox_directory_nonce'] ) ||
|
1055 |
+
! wp_verify_nonce( $_POST['um_admin_save_metabox_directory_nonce'], basename( __FILE__ ) ) ) {
|
1056 |
+
return;
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
// validate post type
|
1060 |
+
if ( $post->post_type != 'um_directory' ) {
|
1061 |
+
return;
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
// validate user
|
1065 |
+
$post_type = get_post_type_object( $post->post_type );
|
1066 |
+
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
1067 |
+
return;
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
$where = array( 'ID' => $post_id );
|
1071 |
+
|
1072 |
+
if ( empty( $_POST['post_title'] ) ) {
|
1073 |
+
$_POST['post_title'] = sprintf( __( 'Directory #%s', 'ultimate-member' ), $post_id );
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( $_POST['post_title'] ) ), $where );
|
1077 |
+
|
1078 |
+
do_action( 'um_before_member_directory_save', $post_id );
|
1079 |
+
|
1080 |
+
// save
|
1081 |
+
delete_post_meta( $post_id, '_um_roles' );
|
1082 |
+
delete_post_meta( $post_id, '_um_tagline_fields' );
|
1083 |
+
delete_post_meta( $post_id, '_um_reveal_fields' );
|
1084 |
+
delete_post_meta( $post_id, '_um_search_fields' );
|
1085 |
+
delete_post_meta( $post_id, '_um_roles_can_search' );
|
1086 |
+
delete_post_meta( $post_id, '_um_roles_can_filter' );
|
1087 |
+
delete_post_meta( $post_id, '_um_show_these_users' );
|
1088 |
+
delete_post_meta( $post_id, '_um_exclude_these_users' );
|
1089 |
+
|
1090 |
+
delete_post_meta( $post_id, '_um_search_filters' );
|
1091 |
+
delete_post_meta( $post_id, '_um_search_filters_gmt' );
|
1092 |
+
|
1093 |
+
delete_post_meta( $post_id, '_um_sorting_fields' );
|
1094 |
+
|
1095 |
+
//save metadata
|
1096 |
+
$metadata = UM()->admin()->sanitize_member_directory_meta( $_POST['um_metadata'] );
|
1097 |
+
foreach ( $metadata as $k => $v ) {
|
1098 |
+
|
1099 |
+
if ( $k == '_um_show_these_users' && trim( $v ) ) {
|
1100 |
+
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
|
1101 |
+
}
|
1102 |
+
|
1103 |
+
if ( $k == '_um_exclude_these_users' && trim( $v ) ) {
|
1104 |
+
$v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
if ( strstr( $k, '_um_' ) ) {
|
1108 |
+
|
1109 |
+
if ( $k === '_um_is_default' ) {
|
1110 |
+
|
1111 |
+
$mode = UM()->query()->get_attr( 'mode', $post_id );
|
1112 |
+
|
1113 |
+
if ( ! empty( $mode ) ) {
|
1114 |
+
|
1115 |
+
$posts = $wpdb->get_col(
|
1116 |
+
"SELECT post_id
|
1117 |
+
FROM {$wpdb->postmeta}
|
1118 |
+
WHERE meta_key = '_um_mode' AND
|
1119 |
+
meta_value = 'directory'"
|
1120 |
+
);
|
1121 |
+
|
1122 |
+
foreach ( $posts as $p_id ) {
|
1123 |
+
delete_post_meta( $p_id, '_um_is_default' );
|
1124 |
+
}
|
1125 |
+
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
}
|
1129 |
+
|
1130 |
+
$v = apply_filters( 'um_member_directory_meta_value_before_save', $v, $k, $post_id );
|
1131 |
+
|
1132 |
+
update_post_meta( $post_id, $k, $v );
|
1133 |
+
|
1134 |
+
}
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
update_post_meta( $post_id, '_um_search_filters_gmt', (int) $_POST['um-gmt-offset'] );
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
|
1141 |
+
/**
|
1142 |
+
* Save form metabox
|
1143 |
+
*
|
1144 |
+
* @param $post_id
|
1145 |
+
* @param $post
|
1146 |
+
*/
|
1147 |
+
function save_metabox_form( $post_id, $post ) {
|
1148 |
+
global $wpdb;
|
1149 |
+
|
1150 |
+
// validate nonce
|
1151 |
+
if ( ! isset( $_POST['um_admin_save_metabox_form_nonce'] ) ||
|
1152 |
+
! wp_verify_nonce( $_POST['um_admin_save_metabox_form_nonce'], basename( __FILE__ ) ) ) {
|
1153 |
+
return;
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
// validate post type
|
1157 |
+
if ( $post->post_type != 'um_form' ) {
|
1158 |
+
return;
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
// validate user
|
1162 |
+
$post_type = get_post_type_object( $post->post_type );
|
1163 |
+
if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
|
1164 |
+
return;
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
$where = array( 'ID' => $post_id );
|
1168 |
+
if ( empty( $_POST['post_title'] ) ) {
|
1169 |
+
$_POST['post_title'] = sprintf( __( 'Form #%s', 'ultimate-member' ), $post_id );
|
1170 |
+
}
|
1171 |
+
$wpdb->update( $wpdb->posts, array( 'post_title' => sanitize_text_field( $_POST['post_title'] ) ), $where );
|
1172 |
+
|
1173 |
+
// save
|
1174 |
+
delete_post_meta( $post_id, '_um_profile_metafields' );
|
1175 |
+
|
1176 |
+
$form_meta = UM()->admin()->sanitize_form_meta( $_POST['form'] );
|
1177 |
+
|
1178 |
+
foreach ( $form_meta as $k => $v ) {
|
1179 |
+
if ( strstr( $k, '_um_' ) ) {
|
1180 |
+
if ( $k === '_um_is_default' ) {
|
1181 |
+
$mode = UM()->query()->get_attr( 'mode', $post_id );
|
1182 |
+
if ( ! empty( $mode ) ) {
|
1183 |
+
$posts = $wpdb->get_col( $wpdb->prepare(
|
1184 |
+
"SELECT post_id
|
1185 |
+
FROM {$wpdb->postmeta}
|
1186 |
+
WHERE meta_key = '_um_mode' AND
|
1187 |
+
meta_value = %s",
|
1188 |
+
$mode
|
1189 |
+
) );
|
1190 |
+
foreach ( $posts as $p_id ) {
|
1191 |
+
delete_post_meta( $p_id, '_um_is_default' );
|
1192 |
+
}
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
update_post_meta( $post_id, $k, $v );
|
1197 |
+
}
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
|
1203 |
+
/**
|
1204 |
+
* Load modal content
|
1205 |
+
*/
|
1206 |
+
function load_modal_content() {
|
1207 |
+
$screen = get_current_screen();
|
1208 |
+
|
1209 |
+
if ( isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) {
|
1210 |
+
foreach ( glob( um_path . 'includes/admin/templates/modal/forms/*.php' ) as $modal_content ) {
|
1211 |
+
include_once $modal_content;
|
1212 |
+
}
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
if ( $this->init_icon ) {
|
1216 |
+
include_once um_path . 'includes/admin/templates/modal/forms/fonticons.php';
|
1217 |
+
}
|
1218 |
+
|
1219 |
+
if ( $screen->id == 'users' ) {
|
1220 |
+
include_once um_path . 'includes/admin/templates/modal/dynamic_registration_preview.php';
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
// needed on forms only
|
1224 |
+
if ( ! isset( $this->is_loaded ) && isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) {
|
1225 |
+
$settings['textarea_rows'] = 8;
|
1226 |
+
|
1227 |
+
echo '<div class="um-hidden-editor-edit" style="display:none;">';
|
1228 |
+
wp_editor( '', 'um_editor_edit', $settings );
|
1229 |
+
echo '</div>';
|
1230 |
+
|
1231 |
+
echo '<div class="um-hidden-editor-new" style="display:none;">';
|
1232 |
+
wp_editor( '', 'um_editor_new', $settings );
|
1233 |
+
echo '</div>';
|
1234 |
+
|
1235 |
+
$this->is_loaded = true;
|
1236 |
+
}
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
|
1240 |
+
/**
|
1241 |
+
* Show field input for edit at modal field
|
1242 |
+
*
|
1243 |
+
* @param $attribute
|
1244 |
+
* @param null $form_id
|
1245 |
+
* @param array $field_args
|
1246 |
+
*/
|
1247 |
+
function field_input( $attribute, $form_id = null, $field_args = array() ) {
|
1248 |
+
|
1249 |
+
if ( $this->in_edit == true ) { // we're editing a field
|
1250 |
+
$real_attr = substr( $attribute, 1 );
|
1251 |
+
$this->edit_mode_value = isset( $this->edit_array[ $real_attr ] ) ? $this->edit_array[ $real_attr ] : null;
|
1252 |
+
}
|
1253 |
+
|
1254 |
+
switch ( $attribute ) {
|
1255 |
+
|
1256 |
+
default:
|
1257 |
+
|
1258 |
+
/**
|
1259 |
+
* UM hook
|
1260 |
+
*
|
1261 |
+
* @type action
|
1262 |
+
* @title um_admin_field_edit_hook{$attribute}
|
1263 |
+
* @description Integration for 3-d party fields at wp-admin
|
1264 |
+
* @input_vars
|
1265 |
+
* [{"var":"$edit_mode_value","type":"string","desc":"Post ID"}]
|
1266 |
+
* @change_log
|
1267 |
+
* ["Since: 2.0"]
|
1268 |
+
* @usage add_action( 'um_admin_field_edit_hook{$attribute}', 'function_name', 10, 1 );
|
1269 |
+
* @example
|
1270 |
+
* <?php
|
1271 |
+
* add_action( 'um_admin_field_edit_hook{$attribute}', 'my_admin_field_edit', 10, 1 );
|
1272 |
+
* function my_admin_field_edit( $edit_mode_value ) {
|
1273 |
+
* // your code here
|
1274 |
+
* }
|
1275 |
+
* ?>
|
1276 |
+
*/
|
1277 |
+
do_action( "um_admin_field_edit_hook{$attribute}", $this->edit_mode_value, $form_id, $this->edit_array );
|
1278 |
+
|
1279 |
+
break;
|
1280 |
+
|
1281 |
+
case '_visibility':
|
1282 |
+
?>
|
1283 |
+
|
1284 |
+
<p><label for="_visibility"><?php _e( 'Visibility', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select where this field should appear. This option should only be changed on the profile form and allows you to show a field in one mode only (edit or view) or in both modes.','ultimate-member' ) ); ?></label>
|
1285 |
+
<select name="_visibility" id="_visibility" style="width: 100%">
|
1286 |
+
<option value="all" <?php selected( 'all', $this->edit_mode_value ); ?>><?php _e( 'View everywhere', 'ultimate-member' ) ?></option>
|
1287 |
+
<option value="edit" <?php selected( 'edit', $this->edit_mode_value ); ?>><?php _e( 'Edit mode only', 'ultimate-member' ) ?></option>
|
1288 |
+
<option value="view" <?php selected( 'view', $this->edit_mode_value ); ?>><?php _e( 'View mode only', 'ultimate-member' ) ?></option>
|
1289 |
+
</select>
|
1290 |
+
</p>
|
1291 |
+
|
1292 |
+
<?php
|
1293 |
+
break;
|
1294 |
+
|
1295 |
+
case '_conditional_action':
|
1296 |
+
case '_conditional_action1':
|
1297 |
+
case '_conditional_action2':
|
1298 |
+
case '_conditional_action3':
|
1299 |
+
case '_conditional_action4':
|
1300 |
+
?>
|
1301 |
+
|
1302 |
+
<p>
|
1303 |
+
<select name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" style="width: 90px">
|
1304 |
+
|
1305 |
+
<option></option>
|
1306 |
+
|
1307 |
+
<?php $actions = array( 'show', 'hide' );
|
1308 |
+
foreach ( $actions as $action ) { ?>
|
1309 |
+
|
1310 |
+
<option value="<?php echo esc_attr( $action ); ?>" <?php selected( $action, $this->edit_mode_value ); ?>><?php echo $action; ?></option>
|
1311 |
+
|
1312 |
+
<?php } ?>
|
1313 |
+
|
1314 |
+
</select>
|
1315 |
+
|
1316 |
+
<?php _e( 'If' ); ?>
|
1317 |
+
</p>
|
1318 |
+
|
1319 |
+
<?php
|
1320 |
+
break;
|
1321 |
+
|
1322 |
+
case '_conditional_field':
|
1323 |
+
case '_conditional_field1':
|
1324 |
+
case '_conditional_field2':
|
1325 |
+
case '_conditional_field3':
|
1326 |
+
case '_conditional_field4':
|
1327 |
+
?>
|
1328 |
+
|
1329 |
+
<p>
|
1330 |
+
<select name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" style="width: 150px">
|
1331 |
+
|
1332 |
+
<option></option>
|
1333 |
+
|
1334 |
+
<?php $fields = UM()->query()->get_attr( 'custom_fields', $form_id );
|
1335 |
+
|
1336 |
+
foreach ( $fields as $key => $array ) {
|
1337 |
+
if ( isset( $array['title'] ) &&
|
1338 |
+
( ! isset( $this->edit_array['metakey'] ) || $key != $this->edit_array['metakey'] ) ) { ?>
|
1339 |
+
|
1340 |
+
<option value="<?php echo esc_attr( $key ) ?>" <?php selected( $key, $this->edit_mode_value ) ?>><?php echo $array['title'] ?></option>
|
1341 |
+
|
1342 |
+
<?php }
|
1343 |
+
} ?>
|
1344 |
+
|
1345 |
+
</select>
|
1346 |
+
</p>
|
1347 |
+
|
1348 |
+
<?php
|
1349 |
+
break;
|
1350 |
+
|
1351 |
+
case '_conditional_operator':
|
1352 |
+
case '_conditional_operator1':
|
1353 |
+
case '_conditional_operator2':
|
1354 |
+
case '_conditional_operator3':
|
1355 |
+
case '_conditional_operator4':
|
1356 |
+
?>
|
1357 |
+
|
1358 |
+
<p>
|
1359 |
+
<select name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" style="width: 150px">
|
1360 |
+
|
1361 |
+
<option></option>
|
1362 |
+
|
1363 |
+
<?php $operators = array(
|
1364 |
+
'empty',
|
1365 |
+
'not empty',
|
1366 |
+
'equals to',
|
1367 |
+
'not equals',
|
1368 |
+
'greater than',
|
1369 |
+
'less than',
|
1370 |
+
'contains'
|
1371 |
+
);
|
1372 |
+
|
1373 |
+
foreach ( $operators as $operator ) { ?>
|
1374 |
+
|
1375 |
+
<option value="<?php echo esc_attr( $operator ); ?>" <?php selected( $operator, $this->edit_mode_value ); ?>><?php echo $operator; ?></option>
|
1376 |
+
|
1377 |
+
<?php } ?>
|
1378 |
+
|
1379 |
+
</select>
|
1380 |
+
</p>
|
1381 |
+
|
1382 |
+
<?php
|
1383 |
+
break;
|
1384 |
+
|
1385 |
+
case '_conditional_value':
|
1386 |
+
case '_conditional_value1':
|
1387 |
+
case '_conditional_value2':
|
1388 |
+
case '_conditional_value3':
|
1389 |
+
case '_conditional_value4':
|
1390 |
+
?>
|
1391 |
+
|
1392 |
+
<p>
|
1393 |
+
<input type="text" name="<?php echo esc_attr( $attribute ); ?>" id="<?php echo esc_attr( $attribute ); ?>" value="<?php echo isset( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" placeholder="<?php esc_attr_e( 'Value', 'ultimate-member' ); ?>" style="width: 150px!important;position: relative;top: -1px;" />
|
1394 |
+
</p>
|
1395 |
+
|
1396 |
+
<?php
|
1397 |
+
break;
|
1398 |
+
|
1399 |
+
case '_validate':
|
1400 |
+
?>
|
1401 |
+
|
1402 |
+
<p><label for="_validate"><?php _e( 'Validate', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Does this field require a special validation', 'ultimate-member' ) ); ?></label>
|
1403 |
+
<select name="_validate" id="_validate" data-placeholder="<?php esc_attr_e( 'Select a validation type...', 'ultimate-member' ) ?>" class="um-adm-conditional" data-cond1="custom" data-cond1-show="_custom_validate" style="width: 100%">
|
1404 |
+
|
1405 |
+
<option value="" <?php selected( '', $this->edit_mode_value ); ?>></option>
|
1406 |
+
|
1407 |
+
<?php foreach( UM()->builtin()->validation_types() as $key => $name ) { ?>
|
1408 |
+
<?php
|
1409 |
+
/**
|
1410 |
+
* UM hook
|
1411 |
+
*
|
1412 |
+
* @type filter
|
1413 |
+
* @title um_builtin_validation_types_continue_loop
|
1414 |
+
* @description Builtin Validation Types
|
1415 |
+
* @input_vars
|
1416 |
+
* [{"var":"$continue","type":"bool","desc":"Validate?"},
|
1417 |
+
* {"var":"$key","type":"string","desc":"Field Key"},
|
1418 |
+
* {"var":"$form_id","type":"int","desc":"Form ID"},
|
1419 |
+
* {"var":"$field_args","type":"array","desc":"Field Settings"}]
|
1420 |
+
* @change_log
|
1421 |
+
* ["Since: 2.0"]
|
1422 |
+
* @usage add_filter( 'um_builtin_validation_types_continue_loop', 'function_name', 10, 4 );
|
1423 |
+
* @example
|
1424 |
+
* <?php
|
1425 |
+
* add_filter( 'um_builtin_validation_types_continue_loop', 'my_builtin_validation_types', 10, 4 );
|
1426 |
+
* function my_builtin_validation_types( $continue, $key, $form_id, $field_args ) {
|
1427 |
+
* // your code here
|
1428 |
+
* return $continue;
|
1429 |
+
* }
|
1430 |
+
* ?>
|
1431 |
+
*/
|
1432 |
+
$continue = apply_filters( "um_builtin_validation_types_continue_loop", true, $key, $form_id, $field_args );
|
1433 |
+
if ( $continue ) { ?>
|
1434 |
+
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $this->edit_mode_value ); ?>><?php echo $name; ?></option>
|
1435 |
+
<?php } ?>
|
1436 |
+
<?php } ?>
|
1437 |
+
|
1438 |
+
</select>
|
1439 |
+
</p>
|
1440 |
+
|
1441 |
+
<?php
|
1442 |
+
break;
|
1443 |
+
|
1444 |
+
case '_custom_validate':
|
1445 |
+
?>
|
1446 |
+
|
1447 |
+
<p class="_custom_validate"><label for="_custom_validate"><?php _e( 'Custom Action', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'If you want to apply your custom validation, you can use action hooks to add custom validation. Please refer to documentation for further details.', 'ultimate-member' ) ); ?></label>
|
1448 |
+
<input type="text" name="_custom_validate" id="_custom_validate" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1449 |
+
</p>
|
1450 |
+
|
1451 |
+
<?php
|
1452 |
+
break;
|
1453 |
+
|
1454 |
+
case '_icon':
|
1455 |
+
|
1456 |
+
if ( $this->set_field_type == 'row' ) {
|
1457 |
+
$back = 'UM_edit_row';
|
1458 |
+
|
1459 |
+
?>
|
1460 |
+
|
1461 |
+
<p class="_heading_text"><label for="_icon"><?php _e( 'Icon', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
1462 |
+
|
1463 |
+
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php _e( 'Choose Icon', 'ultimate-member' ) ?></a>
|
1464 |
+
|
1465 |
+
<span class="um-admin-icon-value"><?php if ( $this->edit_mode_value ) { ?><i class="<?php echo $this->edit_mode_value; ?>"></i><?php } else { ?><?php _e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
|
1466 |
+
|
1467 |
+
<input type="hidden" name="_icon" id="_icon" value="<?php echo (isset( $this->edit_mode_value ) ) ? $this->edit_mode_value : ''; ?>" />
|
1468 |
+
|
1469 |
+
<?php if ( $this->edit_mode_value ) { ?>
|
1470 |
+
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
1471 |
+
<?php } else { ?>
|
1472 |
+
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
|
1473 |
+
<?php } ?>
|
1474 |
+
|
1475 |
+
</p>
|
1476 |
+
|
1477 |
+
<?php } else {
|
1478 |
+
|
1479 |
+
if ( $this->in_edit ) {
|
1480 |
+
$back = 'UM_edit_field';
|
1481 |
+
} else {
|
1482 |
+
$back = 'UM_add_field';
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
?>
|
1486 |
+
|
1487 |
+
<div class="um-admin-tri">
|
1488 |
+
|
1489 |
+
<p><label for="_icon"><?php _e( 'Icon', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select an icon to appear in the field. Leave blank if you do not want an icon to show in the field.', 'ultimate-member' ) ); ?></label>
|
1490 |
+
|
1491 |
+
<a href="javascript:void(0);" class="button" data-modal="UM_fonticons" data-modal-size="normal" data-dynamic-content="um_admin_fonticon_selector" data-arg1="" data-arg2="" data-back="<?php echo esc_attr( $back ); ?>"><?php _e( 'Choose Icon', 'ultimate-member' ) ?></a>
|
1492 |
+
|
1493 |
+
<span class="um-admin-icon-value"><?php if ( $this->edit_mode_value ) { ?><i class="<?php echo $this->edit_mode_value; ?>"></i><?php } else { ?><?php _e( 'No Icon', 'ultimate-member' ) ?><?php } ?></span>
|
1494 |
+
|
1495 |
+
<input type="hidden" name="_icon" id="_icon" value="<?php echo (isset( $this->edit_mode_value ) ) ? $this->edit_mode_value : ''; ?>" />
|
1496 |
+
|
1497 |
+
<?php if ( $this->edit_mode_value ) { ?>
|
1498 |
+
<span class="um-admin-icon-clear show"><i class="um-icon-android-cancel"></i></span>
|
1499 |
+
<?php } else { ?>
|
1500 |
+
<span class="um-admin-icon-clear"><i class="um-icon-android-cancel"></i></span>
|
1501 |
+
<?php } ?>
|
1502 |
+
|
1503 |
+
</p>
|
1504 |
+
|
1505 |
+
</div>
|
1506 |
+
|
1507 |
+
<?php
|
1508 |
+
|
1509 |
+
}
|
1510 |
+
|
1511 |
+
break;
|
1512 |
+
|
1513 |
+
case '_css_class':
|
1514 |
+
?>
|
1515 |
+
|
1516 |
+
<p><label for="_css_class"><?php _e( 'CSS Class', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Specify a custom CSS class to be applied to this element', 'ultimate-member' ) ); ?></label>
|
1517 |
+
<input type="text" name="_css_class" id="_css_class" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1518 |
+
</p>
|
1519 |
+
|
1520 |
+
<?php
|
1521 |
+
break;
|
1522 |
+
|
1523 |
+
case '_width':
|
1524 |
+
?>
|
1525 |
+
|
1526 |
+
<p><label for="_width"><?php _e( 'Thickness (in pixels)', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the width in pixels, e.g. 4 or 2, etc', 'ultimate-member' ) ); ?></label>
|
1527 |
+
<input type="text" name="_width" id="_width" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 4; ?>" />
|
1528 |
+
</p>
|
1529 |
+
|
1530 |
+
<?php
|
1531 |
+
break;
|
1532 |
+
|
1533 |
+
case '_divider_text':
|
1534 |
+
?>
|
1535 |
+
|
1536 |
+
<p><label for="_divider_text"><?php _e( 'Optional Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Optional text to include with the divider', 'ultimate-member' ) ); ?></label>
|
1537 |
+
<input type="text" name="_divider_text" id="_divider_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1538 |
+
</p>
|
1539 |
+
|
1540 |
+
<?php
|
1541 |
+
break;
|
1542 |
+
|
1543 |
+
case '_padding':
|
1544 |
+
?>
|
1545 |
+
|
1546 |
+
<p><label for="_padding"><?php _e( 'Padding', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set padding for this section', 'ultimate-member' ) ); ?></label>
|
1547 |
+
<input type="text" name="_padding" id="_padding" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 0px 0px'; ?>" />
|
1548 |
+
</p>
|
1549 |
+
|
1550 |
+
<?php
|
1551 |
+
break;
|
1552 |
+
|
1553 |
+
case '_margin':
|
1554 |
+
?>
|
1555 |
+
|
1556 |
+
<p><label for="_margin"><?php _e( 'Margin', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set margin for this section', 'ultimate-member' ) ); ?></label>
|
1557 |
+
<input type="text" name="_margin" id="_margin" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 30px 0px'; ?>" />
|
1558 |
+
</p>
|
1559 |
+
|
1560 |
+
<?php
|
1561 |
+
break;
|
1562 |
+
|
1563 |
+
case '_border':
|
1564 |
+
?>
|
1565 |
+
|
1566 |
+
<p><label for="_border"><?php _e( 'Border', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set border for this section', 'ultimate-member' ) ); ?></label>
|
1567 |
+
<input type="text" name="_border" id="_border" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px 0px 0px 0px'; ?>" />
|
1568 |
+
</p>
|
1569 |
+
|
1570 |
+
<?php
|
1571 |
+
break;
|
1572 |
+
|
1573 |
+
case '_borderstyle':
|
1574 |
+
?>
|
1575 |
+
|
1576 |
+
<p><label for="_borderstyle"><?php _e( 'Style', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose the border style', 'ultimate-member' ) ); ?></label>
|
1577 |
+
<select name="_borderstyle" id="_borderstyle" style="width: 100%">
|
1578 |
+
<option value="solid" <?php selected( 'solid', $this->edit_mode_value ); ?>><?php _e( 'Solid', 'ultimate-member' ) ?></option>
|
1579 |
+
<option value="dotted" <?php selected( 'dotted', $this->edit_mode_value ); ?>><?php _e( 'Dotted', 'ultimate-member' ) ?></option>
|
1580 |
+
<option value="dashed" <?php selected( 'dashed', $this->edit_mode_value ); ?>><?php _e( 'Dashed', 'ultimate-member' ) ?></option>
|
1581 |
+
<option value="double" <?php selected( 'double', $this->edit_mode_value ); ?>><?php _e( 'Double', 'ultimate-member' ) ?></option>
|
1582 |
+
</select>
|
1583 |
+
</p>
|
1584 |
+
|
1585 |
+
<?php
|
1586 |
+
break;
|
1587 |
+
|
1588 |
+
case '_borderradius':
|
1589 |
+
?>
|
1590 |
+
|
1591 |
+
<p><label for="_borderradius"><?php _e( 'Border Radius', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Rounded corners can be applied by setting a pixels value here. e.g. 5px', 'ultimate-member' ) ); ?></label>
|
1592 |
+
<input type="text" name="_borderradius" id="_borderradius" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '0px'; ?>" />
|
1593 |
+
</p>
|
1594 |
+
|
1595 |
+
<?php
|
1596 |
+
break;
|
1597 |
+
|
1598 |
+
case '_bordercolor':
|
1599 |
+
?>
|
1600 |
+
|
1601 |
+
<p><label for="_bordercolor"><?php _e( 'Border Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Give a color to this border', 'ultimate-member' ) ); ?></label>
|
1602 |
+
<input type="text" name="_bordercolor" id="_bordercolor" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1603 |
+
</p>
|
1604 |
+
|
1605 |
+
<?php
|
1606 |
+
break;
|
1607 |
+
|
1608 |
+
case '_heading':
|
1609 |
+
?>
|
1610 |
+
|
1611 |
+
<p><label for="_heading"><?php _e( 'Enable Row Heading', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether to enable a heading for this row', 'ultimate-member' ) ); ?></label>
|
1612 |
+
<input type="checkbox" name="_heading" id="_heading" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> class="um-adm-conditional" data-cond1="1" data-cond1-show="_heading_text" data-cond1-hide="xxx" />
|
1613 |
+
</p>
|
1614 |
+
|
1615 |
+
<?php
|
1616 |
+
break;
|
1617 |
+
|
1618 |
+
case '_heading_text':
|
1619 |
+
?>
|
1620 |
+
|
1621 |
+
<p class="_heading_text"><label for="_heading_text"><?php _e( 'Heading Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enter the row heading text here', 'ultimate-member' ) ); ?></label>
|
1622 |
+
<input type="text" name="_heading_text" id="_heading_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1623 |
+
</p>
|
1624 |
+
|
1625 |
+
<?php
|
1626 |
+
break;
|
1627 |
+
|
1628 |
+
case '_background':
|
1629 |
+
?>
|
1630 |
+
|
1631 |
+
<p><label for="_background"><?php _e( 'Background Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the background of entire section', 'ultimate-member' ) ); ?></label>
|
1632 |
+
<input type="text" name="_background" id="_background" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1633 |
+
</p>
|
1634 |
+
|
1635 |
+
<?php
|
1636 |
+
break;
|
1637 |
+
|
1638 |
+
case '_heading_background_color':
|
1639 |
+
?>
|
1640 |
+
|
1641 |
+
<p class="_heading_text"><label for="_heading_background_color"><?php _e( 'Heading Background Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the background of the heading section', 'ultimate-member' ) ); ?></label>
|
1642 |
+
<input type="text" name="_heading_background_color" id="_heading_background_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1643 |
+
</p>
|
1644 |
+
|
1645 |
+
<?php
|
1646 |
+
break;
|
1647 |
+
|
1648 |
+
case '_heading_text_color':
|
1649 |
+
?>
|
1650 |
+
|
1651 |
+
<p class="_heading_text"><label for="_heading_text_color"><?php _e( 'Heading Text Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the text color of heading part only', 'ultimate-member' ) ); ?></label>
|
1652 |
+
<input type="text" name="_heading_text_color" id="_heading_text_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1653 |
+
</p>
|
1654 |
+
|
1655 |
+
<?php
|
1656 |
+
break;
|
1657 |
+
|
1658 |
+
case '_text_color':
|
1659 |
+
?>
|
1660 |
+
|
1661 |
+
<p><label for="_text_color"><?php _e( 'Text Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the text color of entire section', 'ultimate-member' ) ); ?></label>
|
1662 |
+
<input type="text" name="_text_color" id="_text_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1663 |
+
</p>
|
1664 |
+
|
1665 |
+
<?php
|
1666 |
+
break;
|
1667 |
+
|
1668 |
+
case '_icon_color':
|
1669 |
+
?>
|
1670 |
+
|
1671 |
+
<p class="_heading_text"><label for="_icon_color"><?php _e( 'Icon Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This will be the color of selected icon. By default It will be the same color as heading text color', 'ultimate-member' ) ); ?></label>
|
1672 |
+
<input type="text" name="_icon_color" id="_icon_color" class="um-admin-colorpicker" data-default-color="" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1673 |
+
</p>
|
1674 |
+
|
1675 |
+
<?php
|
1676 |
+
break;
|
1677 |
+
|
1678 |
+
case '_color':
|
1679 |
+
?>
|
1680 |
+
|
1681 |
+
<p><label for="_color"><?php _e( 'Color', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select a color for this divider', 'ultimate-member' ) ); ?></label>
|
1682 |
+
<input type="text" name="_color" id="_color" class="um-admin-colorpicker" data-default-color="#eeeeee" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '#eeeeee'; ?>" />
|
1683 |
+
</p>
|
1684 |
+
|
1685 |
+
<?php
|
1686 |
+
break;
|
1687 |
+
|
1688 |
+
case '_url_text':
|
1689 |
+
?>
|
1690 |
+
|
1691 |
+
<p><label for="_url_text"><?php _e( 'URL Alt Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Entering custom text here will replace the url with a text link', 'ultimate-member' ) ); ?></label>
|
1692 |
+
<input type="text" name="_url_text" id="_url_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : ''; ?>" />
|
1693 |
+
</p>
|
1694 |
+
|
1695 |
+
<?php
|
1696 |
+
break;
|
1697 |
+
|
1698 |
+
case '_url_target':
|
1699 |
+
?>
|
1700 |
+
|
1701 |
+
<p><label for="_url_target"><?php _e( 'Link Target', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose whether to open this link in same window or in a new window', 'ultimate-member' ) ); ?></label>
|
1702 |
+
<select name="_url_target" id="_url_target" style="width: 100%">
|
1703 |
+
<option value="_blank" <?php selected( '_blank', $this->edit_mode_value ); ?>><?php _e( 'Open in new window', 'ultimate-member' ) ?></option>
|
1704 |
+
<option value="_self" <?php selected( '_self', $this->edit_mode_value ); ?>><?php _e( 'Same window', 'ultimate-member' ) ?></option>
|
1705 |
+
</select>
|
1706 |
+
</p>
|
1707 |
+
|
1708 |
+
<?php
|
1709 |
+
break;
|
1710 |
+
|
1711 |
+
case '_url_rel':
|
1712 |
+
?>
|
1713 |
+
|
1714 |
+
<p><label for="_url_rel"><?php _e( 'SEO Follow', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether to follow or nofollow this link by search engines', 'ultimate-member' ) ); ?></label>
|
1715 |
+
<select name="_url_rel" id="_url_rel" style="width: 100%">
|
1716 |
+
<option value="follow" <?php selected( 'follow', $this->edit_mode_value ); ?>><?php _e( 'Follow', 'ultimate-member' ) ?></option>
|
1717 |
+
<option value="nofollow" <?php selected( 'nofollow', $this->edit_mode_value ); ?>><?php _e( 'No-Follow', 'ultimate-member' ) ?></option>
|
1718 |
+
</select>
|
1719 |
+
</p>
|
1720 |
+
|
1721 |
+
<?php
|
1722 |
+
break;
|
1723 |
+
|
1724 |
+
case '_force_good_pass':
|
1725 |
+
?>
|
1726 |
+
|
1727 |
+
<p><label for="_force_good_pass"><?php _e( 'Force strong password?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Turn on to force users to create a strong password (A combination of one lowercase letter, one uppercase letter, and one number). If turned on this option is only applied to register forms and not to login forms.', 'ultimate-member' ) ); ?></label>
|
1728 |
+
<input type="checkbox" name="_force_good_pass" id="_force_good_pass" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> />
|
1729 |
+
</p>
|
1730 |
+
|
1731 |
+
<?php
|
1732 |
+
break;
|
1733 |
+
|
1734 |
+
case '_force_confirm_pass':
|
1735 |
+
?>
|
1736 |
+
|
1737 |
+
<p><label for="_force_confirm_pass"><?php _e( 'Automatically add a confirm password field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Turn on to add a confirm password field. If turned on the confirm password field will only show on register forms and not on login forms.', 'ultimate-member' ) ); ?></label>
|
1738 |
+
<input type="checkbox" name="_force_confirm_pass" id="_force_confirm_pass" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> class="um-adm-conditional" data-cond1="1" data-cond1-show="_label_confirm_pass" data-cond1-hide="xxx" />
|
1739 |
+
</p>
|
1740 |
+
|
1741 |
+
<?php
|
1742 |
+
break;
|
1743 |
+
|
1744 |
+
case '_style':
|
1745 |
+
?>
|
1746 |
+
|
1747 |
+
<p><label for="_style"><?php _e( 'Style', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the line-style of divider', 'ultimate-member' ) ); ?></label>
|
1748 |
+
<select name="_style" id="_style" style="width: 100%">
|
1749 |
+
<option value="solid" <?php selected( 'solid', $this->edit_mode_value ); ?>><?php _e( 'Solid', 'ultimate-member' ) ?></option>
|
1750 |
+
<option value="dotted" <?php selected( 'dotted', $this->edit_mode_value ); ?>><?php _e( 'Dotted', 'ultimate-member' ) ?></option>
|
1751 |
+
<option value="dashed" <?php selected( 'dashed', $this->edit_mode_value ); ?>><?php _e( 'Dashed', 'ultimate-member' ) ?></option>
|
1752 |
+
<option value="double" <?php selected( 'double', $this->edit_mode_value ); ?>><?php _e( 'Double', 'ultimate-member' ) ?></option>
|
1753 |
+
</select>
|
1754 |
+
</p>
|
1755 |
+
|
1756 |
+
<?php
|
1757 |
+
break;
|
1758 |
+
|
1759 |
+
case '_intervals':
|
1760 |
+
|
1761 |
+
?>
|
1762 |
+
|
1763 |
+
<p><label for="_intervals"><?php _e( 'Time Intervals (in minutes)', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose the minutes interval between each time in the time picker.', 'ultimate-member' ) ); ?></label>
|
1764 |
+
<input type="text" name="_intervals" id="_intervals" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 60; ?>" placeholder="<?php esc_attr_e( 'e.g. 30, 60, 120', 'ultimate-member' ) ?>" />
|
1765 |
+
</p>
|
1766 |
+
|
1767 |
+
<?php
|
1768 |
+
break;
|
1769 |
+
|
1770 |
+
|
1771 |
+
case '_format':
|
1772 |
+
|
1773 |
+
if ( $this->set_field_type == 'date' ) {
|
1774 |
+
?>
|
1775 |
+
|
1776 |
+
<p><label for="_format"><?php _e( 'Date User-Friendly Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The display format of the date which is visible to user.', 'ultimate-member' ) ); ?></label>
|
1777 |
+
<select name="_format" id="_format" style="width: 100%">
|
1778 |
+
<option value="j M Y" <?php selected( 'j M Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('j M Y'); ?></option>
|
1779 |
+
<option value="M j Y" <?php selected( 'M j Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('M j Y'); ?></option>
|
1780 |
+
<option value="j F Y" <?php selected( 'j F Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('j F Y'); ?></option>
|
1781 |
+
<option value="F j Y" <?php selected( 'F j Y', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('F j Y'); ?></option>
|
1782 |
+
</select>
|
1783 |
+
</p>
|
1784 |
+
|
1785 |
+
<?php } else { ?>
|
1786 |
+
|
1787 |
+
<p><label for="_format"><?php _e( 'Time Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose the displayed time-format for this field', 'ultimate-member' ) ); ?></label>
|
1788 |
+
<select name="_format" id="_format" style="width: 100%">
|
1789 |
+
<option value="g:i a" <?php selected( 'g:i a', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('g:i a'); ?><?php _e( '( 12-hr format )', 'ultimate-member' ) ?></option>
|
1790 |
+
<option value="g:i A" <?php selected( 'g:i A', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('g:i A'); ?><?php _e( '( 12-hr format )', 'ultimate-member' ) ?></option>
|
1791 |
+
<option value="H:i" <?php selected( 'H:i', $this->edit_mode_value ); ?>><?php echo UM()->datetime()->get_time('H:i'); ?><?php _e( '( 24-hr format )', 'ultimate-member' ) ?></option>
|
1792 |
+
</select>
|
1793 |
+
</p>
|
1794 |
+
|
1795 |
+
<?php
|
1796 |
+
}
|
1797 |
+
break;
|
1798 |
+
|
1799 |
+
case '_format_custom':
|
1800 |
+
?>
|
1801 |
+
|
1802 |
+
<p><label for="_format_custom"><?php _e( 'Use custom Date format', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option overrides "Date User-Friendly Format" option. See https://www.php.net/manual/en/function.date.php', 'ultimate-member' ) ); ?></label>
|
1803 |
+
<input type="text" name="_format_custom" id="_format_custom" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" placeholder="j M Y" />
|
1804 |
+
</p>
|
1805 |
+
|
1806 |
+
<?php
|
1807 |
+
break;
|
1808 |
+
|
1809 |
+
case '_pretty_format':
|
1810 |
+
?>
|
1811 |
+
|
1812 |
+
<p><label for="_pretty_format"><?php _e( 'Displayed Date Format', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether you wish to show the date in full or only show the years e.g. 25 Years', 'ultimate-member' ) ); ?></label>
|
1813 |
+
<select name="_pretty_format" id="_pretty_format" style="width: 100%">
|
1814 |
+
<option value="0" <?php selected( 0, $this->edit_mode_value ); ?>><?php _e( 'Show full date', 'ultimate-member' ) ?></option>
|
1815 |
+
<option value="1" <?php selected( 1, $this->edit_mode_value ); ?>><?php _e( 'Show years only', 'ultimate-member' ) ?></option>
|
1816 |
+
</select>
|
1817 |
+
</p>
|
1818 |
+
|
1819 |
+
<?php
|
1820 |
+
break;
|
1821 |
+
|
1822 |
+
case '_disabled_weekdays':
|
1823 |
+
|
1824 |
+
if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) {
|
1825 |
+
$values = $this->edit_mode_value;
|
1826 |
+
} else {
|
1827 |
+
$values = array('');
|
1828 |
+
}
|
1829 |
+
?>
|
1830 |
+
|
1831 |
+
<p><label for="_disabled_weekdays"><?php _e( 'Disable specific weekdays', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Disable specific week days from being available for selection in this date picker', 'ultimate-member' ) ); ?></label>
|
1832 |
+
<select name="_disabled_weekdays[]" id="_disabled_weekdays" multiple="multiple" style="width: 100%">
|
1833 |
+
<option value="1" <?php if ( in_array( 1, $values ) ) { echo 'selected'; } ?>><?php _e( 'Sunday', 'ultimate-member' ) ?></option>
|
1834 |
+
<option value="2" <?php if ( in_array( 2, $values ) ) { echo 'selected'; } ?>><?php _e( 'Monday', 'ultimate-member' ) ?></option>
|
1835 |
+
<option value="3" <?php if ( in_array( 3, $values ) ) { echo 'selected'; } ?>><?php _e( 'Tuesday', 'ultimate-member' ) ?></option>
|
1836 |
+
<option value="4" <?php if ( in_array( 4, $values ) ) { echo 'selected'; } ?>><?php _e( 'Wednesday', 'ultimate-member' ) ?></option>
|
1837 |
+
<option value="5" <?php if ( in_array( 5, $values ) ) { echo 'selected'; } ?>><?php _e( 'Thursday', 'ultimate-member' ) ?></option>
|
1838 |
+
<option value="6" <?php if ( in_array( 6, $values ) ) { echo 'selected'; } ?>><?php _e( 'Friday', 'ultimate-member' ) ?></option>
|
1839 |
+
<option value="7" <?php if ( in_array( 7, $values ) ) { echo 'selected'; } ?>><?php _e( 'Saturday', 'ultimate-member' ) ?></option>
|
1840 |
+
</select>
|
1841 |
+
</p>
|
1842 |
+
|
1843 |
+
<?php
|
1844 |
+
break;
|
1845 |
+
|
1846 |
+
case '_years':
|
1847 |
+
?>
|
1848 |
+
|
1849 |
+
<p class="_years"><label for="_years"><?php _e( 'Number of Years to pick from', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Number of years available for the date selection. Default to last 50 years', 'ultimate-member' ) ); ?></label>
|
1850 |
+
<input type="text" name="_years" id="_years" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 50; ?>" />
|
1851 |
+
</p>
|
1852 |
+
|
1853 |
+
<?php
|
1854 |
+
break;
|
1855 |
+
|
1856 |
+
case '_years_x':
|
1857 |
+
?>
|
1858 |
+
|
1859 |
+
<p class="_years"><label for="_years_x"><?php _e( 'Years Selection', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This decides which years should be shown relative to today date', 'ultimate-member' ) ); ?></label>
|
1860 |
+
<select name="_years_x" id="_years_x" style="width: 100%">
|
1861 |
+
<option value="equal" <?php selected( 'equal', $this->edit_mode_value ); ?>><?php _e( 'Equal years before / after today', 'ultimate-member' ) ?></option>
|
1862 |
+
<option value="past" <?php selected( 'past', $this->edit_mode_value ); ?>><?php _e( 'Past years only', 'ultimate-member' ) ?></option>
|
1863 |
+
<option value="future" <?php selected( 'future', $this->edit_mode_value ); ?>><?php _e( 'Future years only', 'ultimate-member' ) ?></option>
|
1864 |
+
</select>
|
1865 |
+
</p>
|
1866 |
+
|
1867 |
+
<?php
|
1868 |
+
break;
|
1869 |
+
|
1870 |
+
case '_range_start':
|
1871 |
+
?>
|
1872 |
+
|
1873 |
+
<p class="_date_range"><label for="_range_start"><?php _e( 'Date Range Start', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set the minimum date/day in range in the format YYYY/MM/DD', 'ultimate-member' ) ); ?></label>
|
1874 |
+
<input type="text" name="_range_start" id="_range_start" value="<?php echo $this->edit_mode_value; ?>" placeholder="<?php esc_attr_e( 'YYYY/MM/DD', 'ultimate-member' ) ?>" />
|
1875 |
+
</p>
|
1876 |
+
|
1877 |
+
<?php
|
1878 |
+
break;
|
1879 |
+
|
1880 |
+
case '_range_end':
|
1881 |
+
?>
|
1882 |
+
|
1883 |
+
<p class="_date_range"><label for="_range_end"><?php _e( 'Date Range End', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Set the maximum date/day in range in the format YYYY/MM/DD', 'ultimate-member' ) ); ?></label>
|
1884 |
+
<input type="text" name="_range_end" id="_range_end" value="<?php echo $this->edit_mode_value; ?>" placeholder="<?php esc_attr_e( 'YYYY/MM/DD', 'ultimate-member' ) ?>" />
|
1885 |
+
</p>
|
1886 |
+
|
1887 |
+
<?php
|
1888 |
+
break;
|
1889 |
+
|
1890 |
+
case '_range':
|
1891 |
+
?>
|
1892 |
+
|
1893 |
+
<p><label for="_range"><?php _e( 'Set Date Range', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Whether to show a specific number of years or specify a date range to be available for the date picker.', 'ultimate-member' ) ); ?></label>
|
1894 |
+
<select name="_range" id="_range" class="um-adm-conditional" data-cond1='years' data-cond1-show='_years' data-cond2="date_range" data-cond2-show="_date_range" style="width: 100%">
|
1895 |
+
<option value="years" <?php selected( 'years', $this->edit_mode_value ); ?>><?php _e( 'Fixed Number of Years', 'ultimate-member' ) ?></option>
|
1896 |
+
<option value="date_range" <?php selected( 'date_range', $this->edit_mode_value ); ?>><?php _e( 'Specific Date Range', 'ultimate-member' ) ?></option>
|
1897 |
+
</select>
|
1898 |
+
</p>
|
1899 |
+
|
1900 |
+
<?php
|
1901 |
+
break;
|
1902 |
+
|
1903 |
+
case '_content':
|
1904 |
+
|
1905 |
+
if ( $this->set_field_type == 'shortcode' ) {
|
1906 |
+
|
1907 |
+
?>
|
1908 |
+
|
1909 |
+
<p><label for="_content"><?php _e( 'Enter Shortcode', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enter the shortcode in the following textarea and it will be displayed on the fields', 'ultimate-member' ) ); ?></label>
|
1910 |
+
<textarea name="_content" id="_content" placeholder="<?php esc_attr_e( 'e.g. [my_custom_shortcode]', 'ultimate-member' ) ?>"><?php echo $this->edit_mode_value; ?></textarea>
|
1911 |
+
</p>
|
1912 |
+
|
1913 |
+
<?php
|
1914 |
+
|
1915 |
+
} else {
|
1916 |
+
|
1917 |
+
?>
|
1918 |
+
|
1919 |
+
<div class="um-admin-editor-h"><label><?php _e( 'Content Editor', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Edit the content of this field here', 'ultimate-member' ) ); ?></label></div>
|
1920 |
+
|
1921 |
+
<div class="um-admin-editor"><!-- editor dynamically loaded here --></div>
|
1922 |
+
|
1923 |
+
<?php
|
1924 |
+
|
1925 |
+
}
|
1926 |
+
|
1927 |
+
break;
|
1928 |
+
|
1929 |
+
case '_crop':
|
1930 |
+
?>
|
1931 |
+
|
1932 |
+
<p><label for="_crop"><?php _e( 'Crop Feature', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enable/disable crop feature for this image upload and define ratio', 'ultimate-member' ) ); ?></label>
|
1933 |
+
<select name="_crop" id="_crop" style="width: 100%">
|
1934 |
+
<option value="0" <?php selected( '0', $this->edit_mode_value ); ?>><?php _e( 'Turn Off (Default)', 'ultimate-member' ) ?></option>
|
1935 |
+
<option value="1" <?php selected( '1', $this->edit_mode_value ); ?>><?php _e( 'Crop and force 1:1 ratio', 'ultimate-member' ) ?></option>
|
1936 |
+
<option value="3" <?php selected( '3', $this->edit_mode_value ); ?>><?php _e( 'Crop and force user-defined ratio', 'ultimate-member' ) ?></option>
|
1937 |
+
</select>
|
1938 |
+
</p>
|
1939 |
+
|
1940 |
+
<?php
|
1941 |
+
break;
|
1942 |
+
|
1943 |
+
case '_allowed_types':
|
1944 |
+
|
1945 |
+
if ( $this->set_field_type == 'image' ) {
|
1946 |
+
|
1947 |
+
if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) {
|
1948 |
+
$values = $this->edit_mode_value;
|
1949 |
+
} else {
|
1950 |
+
$values = array( 'png','jpeg','jpg','gif' );
|
1951 |
+
} ?>
|
1952 |
+
|
1953 |
+
<p><label for="_allowed_types"><?php _e( 'Allowed Image Types', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select the image types that you want to allow to be uploaded via this field.', 'ultimate-member' ) ); ?></label>
|
1954 |
+
<select name="_allowed_types[]" id="_allowed_types" multiple="multiple" style="width: 100%">
|
1955 |
+
<?php foreach( UM()->files()->allowed_image_types() as $e => $n ) { ?>
|
1956 |
+
<option value="<?php echo $e; ?>" <?php if ( in_array( $e, $values ) ) { echo 'selected'; } ?>><?php echo $n; ?></option>
|
1957 |
+
<?php } ?>
|
1958 |
+
</select>
|
1959 |
+
</p>
|
1960 |
+
|
1961 |
+
<?php
|
1962 |
+
|
1963 |
+
} else {
|
1964 |
+
|
1965 |
+
if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) {
|
1966 |
+
$values = $this->edit_mode_value;
|
1967 |
+
} else {
|
1968 |
+
$values = array( 'pdf', 'txt' );
|
1969 |
+
} ?>
|
1970 |
+
|
1971 |
+
<p><label for="_allowed_types"><?php _e( 'Allowed File Types', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select the image types that you want to allow to be uploaded via this field.', 'ultimate-member' ) ); ?></label>
|
1972 |
+
<select name="_allowed_types[]" id="_allowed_types" multiple="multiple" style="width: 100%">
|
1973 |
+
<?php foreach( UM()->files()->allowed_file_types() as $e => $n ) { ?>
|
1974 |
+
<option value="<?php echo $e; ?>" <?php if ( in_array( $e, $values ) ) { echo 'selected'; } ?>><?php echo $n; ?></option>
|
1975 |
+
<?php } ?>
|
1976 |
+
</select>
|
1977 |
+
</p>
|
1978 |
+
|
1979 |
+
<?php
|
1980 |
+
|
1981 |
+
}
|
1982 |
+
|
1983 |
+
break;
|
1984 |
+
|
1985 |
+
case '_upload_text':
|
1986 |
+
|
1987 |
+
if ( $this->set_field_type == 'image' ) {
|
1988 |
+
$value = __( 'Drag & Drop Photo', 'ultimate-member' );
|
1989 |
+
}
|
1990 |
+
if ( $this->set_field_type == 'file' ) {
|
1991 |
+
$value = __( 'Drag & Drop File', 'ultimate-member' );
|
1992 |
+
}
|
1993 |
+
|
1994 |
+
?>
|
1995 |
+
|
1996 |
+
<p><label for="_upload_text"><?php _e( 'Upload Box Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the headline that appears in the upload box for this field', 'ultimate-member' ) ); ?></label>
|
1997 |
+
<input type="text" name="_upload_text" id="_upload_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : $value; ?>" />
|
1998 |
+
</p>
|
1999 |
+
|
2000 |
+
<?php
|
2001 |
+
break;
|
2002 |
+
|
2003 |
+
case '_upload_help_text':
|
2004 |
+
?>
|
2005 |
+
|
2006 |
+
<p><label for="_upload_help_text"><?php _e( 'Additional Instructions Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'If you need to add information or secondary line below the headline of upload box, enter it here', 'ultimate-member' ) ); ?></label>
|
2007 |
+
<input type="text" name="_upload_help_text" id="_upload_help_text" value="<?php echo $this->edit_mode_value; ?>" />
|
2008 |
+
</p>
|
2009 |
+
|
2010 |
+
<?php
|
2011 |
+
break;
|
2012 |
+
|
2013 |
+
case '_button_text':
|
2014 |
+
?>
|
2015 |
+
|
2016 |
+
<p><label for="_button_text"><?php _e( 'Upload Box Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The text that appears on the button. e.g. Upload', 'ultimate-member' ) ); ?></label>
|
2017 |
+
<input type="text" name="_button_text" id="_button_text" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : __( 'Upload', 'ultimate-member' ); ?>" />
|
2018 |
+
</p>
|
2019 |
+
|
2020 |
+
<?php
|
2021 |
+
break;
|
2022 |
+
|
2023 |
+
case '_max_size':
|
2024 |
+
?>
|
2025 |
+
|
2026 |
+
<p><label for="_max_size"><?php _e( 'Maximum Size in bytes', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The maximum size for image that can be uploaded through this field. Leave empty for unlimited size.', 'ultimate-member' ) ); ?></label>
|
2027 |
+
<input type="text" name="_max_size" id="_max_size" value="<?php echo $this->edit_mode_value; ?>" />
|
2028 |
+
</p>
|
2029 |
+
|
2030 |
+
<?php
|
2031 |
+
break;
|
2032 |
+
|
2033 |
+
case '_height':
|
2034 |
+
?>
|
2035 |
+
|
2036 |
+
<p><label for="_height"><?php _e( 'Textarea Height', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The height of textarea in pixels. Default is 100 pixels', 'ultimate-member' ) ); ?></label>
|
2037 |
+
<input type="text" name="_height" id="_height" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '100px'; ?>" />
|
2038 |
+
</p>
|
2039 |
+
|
2040 |
+
<?php
|
2041 |
+
break;
|
2042 |
+
|
2043 |
+
case '_spacing':
|
2044 |
+
?>
|
2045 |
+
|
2046 |
+
<p><label for="_spacing"><?php _e( 'Spacing', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the required spacing in pixels. e.g. 20px', 'ultimate-member' ) ); ?></label>
|
2047 |
+
<input type="text" name="_spacing" id="_spacing" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : '20px'; ?>" />
|
2048 |
+
</p>
|
2049 |
+
|
2050 |
+
<?php
|
2051 |
+
break;
|
2052 |
+
|
2053 |
+
case '_is_multi':
|
2054 |
+
?>
|
2055 |
+
|
2056 |
+
<p><label for="_is_multi"><?php _e( 'Allow multiple selections', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enable/disable multiple selections for this field', 'ultimate-member' ) ); ?></label>
|
2057 |
+
<input type="checkbox" name="_is_multi" id="_is_multi" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> class="um-adm-conditional" data-cond1="1" data-cond1-show="_max_selections" data-cond1-hide="xxx" />
|
2058 |
+
</p>
|
2059 |
+
|
2060 |
+
<?php
|
2061 |
+
break;
|
2062 |
+
|
2063 |
+
case '_max_selections':
|
2064 |
+
?>
|
2065 |
+
|
2066 |
+
<p class="_max_selections"><label for="_max_selections"><?php _e( 'Maximum number of selections', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enter a number here to force a maximum number of selections by user for this field', 'ultimate-member' ) ); ?></label>
|
2067 |
+
<input type="text" name="_max_selections" id="_max_selections" value="<?php echo $this->edit_mode_value; ?>" />
|
2068 |
+
</p>
|
2069 |
+
|
2070 |
+
<?php
|
2071 |
+
break;
|
2072 |
+
|
2073 |
+
case '_min_selections':
|
2074 |
+
?>
|
2075 |
+
|
2076 |
+
<p class="_min_selections"><label for="_min_selections"><?php _e( 'Minimum number of selections', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enter a number here to force a minimum number of selections by user for this field', 'ultimate-member' ) ); ?></label>
|
2077 |
+
<input type="text" name="_min_selections" id="_min_selections" value="<?php echo $this->edit_mode_value; ?>" />
|
2078 |
+
</p>
|
2079 |
+
|
2080 |
+
<?php
|
2081 |
+
break;
|
2082 |
+
|
2083 |
+
case '_max_entries':
|
2084 |
+
?>
|
2085 |
+
|
2086 |
+
<p class="_max_entries"><label for="_max_selections"><?php _e( 'Maximum number of entries', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the max number of entries the user can add via field group.', 'ultimate-member' ) ); ?></label>
|
2087 |
+
<input type="text" name="_max_entries" id="_max_entries" value="<?php echo ( $this->edit_mode_value ) ? $this->edit_mode_value : 10; ?>" />
|
2088 |
+
</p>
|
2089 |
+
|
2090 |
+
<?php
|
2091 |
+
break;
|
2092 |
+
|
2093 |
+
case '_max_words':
|
2094 |
+
?>
|
2095 |
+
|
2096 |
+
<p><label for="_max_words"><?php _e( 'Maximum allowed words', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'If you want to enable a maximum number of words to be input in this textarea. Leave empty to disable this setting', 'ultimate-member' ) ); ?></label>
|
2097 |
+
<input type="text" name="_max_words" id="_max_words" value="<?php echo $this->edit_mode_value; ?>" />
|
2098 |
+
</p>
|
2099 |
+
|
2100 |
+
<?php
|
2101 |
+
break;
|
2102 |
+
|
2103 |
+
case '_min':
|
2104 |
+
?>
|
2105 |
+
|
2106 |
+
<p><label for="_min"><?php _e( 'Minimum Number', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Minimum number that can be entered in this field', 'ultimate-member' ) ); ?></label>
|
2107 |
+
<input type="text" name="_min" id="_min" value="<?php echo $this->edit_mode_value; ?>" />
|
2108 |
+
</p>
|
2109 |
+
|
2110 |
+
<?php
|
2111 |
+
break;
|
2112 |
+
|
2113 |
+
case '_max':
|
2114 |
+
?>
|
2115 |
+
|
2116 |
+
<p><label for="_max"><?php _e( 'Maximum Number', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Maximum number that can be entered in this field', 'ultimate-member' ) ); ?></label>
|
2117 |
+
<input type="text" name="_max" id="_max" value="<?php echo $this->edit_mode_value; ?>" />
|
2118 |
+
</p>
|
2119 |
+
|
2120 |
+
<?php
|
2121 |
+
break;
|
2122 |
+
|
2123 |
+
case '_min_chars':
|
2124 |
+
?>
|
2125 |
+
|
2126 |
+
<p><label for="_min_chars"><?php _e( 'Minimum length', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'If you want to enable a minimum number of characters to be input in this field. Leave empty to disable this setting', 'ultimate-member' ) ); ?></label>
|
2127 |
+
<input type="text" name="_min_chars" id="_min_chars" value="<?php echo $this->edit_mode_value; ?>" />
|
2128 |
+
</p>
|
2129 |
+
|
2130 |
+
<?php
|
2131 |
+
break;
|
2132 |
+
|
2133 |
+
case '_max_chars':
|
2134 |
+
?>
|
2135 |
+
|
2136 |
+
<p><label for="_max_chars"><?php _e( 'Maximum length', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'If you want to enable a maximum number of characters to be input in this field. Leave empty to disable this setting', 'ultimate-member' ) ); ?></label>
|
2137 |
+
<input type="text" name="_max_chars" id="_max_chars" value="<?php echo $this->edit_mode_value; ?>" />
|
2138 |
+
</p>
|
2139 |
+
|
2140 |
+
<?php
|
2141 |
+
break;
|
2142 |
+
|
2143 |
+
case '_html':
|
2144 |
+
?>
|
2145 |
+
|
2146 |
+
<p><label for="_html"><?php _e( 'Does this textarea accept HTML?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Turn on/off HTML tags for this textarea', 'ultimate-member' ) ); ?></label>
|
2147 |
+
<input type="checkbox" name="_html" id="_html" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : 0 ) ?> />
|
2148 |
+
</p>
|
2149 |
+
|
2150 |
+
<?php
|
2151 |
+
break;
|
2152 |
+
|
2153 |
+
case '_options':
|
2154 |
+
|
2155 |
+
if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) {
|
2156 |
+
$values = implode("\n", $this->edit_mode_value);
|
2157 |
+
} else if ( $this->edit_mode_value ) {
|
2158 |
+
$values = $this->edit_mode_value;
|
2159 |
+
} else {
|
2160 |
+
$values = '';
|
2161 |
+
} ?>
|
2162 |
+
|
2163 |
+
<p><label for="_options"><?php _e( 'Edit Choices', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Enter one choice per line. This will represent the available choices or selections available for user.', 'ultimate-member' ) ); ?></label>
|
2164 |
+
<textarea name="_options" id="_options"><?php echo $values; ?></textarea>
|
2165 |
+
</p>
|
2166 |
+
|
2167 |
+
<?php
|
2168 |
+
break;
|
2169 |
+
|
2170 |
+
case '_title':
|
2171 |
+
?>
|
2172 |
+
|
2173 |
+
<p><label for="_title"><?php _e( 'Title', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the title of the field for your reference in the backend. The title will not appear on the front-end of your website.', 'ultimate-member' ) ); ?></label>
|
2174 |
+
<input type="text" name="_title" id="_title" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
2175 |
+
</p>
|
2176 |
+
|
2177 |
+
<?php
|
2178 |
+
break;
|
2179 |
+
|
2180 |
+
case '_id':
|
2181 |
+
|
2182 |
+
?>
|
2183 |
+
|
2184 |
+
<p style="display:none"><label for="_id"><?php _e( 'Unique ID', 'ultimate-member' ) ?></label>
|
2185 |
+
<input type="text" name="_id" id="_id" value="<?php echo $this->edit_mode_value; ?>" />
|
2186 |
+
</p>
|
2187 |
+
|
2188 |
+
<?php
|
2189 |
+
|
2190 |
+
break;
|
2191 |
+
|
2192 |
+
case '_metakey':
|
2193 |
+
|
2194 |
+
if ( $this->in_edit ) {
|
2195 |
+
|
2196 |
+
?>
|
2197 |
+
|
2198 |
+
<p><label for="_metakey"><?php _e( 'Meta Key', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The meta key cannot be changed for duplicated fields or when editing an existing field. If you require a different meta key please create a new field.', 'ultimate-member' ) ); ?></label>
|
2199 |
+
<input type="text" name="_metakey_locked" id="_metakey_locked" value="<?php echo $this->edit_mode_value; ?>" disabled />
|
2200 |
+
</p>
|
2201 |
+
|
2202 |
+
<?php } else { ?>
|
2203 |
+
|
2204 |
+
<p><label for="_metakey"><?php _e( 'Meta Key', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'A meta key is required to store the entered info in this field in the database. The meta key should be unique to this field and be written in lowercase with an underscore ( _ ) separating words e.g country_list or job_title', 'ultimate-member' ) ); ?></label>
|
2205 |
+
<input type="text" name="_metakey" id="_metakey" value="" />
|
2206 |
+
</p>
|
2207 |
+
|
2208 |
+
<?php
|
2209 |
+
|
2210 |
+
}
|
2211 |
+
|
2212 |
+
break;
|
2213 |
+
|
2214 |
+
case '_help':
|
2215 |
+
?>
|
2216 |
+
|
2217 |
+
<p><label for="_help"><?php _e( 'Help Text', 'ultimate-member' ) ?> <?php UM()->tooltip( __('This is the text that appears in a tooltip when a user hovers over the info icon. Help text is useful for providing users with more information about what they should enter in the field. Leave blank if no help text is needed for field.', 'ultimate-member' ) ); ?></label>
|
2218 |
+
<input type="text" name="_help" id="_help" value="<?php echo $this->edit_mode_value; ?>" />
|
2219 |
+
</p>
|
2220 |
+
|
2221 |
+
<?php
|
2222 |
+
break;
|
2223 |
+
|
2224 |
+
case '_default':
|
2225 |
+
?>
|
2226 |
+
|
2227 |
+
<?php if ( $this->set_field_type == 'textarea' ) { ?>
|
2228 |
+
|
2229 |
+
<p><label for="_default"><?php _e( 'Default Text', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'Text to display by default in this field', 'ultimate-member' ) ); ?></label>
|
2230 |
+
<textarea name="_default" id="_default"><?php echo $this->edit_mode_value; ?></textarea>
|
2231 |
+
</p>
|
2232 |
+
|
2233 |
+
<?php } elseif ( $this->set_field_type == 'date' ) { ?>
|
2234 |
+
|
2235 |
+
<p class="um"><label for="_default"><?php _e( 'Default Date', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'You may use all PHP compatible date formats such as: 2020-02-02, 02/02/2020, yesterday, today, tomorrow, next monday, first day of next month, +3 day', 'ultimate-member' ) ); ?></label>
|
2236 |
+
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" class="um-datepicker" data-format="yyyy/mm/dd" />
|
2237 |
+
</p>
|
2238 |
+
|
2239 |
+
<?php } elseif ( $this->set_field_type == 'time' ) { ?>
|
2240 |
+
|
2241 |
+
<p class="um"><label for="_default"><?php _e( 'Default Time', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'You may use all PHP compatible date formats such as: 2020-02-02, 02/02/2020, yesterday, today, tomorrow, next monday, first day of next month, +3 day', 'ultimate-member' ) ); ?></label>
|
2242 |
+
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" class="um-timepicker" data-format="HH:i" />
|
2243 |
+
</p>
|
2244 |
+
|
2245 |
+
<?php } elseif ( $this->set_field_type == 'rating' ) { ?>
|
2246 |
+
|
2247 |
+
<p><label for="_default"><?php _e( 'Default Rating', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'If you wish the rating field to be prefilled with a number of stars, enter it here.', 'ultimate-member' ) ); ?></label>
|
2248 |
+
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" />
|
2249 |
+
</p>
|
2250 |
+
|
2251 |
+
<?php } else { ?>
|
2252 |
+
|
2253 |
+
<p><label for="_default"><?php _e( 'Default Value', 'ultimate-member' ); ?> <?php UM()->tooltip( __( 'This option allows you to pre-fill the field with a default value prior to the user entering a value in the field. Leave blank to have no default value', 'ultimate-member' ) ); ?></label>
|
2254 |
+
<input type="text" name="_default" id="_default" value="<?php echo $this->edit_mode_value; ?>" />
|
2255 |
+
</p>
|
2256 |
+
|
2257 |
+
<?php } ?>
|
2258 |
+
|
2259 |
+
<?php
|
2260 |
+
break;
|
2261 |
+
|
2262 |
+
case '_label':
|
2263 |
+
?>
|
2264 |
+
|
2265 |
+
<p><label for="_label"><?php _e( 'Label', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'The field label is the text that appears above the field on your front-end form. Leave blank to not show a label above field.', 'ultimate-member' ) ); ?></label>
|
2266 |
+
<input type="text" name="_label" id="_label" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
2267 |
+
</p>
|
2268 |
+
|
2269 |
+
<?php
|
2270 |
+
break;
|
2271 |
+
|
2272 |
+
case '_label_confirm_pass':
|
2273 |
+
?>
|
2274 |
+
|
2275 |
+
<p><label for="_label_confirm_pass"><?php _e( 'Confirm password field label', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This label is the text that appears above the confirm password field. Leave blank to show default label.', 'ultimate-member' ) ); ?></label>
|
2276 |
+
<input type="text" name="_label_confirm_pass" id="_label_confirm_pass" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
2277 |
+
</p>
|
2278 |
+
|
2279 |
+
<?php
|
2280 |
+
break;
|
2281 |
+
|
2282 |
+
case '_placeholder':
|
2283 |
+
?>
|
2284 |
+
|
2285 |
+
<p><label for="_placeholder"><?php _e( 'Placeholder', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This is the text that appears within the field e.g please enter your email address. Leave blank to not show any placeholder text.', 'ultimate-member' ) ); ?></label>
|
2286 |
+
<input type="text" name="_placeholder" id="_placeholder" value="<?php echo htmlspecialchars( $this->edit_mode_value, ENT_QUOTES ); ?>" />
|
2287 |
+
</p>
|
2288 |
+
|
2289 |
+
<?php
|
2290 |
+
break;
|
2291 |
+
|
2292 |
+
case '_public':
|
2293 |
+
$privacy_options = array(
|
2294 |
+
'1' => __( 'Everyone', 'ultimate-member' ),
|
2295 |
+
'2' => __( 'Members', 'ultimate-member' ),
|
2296 |
+
'-1' => __( 'Only visible to profile owner and users who can edit other member accounts', 'ultimate-member' ),
|
2297 |
+
'-3' => __( 'Only visible to profile owner and specific roles', 'ultimate-member' ),
|
2298 |
+
'-2' => __( 'Only specific member roles', 'ultimate-member' ),
|
2299 |
+
);
|
2300 |
+
|
2301 |
+
$privacy_options = apply_filters( 'um_field_privacy_options', $privacy_options ); ?>
|
2302 |
+
|
2303 |
+
<p>
|
2304 |
+
<label for="_public"><?php _e( 'Privacy', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Field privacy allows you to select who can view this field on the front-end. The site admin can view all fields regardless of the option set here.', 'ultimate-member' ) ); ?></label>
|
2305 |
+
<select name="_public" id="_public" class="um-adm-conditional" data-cond1="-2" data-cond1-show="_roles" data-cond2="-3" data-cond2-show="_roles" style="width: 100%">
|
2306 |
+
<?php foreach ( $privacy_options as $value => $title ) { ?>
|
2307 |
+
<option value="<?php echo esc_attr( $value ) ?>" <?php selected( $value, $this->edit_mode_value ); ?>>
|
2308 |
+
<?php echo $title ?>
|
2309 |
+
</option>
|
2310 |
+
<?php } ?>
|
2311 |
+
</select>
|
2312 |
+
</p>
|
2313 |
+
|
2314 |
+
<?php
|
2315 |
+
break;
|
2316 |
+
|
2317 |
+
case '_roles':
|
2318 |
+
|
2319 |
+
if ( isset( $this->edit_mode_value ) && is_array( $this->edit_mode_value ) ) {
|
2320 |
+
$values = $this->edit_mode_value;
|
2321 |
+
} else {
|
2322 |
+
$values = array('');
|
2323 |
+
}
|
2324 |
+
|
2325 |
+
?>
|
2326 |
+
|
2327 |
+
<p class="_roles"><label for="_roles"><?php _e( 'Select member roles', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Select the member roles that can view this field on the front-end.', 'ultimate-member' ) ); ?></label>
|
2328 |
+
<select name="_roles[]" id="_roles" style="width: 100%" multiple="multiple">
|
2329 |
+
|
2330 |
+
<?php foreach ( UM()->roles()->get_roles() as $key => $value) { ?>
|
2331 |
+
|
2332 |
+
<option value="<?php echo $key; ?>" <?php if ( in_array( $key, $values ) ) { echo 'selected'; } ?>><?php echo $value; ?></option>
|
2333 |
+
|
2334 |
+
<?php } ?>
|
2335 |
+
|
2336 |
+
</select>
|
2337 |
+
</p>
|
2338 |
+
|
2339 |
+
<?php
|
2340 |
+
break;
|
2341 |
+
|
2342 |
+
case '_required':
|
2343 |
+
|
2344 |
+
if ( $this->set_field_type == 'password' )
|
2345 |
+
$def_required = 1;
|
2346 |
+
else
|
2347 |
+
$def_required = 0;
|
2348 |
+
|
2349 |
+
?>
|
2350 |
+
|
2351 |
+
<div class="um-admin-tri">
|
2352 |
+
|
2353 |
+
<p><label for="_required"><?php _e( 'Is this field required?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether the field must be filled in before the form can be processed.', 'ultimate-member' ) ); ?></label>
|
2354 |
+
<input type="checkbox" name="_required" id="_required" value="1" <?php checked( isset( $this->edit_mode_value ) ? $this->edit_mode_value : $def_required ) ?> />
|
2355 |
+
</p>
|
2356 |
+
|
2357 |
+
</div>
|
2358 |
+
|
2359 |
+
<?php
|
2360 |
+
break;
|
2361 |
+
|
2362 |
+
case '_editable':
|
2363 |
+
?>
|
2364 |
+
|
2365 |
+
<div class="um-admin-tri">
|
2366 |
+
|
2367 |
+
<p><label for="_editable"><?php _e( 'Can user edit this field?', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field.', 'ultimate-member' ) ); ?></label>
|
2368 |
+
<input type="hidden" name="_editable" id="_editable_hidden" value="0" />
|
2369 |
+
<input type="checkbox" name="_editable" id="_editable" value="1" <?php checked( null === $this->edit_mode_value || $this->edit_mode_value ) ?> />
|
2370 |
+
</p>
|
2371 |
+
|
2372 |
+
</div>
|
2373 |
+
|
2374 |
+
<?php
|
2375 |
+
break;
|
2376 |
+
|
2377 |
+
case '_number':
|
2378 |
+
?>
|
2379 |
+
|
2380 |
+
<p><label for="_number"><?php _e( 'Rating System', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Choose whether you want a 5-stars or 10-stars ratings based here.', 'ultimate-member' ) ); ?></label>
|
2381 |
+
<select name="_number" id="_number" style="width: 100%">
|
2382 |
+
<option value="5" <?php selected( 5, $this->edit_mode_value ); ?>><?php _e( '5 stars rating system', 'ultimate-member' ) ?></option>
|
2383 |
+
<option value="10" <?php selected( 10, $this->edit_mode_value ); ?>><?php _e( '10 stars rating system', 'ultimate-member' ) ?></option>
|
2384 |
+
</select>
|
2385 |
+
</p>
|
2386 |
+
|
2387 |
+
<?php
|
2388 |
+
break;
|
2389 |
+
|
2390 |
+
case '_custom_dropdown_options_source':
|
2391 |
+
?>
|
2392 |
+
|
2393 |
+
<p><label for="_custom_dropdown_options_source"><?php _e( 'Choices Callback', 'ultimate-member' ) ?> <?php UM()->tooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?></label>
|
2394 |
+
<input type="text" name="_custom_dropdown_options_source" id="_custom_dropdown_options_source" value="<?php echo htmlspecialchars($this->edit_mode_value, ENT_QUOTES); ?>" />
|
2395 |
+
</p>
|
2396 |
+
|
2397 |
+
<?php
|
2398 |
+
break;
|
2399 |
+
|
2400 |
+
|
2401 |
+
case '_parent_dropdown_relationship':
|
2402 |
+
?>
|
2403 |
+
|
2404 |
+
<p><label for="_parent_dropdown_relationship"><?php _e( 'Parent Option', 'ultimate-member' ) ?><?php UM()->tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?></label>
|
2405 |
+
<select name="_parent_dropdown_relationship" id="_parent_dropdown_relationship" style="width: 100%">
|
2406 |
+
<option value=""><?php _e( 'No Selected', 'ultimate-member' ) ?></option>
|
2407 |
+
|
2408 |
+
<?php if ( UM()->builtin()->custom_fields ) {
|
2409 |
+
foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
|
2410 |
+
if ( in_array( $array['type'], array( 'select' ) ) && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) && isset( $array['title'] ) ) { ?>
|
2411 |
+
<option value="<?php echo esc_attr( $array['metakey'] ) ?>" <?php selected( $array['metakey'], $this->edit_mode_value ) ?>><?php echo $array['title'] ?></option>
|
2412 |
+
<?php }
|
2413 |
+
}
|
2414 |
+
} ?>
|
2415 |
+
</select>
|
2416 |
+
</p>
|
2417 |
+
|
2418 |
+
<?php
|
2419 |
+
break;
|
2420 |
+
|
2421 |
+
|
2422 |
+
}
|
2423 |
+
|
2424 |
+
}
|
2425 |
+
|
2426 |
+
}
|
2427 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/core/class-admin-settings.php
CHANGED
@@ -1,3428 +1,3437 @@
|
|
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' => '
|
507 |
-
'type' => '
|
508 |
-
'label' => __( 'Restricted Access
|
509 |
-
'tooltip' => __( 'This is the
|
510 |
-
),
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
'
|
523 |
-
'sanitize' => '
|
524 |
-
),
|
525 |
-
'
|
526 |
-
'sanitize' => '
|
527 |
-
),
|
528 |
-
'
|
529 |
-
'sanitize' => '
|
530 |
-
),
|
531 |
-
'
|
532 |
-
'sanitize' => '
|
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 |
-
'value'
|
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 |
-
'sanitize' => '
|
644 |
-
),
|
645 |
-
'
|
646 |
-
'sanitize' => '
|
647 |
-
),
|
648 |
-
'
|
649 |
-
'sanitize' => '
|
650 |
-
),
|
651 |
-
'
|
652 |
-
'sanitize' => '
|
653 |
-
),
|
654 |
-
'
|
655 |
-
'sanitize' => 'bool',
|
656 |
-
),
|
657 |
-
'
|
658 |
-
'sanitize' => 'bool',
|
659 |
-
),
|
660 |
-
'
|
661 |
-
'sanitize' => '
|
662 |
-
),
|
663 |
-
'
|
664 |
-
'sanitize' => '
|
665 |
-
),
|
666 |
-
'
|
667 |
-
'sanitize' => 'bool',
|
668 |
-
),
|
669 |
-
'
|
670 |
-
'sanitize' => 'bool',
|
671 |
-
),
|
672 |
-
'
|
673 |
-
'sanitize' => '
|
674 |
-
),
|
675 |
-
'
|
676 |
-
'sanitize' => 'bool',
|
677 |
-
),
|
678 |
-
'
|
679 |
-
'sanitize' => '
|
680 |
-
),
|
681 |
-
'
|
682 |
-
'sanitize' => '
|
683 |
-
),
|
684 |
-
'
|
685 |
-
'sanitize' => 'bool',
|
686 |
-
),
|
687 |
-
'
|
688 |
-
'sanitize' => '
|
689 |
-
),
|
690 |
-
'
|
691 |
-
'sanitize' => '
|
692 |
-
),
|
693 |
-
'
|
694 |
-
'sanitize' => 'bool',
|
695 |
-
),
|
696 |
-
'
|
697 |
-
'sanitize' => 'bool',
|
698 |
-
),
|
699 |
-
'
|
700 |
-
'sanitize' => 'bool',
|
701 |
-
),
|
702 |
-
'
|
703 |
-
'sanitize' => 'bool',
|
704 |
-
),
|
705 |
-
'
|
706 |
-
'sanitize' => '
|
707 |
-
),
|
708 |
-
'
|
709 |
-
'sanitize' => '
|
710 |
-
),
|
711 |
-
'
|
712 |
-
'sanitize' => '
|
713 |
-
),
|
714 |
-
'
|
715 |
-
'sanitize' => '
|
716 |
-
),
|
717 |
-
'
|
718 |
-
'sanitize' => 'absint',
|
719 |
-
),
|
720 |
-
'
|
721 |
-
'sanitize' => '
|
722 |
-
),
|
723 |
-
'
|
724 |
-
'sanitize' => 'absint',
|
725 |
-
),
|
726 |
-
'
|
727 |
-
'sanitize' => 'absint',
|
728 |
-
),
|
729 |
-
'
|
730 |
-
'sanitize' => '
|
731 |
-
),
|
732 |
-
'
|
733 |
-
'sanitize' => '
|
734 |
-
),
|
735 |
-
'
|
736 |
-
'sanitize' => 'absint',
|
737 |
-
),
|
738 |
-
'
|
739 |
-
'sanitize' => '
|
740 |
-
),
|
741 |
-
'
|
742 |
-
'sanitize' => '
|
743 |
-
),
|
744 |
-
'
|
745 |
-
'sanitize' => '
|
746 |
-
),
|
747 |
-
'
|
748 |
-
'sanitize' => '
|
749 |
-
),
|
750 |
-
'
|
751 |
-
'sanitize' => '
|
752 |
-
),
|
753 |
-
'
|
754 |
-
'sanitize' => '
|
755 |
-
),
|
756 |
-
'
|
757 |
-
'sanitize' => 'text',
|
758 |
-
),
|
759 |
-
'
|
760 |
-
'sanitize' => '
|
761 |
-
),
|
762 |
-
'
|
763 |
-
'sanitize' => '
|
764 |
-
),
|
765 |
-
'
|
766 |
-
'sanitize' => '
|
767 |
-
),
|
768 |
-
'
|
769 |
-
'sanitize' => 'text',
|
770 |
-
),
|
771 |
-
'
|
772 |
-
'sanitize' => '
|
773 |
-
),
|
774 |
-
'
|
775 |
-
'sanitize' => '
|
776 |
-
),
|
777 |
-
'
|
778 |
-
'sanitize' => '
|
779 |
-
),
|
780 |
-
'
|
781 |
-
'sanitize' => '
|
782 |
-
),
|
783 |
-
'
|
784 |
-
'sanitize' => '
|
785 |
-
),
|
786 |
-
'
|
787 |
-
'sanitize' =>
|
788 |
-
),
|
789 |
-
'
|
790 |
-
'sanitize' => '
|
791 |
-
),
|
792 |
-
'
|
793 |
-
'sanitize' =>
|
794 |
-
),
|
795 |
-
'
|
796 |
-
'sanitize' => '
|
797 |
-
),
|
798 |
-
'
|
799 |
-
'sanitize' => 'bool',
|
800 |
-
),
|
801 |
-
'
|
802 |
-
'sanitize' => '
|
803 |
-
),
|
804 |
-
'
|
805 |
-
'sanitize' => '
|
806 |
-
),
|
807 |
-
'
|
808 |
-
'sanitize' => 'bool',
|
809 |
-
),
|
810 |
-
'
|
811 |
-
'sanitize' => 'bool',
|
812 |
-
),
|
813 |
-
'
|
814 |
-
'sanitize' => '
|
815 |
-
),
|
816 |
-
'
|
817 |
-
'sanitize' => '
|
818 |
-
),
|
819 |
-
'
|
820 |
-
'sanitize' => 'bool',
|
821 |
-
),
|
822 |
-
'
|
823 |
-
'sanitize' => '
|
824 |
-
),
|
825 |
-
'
|
826 |
-
'sanitize' => '
|
827 |
-
),
|
828 |
-
'
|
829 |
-
'sanitize' => '
|
830 |
-
),
|
831 |
-
'
|
832 |
-
'sanitize' => '
|
833 |
-
),
|
834 |
-
'
|
835 |
-
'sanitize' => '
|
836 |
-
),
|
837 |
-
'
|
838 |
-
'sanitize' => 'text',
|
839 |
-
),
|
840 |
-
'
|
841 |
-
'sanitize' => '
|
842 |
-
),
|
843 |
-
'
|
844 |
-
'sanitize' => '
|
845 |
-
),
|
846 |
-
'
|
847 |
-
'sanitize' => '
|
848 |
-
),
|
849 |
-
'
|
850 |
-
'sanitize' => '
|
851 |
-
),
|
852 |
-
'
|
853 |
-
'sanitize' => 'text',
|
854 |
-
),
|
855 |
-
'
|
856 |
-
'sanitize' => '
|
857 |
-
),
|
858 |
-
'
|
859 |
-
'sanitize' => 'key',
|
860 |
-
),
|
861 |
-
'
|
862 |
-
'sanitize' => '
|
863 |
-
),
|
864 |
-
'
|
865 |
-
'sanitize' => 'text',
|
866 |
-
),
|
867 |
-
'
|
868 |
-
'sanitize' => '
|
869 |
-
),
|
870 |
-
'
|
871 |
-
'sanitize' => '
|
872 |
-
),
|
873 |
-
'
|
874 |
-
'sanitize' => '
|
875 |
-
),
|
876 |
-
'
|
877 |
-
'sanitize' => 'bool',
|
878 |
-
),
|
879 |
-
'
|
880 |
-
'sanitize' => '
|
881 |
-
),
|
882 |
-
'
|
883 |
-
'sanitize' => '
|
884 |
-
),
|
885 |
-
'
|
886 |
-
'sanitize' => '
|
887 |
-
),
|
888 |
-
'
|
889 |
-
'sanitize' => '
|
890 |
-
),
|
891 |
-
'
|
892 |
-
'sanitize' => 'bool',
|
893 |
-
),
|
894 |
-
'
|
895 |
-
'sanitize' => '
|
896 |
-
),
|
897 |
-
'
|
898 |
-
'sanitize' => '
|
899 |
-
),
|
900 |
-
'
|
901 |
-
'sanitize' => 'bool',
|
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 |
-
|
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 |
-
|
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 |
-
array(
|
1089 |
-
'id' => '
|
1090 |
-
'type' => 'textarea',
|
1091 |
-
'label' => __( 'Account Deletion
|
1092 |
-
'tooltip' => __( 'This is custom text that will be displayed to users before they delete their accounts from your site when password
|
1093 |
-
'args' => array(
|
1094 |
-
'textarea_rows' => 6,
|
1095 |
-
),
|
1096 |
-
),
|
1097 |
-
array(
|
1098 |
-
'id' => '
|
1099 |
-
'type' => '
|
1100 |
-
'label' => __( '
|
1101 |
-
'tooltip' => __( '
|
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 |
-
'
|
1137 |
-
|
1138 |
-
|
1139 |
-
'
|
1140 |
-
'
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
'
|
1146 |
-
'
|
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 |
-
'label'
|
1197 |
-
'tooltip'
|
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 |
-
array(
|
1251 |
-
'id'
|
1252 |
-
'type'
|
1253 |
-
'label'
|
1254 |
-
'tooltip'
|
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 |
-
|
1291 |
-
'
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
'
|
1300 |
-
'
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
array(
|
1311 |
-
'id' => '
|
1312 |
-
'type' => '
|
1313 |
-
'label' => __( 'Profile
|
1314 |
-
'
|
1315 |
-
'
|
1316 |
-
'
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
'
|
1321 |
-
'
|
1322 |
-
'
|
1323 |
-
'
|
1324 |
-
'
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
'
|
1329 |
-
'
|
1330 |
-
'
|
1331 |
-
'default' => um_get_metadefault( '
|
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 |
-
array(
|
1364 |
-
'id'
|
1365 |
-
'type'
|
1366 |
-
'label'
|
1367 |
-
'
|
1368 |
-
'
|
1369 |
-
'
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
'
|
1375 |
-
'
|
1376 |
-
'
|
1377 |
-
'
|
1378 |
-
'
|
1379 |
-
|
1380 |
-
|
1381 |
-
),
|
1382 |
-
array(
|
1383 |
-
'id'
|
1384 |
-
'type'
|
1385 |
-
'
|
1386 |
-
'
|
1387 |
-
'
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
'
|
1393 |
-
'
|
1394 |
-
'
|
1395 |
-
'tooltip' => __( '
|
1396 |
-
'
|
1397 |
-
),
|
1398 |
-
array(
|
1399 |
-
'id' => '
|
1400 |
-
'type' => '
|
1401 |
-
'label' => __( 'Profile
|
1402 |
-
'default' => um_get_metadefault( '
|
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 |
-
array(
|
1474 |
-
'id'
|
1475 |
-
'type'
|
1476 |
-
'label'
|
1477 |
-
'default'
|
1478 |
-
'tooltip'
|
1479 |
-
'
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
'
|
1484 |
-
|
1485 |
-
|
1486 |
-
'
|
1487 |
-
'
|
1488 |
-
'
|
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 |
-
array(
|
1519 |
-
'id' => '
|
1520 |
-
'type' => '
|
1521 |
-
'label' => __( 'Registration
|
1522 |
-
'
|
1523 |
-
'
|
1524 |
-
'
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
'
|
1529 |
-
'
|
1530 |
-
'
|
1531 |
-
'default' => um_get_metadefault( '
|
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 |
-
array(
|
1577 |
-
'id' => '
|
1578 |
-
'type' => 'text',
|
1579 |
-
'label' => __( 'Registration Secondary Button
|
1580 |
-
'default' => um_get_metadefault( '
|
1581 |
-
'tooltip' => __( '
|
1582 |
-
'conditional' => array( 'register_secondary_btn', '=', 1 ),
|
1583 |
-
'size' => 'medium',
|
1584 |
-
),
|
1585 |
-
array(
|
1586 |
-
'id'
|
1587 |
-
'type'
|
1588 |
-
'label'
|
1589 |
-
'
|
1590 |
-
'
|
1591 |
-
'
|
1592 |
-
'size'
|
1593 |
-
),
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
'
|
1601 |
-
'
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
array(
|
1609 |
-
'id' => '
|
1610 |
-
'type' => '
|
1611 |
-
'label' => __( 'Login
|
1612 |
-
'
|
1613 |
-
'
|
1614 |
-
'
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
'
|
1619 |
-
'
|
1620 |
-
'
|
1621 |
-
'default' => um_get_metadefault( '
|
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 |
-
array(
|
1667 |
-
'id' => '
|
1668 |
-
'type' => 'text',
|
1669 |
-
'label' => __( 'Login Secondary Button
|
1670 |
-
'default' => um_get_metadefault( '
|
1671 |
-
'tooltip' => __( '
|
1672 |
-
'conditional' => array( 'login_secondary_btn', '=', 1 ),
|
1673 |
-
'size' => 'medium',
|
1674 |
-
),
|
1675 |
-
array(
|
1676 |
-
'id'
|
1677 |
-
'type'
|
1678 |
-
'label'
|
1679 |
-
'default'
|
1680 |
-
'tooltip'
|
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 |
-
array(
|
1724 |
-
'id' => '
|
1725 |
-
'type' => '
|
1726 |
-
'label' => __( '
|
1727 |
-
'tooltip' => __( '
|
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 |
-
if (
|
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 |
-
if ( (
|
2289 |
-
$this->
|
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 |
-
LEFT JOIN {$wpdb->usermeta} AS
|
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 |
-
LEFT JOIN {$wpdb->usermeta} AS
|
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 |
-
$license_status = 'license-' . $class . '-notice';
|
2712 |
-
|
2713 |
-
break;
|
2714 |
-
|
2715 |
-
case '
|
2716 |
-
|
2717 |
-
$class = 'error';
|
2718 |
-
$messages[] = sprintf( __( '
|
2719 |
-
|
2720 |
-
$license_status = 'license-' . $class . '-notice';
|
2721 |
-
|
2722 |
-
break;
|
2723 |
-
|
2724 |
-
case '
|
2725 |
-
|
2726 |
-
$class = 'error';
|
2727 |
-
$messages[] = __( '
|
2728 |
-
|
2729 |
-
$license_status = 'license-' . $class . '-notice';
|
2730 |
-
|
2731 |
-
|
2732 |
-
|
2733 |
-
|
2734 |
-
|
2735 |
-
$
|
2736 |
-
$messages[] =
|
2737 |
-
|
2738 |
-
$license_status = 'license-' . $class . '-notice';
|
2739 |
-
break;
|
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 |
-
$license_status = 'license-' . $class . '-notice';
|
2822 |
-
|
2823 |
-
break;
|
2824 |
-
|
2825 |
-
case '
|
2826 |
-
|
2827 |
-
$class = 'error';
|
2828 |
-
$messages[] = sprintf( __( '
|
2829 |
-
|
2830 |
-
$license_status = 'license-' . $class . '-notice';
|
2831 |
-
|
2832 |
-
break;
|
2833 |
-
|
2834 |
-
case '
|
2835 |
-
|
2836 |
-
$class = 'error';
|
2837 |
-
$messages[] = __( '
|
2838 |
-
|
2839 |
-
$license_status = 'license-' . $class . '-notice';
|
2840 |
-
|
2841 |
-
|
2842 |
-
|
2843 |
-
|
2844 |
-
|
2845 |
-
$class = '
|
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 |
-
$license_status = 'license-
|
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 |
-
<?php
|
2911 |
-
|
2912 |
-
<?php
|
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 |
-
<?php $
|
3009 |
-
|
3010 |
-
|
3011 |
-
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
3018 |
-
<?php
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
<?php
|
3025 |
-
|
3026 |
-
<?php $
|
3027 |
-
|
3028 |
-
<?php
|
3029 |
-
|
3030 |
-
|
3031 |
-
$
|
3032 |
-
'
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
-
)
|
3037 |
-
|
3038 |
-
$
|
3039 |
-
|
3040 |
-
|
3041 |
-
|
3042 |
-
|
3043 |
-
|
3044 |
-
|
3045 |
-
|
3046 |
-
|
3047 |
-
|
3048 |
-
|
3049 |
-
|
3050 |
-
|
3051 |
-
|
3052 |
-
|
3053 |
-
|
3054 |
-
|
3055 |
-
|
3056 |
-
|
3057 |
-
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
<?php
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
<?php
|
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 |
-
<?php if( UM()->options()->get('
|
3136 |
-
|
3137 |
-
|
3138 |
-
|
3139 |
-
|
3140 |
-
|
3141 |
-
|
3142 |
-
<?php
|
3143 |
-
|
3144 |
-
<?php if(
|
3145 |
-
Redirect
|
3146 |
-
|
3147 |
-
|
3148 |
-
|
3149 |
-
<?php if( UM()->options()->get('
|
3150 |
-
|
3151 |
-
|
3152 |
-
<?php
|
3153 |
-
<?php
|
3154 |
-
|
3155 |
-
<?php } ?>
|
3156 |
-
<?php $
|
3157 |
-
|
3158 |
-
<?php
|
3159 |
-
<?php
|
3160 |
-
|
3161 |
-
<?php } ?>
|
3162 |
-
<?php $
|
3163 |
-
|
3164 |
-
<?php } ?>
|
3165 |
-
|
3166 |
-
|
3167 |
-
|
3168 |
-
|
3169 |
-
|
3170 |
-
|
3171 |
-
|
3172 |
-
|
3173 |
-
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
3182 |
-
|
3183 |
-
|
3184 |
-
|
3185 |
-
|
3186 |
-
|
3187 |
-
|
3188 |
-
|
3189 |
-
|
3190 |
-
|
3191 |
-
|
3192 |
-
--- UM
|
3193 |
-
|
3194 |
-
<?php
|
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 |
-
PHP
|
3243 |
-
|
3244 |
-
|
3245 |
-
|
3246 |
-
|
3247 |
-
PHP
|
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 |
-
|
3388 |
-
|
3389 |
-
|
3390 |
-
|
3391 |
-
|
3392 |
-
|
3393 |
-
|
3394 |
-
|
3395 |
-
|
3396 |
-
|
3397 |
-
|
3398 |
-
|
3399 |
-
|
3400 |
-
|
3401 |
-
|
3402 |
-
|
3403 |
-
|
3404 |
-
|
3405 |
-
|
3406 |
-
|
3407 |
-
|
3408 |
-
|
3409 |
-
|
3410 |
-
|
3411 |
-
|
3412 |
-
if (
|
3413 |
-
|
3414 |
-
}
|
3415 |
-
|
3416 |
-
$
|
3417 |
-
$
|
3418 |
-
|
3419 |
-
|
3420 |
-
|
3421 |
-
|
3422 |
-
|
3423 |
-
}
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_access_post_title',
|
507 |
+
'type' => 'text',
|
508 |
+
'label' => __( 'Restricted Access Post Title', 'ultimate-member' ),
|
509 |
+
'tooltip' => __( 'This is the post title shown to users that do not have permission to view the content', 'ultimate-member' ),
|
510 |
+
),
|
511 |
+
array(
|
512 |
+
'id' => 'restricted_access_message',
|
513 |
+
'type' => 'wp_editor',
|
514 |
+
'label' => __( 'Restricted Access Message', 'ultimate-member' ),
|
515 |
+
'tooltip' => __( 'This is the message shown to users that do not have permission to view the content', 'ultimate-member' ),
|
516 |
+
),
|
517 |
+
);
|
518 |
+
|
519 |
+
$settings_map = array_merge(
|
520 |
+
$settings_map,
|
521 |
+
array(
|
522 |
+
'accessible' => array(
|
523 |
+
'sanitize' => 'int',
|
524 |
+
),
|
525 |
+
'access_redirect' => array(
|
526 |
+
'sanitize' => 'url',
|
527 |
+
),
|
528 |
+
'access_exclude_uris' => array(
|
529 |
+
'sanitize' => 'url',
|
530 |
+
),
|
531 |
+
'home_page_accessible' => array(
|
532 |
+
'sanitize' => 'bool',
|
533 |
+
),
|
534 |
+
'category_page_accessible' => array(
|
535 |
+
'sanitize' => 'bool',
|
536 |
+
),
|
537 |
+
'restricted_access_post_title' => array(
|
538 |
+
'sanitize' => 'text',
|
539 |
+
),
|
540 |
+
'restricted_access_message' => array(
|
541 |
+
'sanitize' => 'wp_kses',
|
542 |
+
),
|
543 |
+
)
|
544 |
+
);
|
545 |
+
|
546 |
+
global $wp_version;
|
547 |
+
if ( version_compare( $wp_version, '5.0', '>=' ) ) {
|
548 |
+
$access_fields = array_merge(
|
549 |
+
$access_fields,
|
550 |
+
array(
|
551 |
+
array(
|
552 |
+
'id' => 'restricted_blocks',
|
553 |
+
'type' => 'checkbox',
|
554 |
+
'label' => __( 'Enable the "Content Restriction" settings for the Gutenberg Blocks', 'ultimate-member' ),
|
555 |
+
),
|
556 |
+
array(
|
557 |
+
'id' => 'restricted_block_message',
|
558 |
+
'type' => 'textarea',
|
559 |
+
'label' => __( 'Restricted Access Block Message', 'ultimate-member' ),
|
560 |
+
'tooltip' => __( 'This is the message shown to users that do not have permission to view the block\'s content', 'ultimate-member' ),
|
561 |
+
'conditional' => array( 'restricted_blocks', '=', 1 ),
|
562 |
+
),
|
563 |
+
)
|
564 |
+
);
|
565 |
+
|
566 |
+
$settings_map['restricted_blocks'] = array(
|
567 |
+
'sanitize' => 'bool',
|
568 |
+
);
|
569 |
+
$settings_map['restricted_block_message'] = array(
|
570 |
+
'sanitize' => 'textarea',
|
571 |
+
);
|
572 |
+
}
|
573 |
+
|
574 |
+
$access_fields = array_merge(
|
575 |
+
$access_fields,
|
576 |
+
array(
|
577 |
+
array(
|
578 |
+
'id' => 'restricted_access_post_metabox',
|
579 |
+
'type' => 'hidden',
|
580 |
+
'value' => '',
|
581 |
+
),
|
582 |
+
array(
|
583 |
+
'id' => 'restricted_access_taxonomy_metabox',
|
584 |
+
'type' => 'hidden',
|
585 |
+
'value' => '',
|
586 |
+
),
|
587 |
+
array(
|
588 |
+
'id' => 'restricted_access_post_metabox',
|
589 |
+
'type' => 'multi_checkbox',
|
590 |
+
'label' => __( 'Enable the "Content Restriction" settings for post types', 'ultimate-member' ),
|
591 |
+
'tooltip' => __( 'Check post types for which you plan to use the "Content Restriction" settings', 'ultimate-member' ),
|
592 |
+
'options' => $post_types_options,
|
593 |
+
'columns' => 3,
|
594 |
+
'value' => $restricted_access_post_metabox_value,
|
595 |
+
'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ),
|
596 |
+
),
|
597 |
+
array(
|
598 |
+
'id' => 'restricted_access_taxonomy_metabox',
|
599 |
+
'type' => 'multi_checkbox',
|
600 |
+
'label' => __( 'Enable the "Content Restriction" settings for taxonomies', 'ultimate-member' ),
|
601 |
+
'tooltip' => __( 'Check taxonomies for which you plan to use the "Content Restriction" settings', 'ultimate-member' ),
|
602 |
+
'options' => $taxonomies_options,
|
603 |
+
'columns' => 3,
|
604 |
+
'value' => $restricted_access_taxonomy_metabox_value,
|
605 |
+
'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ),
|
606 |
+
),
|
607 |
+
)
|
608 |
+
);
|
609 |
+
|
610 |
+
$settings_map = array_merge(
|
611 |
+
$settings_map,
|
612 |
+
array(
|
613 |
+
'restricted_access_post_metabox' => array(
|
614 |
+
'sanitize' => 'key',
|
615 |
+
),
|
616 |
+
'restricted_access_taxonomy_metabox' => array(
|
617 |
+
'sanitize' => 'key',
|
618 |
+
),
|
619 |
+
)
|
620 |
+
);
|
621 |
+
|
622 |
+
$latest_update = get_option( 'um_member_directory_update_meta', false );
|
623 |
+
$latest_truncate = get_option( 'um_member_directory_truncated', false );
|
624 |
+
|
625 |
+
$same_page_update = array(
|
626 |
+
'id' => 'member_directory_own_table',
|
627 |
+
'type' => 'same_page_update',
|
628 |
+
'label' => __( 'Enable custom table for usermeta', 'ultimate-member' ),
|
629 |
+
'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' ),
|
630 |
+
);
|
631 |
+
|
632 |
+
if ( empty( $latest_update ) || ( ! empty( $latest_truncate ) && $latest_truncate > $latest_update ) ) {
|
633 |
+
$same_page_update['upgrade_cb'] = 'sync_metatable';
|
634 |
+
$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>
|
635 |
+
<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>
|
636 |
+
<p>' . __( 'If the update was successful, you will see a corresponding message. Otherwise, contact technical support if the update failed.', 'ultimate-member' ) . '</p>';
|
637 |
+
}
|
638 |
+
|
639 |
+
$settings_map = array_merge(
|
640 |
+
$settings_map,
|
641 |
+
array(
|
642 |
+
'permalink_base' => array(
|
643 |
+
'sanitize' => 'key',
|
644 |
+
),
|
645 |
+
'display_name' => array(
|
646 |
+
'sanitize' => 'key',
|
647 |
+
),
|
648 |
+
'display_name_field' => array(
|
649 |
+
'sanitize' => 'text',
|
650 |
+
),
|
651 |
+
'author_redirect' => array(
|
652 |
+
'sanitize' => 'bool',
|
653 |
+
),
|
654 |
+
'members_page' => array(
|
655 |
+
'sanitize' => 'bool',
|
656 |
+
),
|
657 |
+
'use_gravatars' => array(
|
658 |
+
'sanitize' => 'bool',
|
659 |
+
),
|
660 |
+
'use_um_gravatar_default_builtin_image' => array(
|
661 |
+
'sanitize' => 'key',
|
662 |
+
),
|
663 |
+
'use_um_gravatar_default_image' => array(
|
664 |
+
'sanitize' => 'bool',
|
665 |
+
),
|
666 |
+
'reset_require_strongpass' => array(
|
667 |
+
'sanitize' => 'bool',
|
668 |
+
),
|
669 |
+
'profile_noindex' => array(
|
670 |
+
'sanitize' => 'bool',
|
671 |
+
),
|
672 |
+
'activation_link_expiry_time' => array(
|
673 |
+
'sanitize' => 'absint',
|
674 |
+
),
|
675 |
+
'account_tab_password' => array(
|
676 |
+
'sanitize' => 'bool',
|
677 |
+
),
|
678 |
+
'account_tab_privacy' => array(
|
679 |
+
'sanitize' => 'bool',
|
680 |
+
),
|
681 |
+
'account_tab_notifications' => array(
|
682 |
+
'sanitize' => 'bool',
|
683 |
+
),
|
684 |
+
'account_tab_delete' => array(
|
685 |
+
'sanitize' => 'bool',
|
686 |
+
),
|
687 |
+
'delete_account_text' => array(
|
688 |
+
'sanitize' => 'textarea',
|
689 |
+
),
|
690 |
+
'delete_account_no_pass_required_text' => array(
|
691 |
+
'sanitize' => 'textarea',
|
692 |
+
),
|
693 |
+
'account_name' => array(
|
694 |
+
'sanitize' => 'bool',
|
695 |
+
),
|
696 |
+
'account_name_disable' => array(
|
697 |
+
'sanitize' => 'bool',
|
698 |
+
),
|
699 |
+
'account_name_require' => array(
|
700 |
+
'sanitize' => 'bool',
|
701 |
+
),
|
702 |
+
'account_email' => array(
|
703 |
+
'sanitize' => 'bool',
|
704 |
+
),
|
705 |
+
'account_general_password' => array(
|
706 |
+
'sanitize' => 'bool',
|
707 |
+
),
|
708 |
+
'account_require_strongpass' => array(
|
709 |
+
'sanitize' => 'bool',
|
710 |
+
),
|
711 |
+
'account_hide_in_directory' => array(
|
712 |
+
'sanitize' => 'bool',
|
713 |
+
),
|
714 |
+
'account_hide_in_directory_default' => array(
|
715 |
+
'sanitize' => 'text',
|
716 |
+
),
|
717 |
+
'profile_photo_max_size' => array(
|
718 |
+
'sanitize' => 'absint',
|
719 |
+
),
|
720 |
+
'cover_photo_max_size' => array(
|
721 |
+
'sanitize' => 'absint',
|
722 |
+
),
|
723 |
+
'photo_thumb_sizes' => array(
|
724 |
+
'sanitize' => 'absint',
|
725 |
+
),
|
726 |
+
'cover_thumb_sizes' => array(
|
727 |
+
'sanitize' => 'absint',
|
728 |
+
),
|
729 |
+
'image_orientation_by_exif' => array(
|
730 |
+
'sanitize' => 'bool',
|
731 |
+
),
|
732 |
+
'image_compression' => array(
|
733 |
+
'sanitize' => 'absint',
|
734 |
+
),
|
735 |
+
'image_max_width' => array(
|
736 |
+
'sanitize' => 'absint',
|
737 |
+
),
|
738 |
+
'cover_min_width' => array(
|
739 |
+
'sanitize' => 'absint',
|
740 |
+
),
|
741 |
+
'enable_reset_password_limit' => array(
|
742 |
+
'sanitize' => 'bool',
|
743 |
+
),
|
744 |
+
'reset_password_limit_number' => array(
|
745 |
+
'sanitize' => 'absint',
|
746 |
+
),
|
747 |
+
'blocked_emails' => array(
|
748 |
+
'sanitize' => 'textarea',
|
749 |
+
),
|
750 |
+
'blocked_words' => array(
|
751 |
+
'sanitize' => 'textarea',
|
752 |
+
),
|
753 |
+
'admin_email' => array(
|
754 |
+
'sanitize' => 'text',
|
755 |
+
),
|
756 |
+
'mail_from' => array(
|
757 |
+
'sanitize' => 'text',
|
758 |
+
),
|
759 |
+
'mail_from_addr' => array(
|
760 |
+
'sanitize' => 'text',
|
761 |
+
),
|
762 |
+
'email_html' => array(
|
763 |
+
'sanitize' => 'bool',
|
764 |
+
),
|
765 |
+
'profile_template' => array(
|
766 |
+
'sanitize' => 'text',
|
767 |
+
),
|
768 |
+
'profile_max_width' => array(
|
769 |
+
'sanitize' => 'text',
|
770 |
+
),
|
771 |
+
'profile_area_max_width' => array(
|
772 |
+
'sanitize' => 'text',
|
773 |
+
),
|
774 |
+
'profile_icons' => array(
|
775 |
+
'sanitize' => 'key',
|
776 |
+
),
|
777 |
+
'profile_primary_btn_word' => array(
|
778 |
+
'sanitize' => 'text',
|
779 |
+
),
|
780 |
+
'profile_secondary_btn' => array(
|
781 |
+
'sanitize' => 'bool',
|
782 |
+
),
|
783 |
+
'profile_secondary_btn_word' => array(
|
784 |
+
'sanitize' => 'text',
|
785 |
+
),
|
786 |
+
'default_avatar' => array(
|
787 |
+
'sanitize' => 'url',
|
788 |
+
),
|
789 |
+
'default_cover' => array(
|
790 |
+
'sanitize' => 'url',
|
791 |
+
),
|
792 |
+
'disable_profile_photo_upload' => array(
|
793 |
+
'sanitize' => 'bool',
|
794 |
+
),
|
795 |
+
'profile_photosize' => array(
|
796 |
+
'sanitize' => array( UM()->admin(), 'sanitize_photosize' ),
|
797 |
+
),
|
798 |
+
'profile_cover_enabled' => array(
|
799 |
+
'sanitize' => 'bool',
|
800 |
+
),
|
801 |
+
'profile_coversize' => array(
|
802 |
+
'sanitize' => array( UM()->admin(), 'sanitize_cover_photosize' ),
|
803 |
+
),
|
804 |
+
'profile_cover_ratio' => array(
|
805 |
+
'sanitize' => 'text',
|
806 |
+
),
|
807 |
+
'profile_show_metaicon' => array(
|
808 |
+
'sanitize' => 'bool',
|
809 |
+
),
|
810 |
+
'profile_show_name' => array(
|
811 |
+
'sanitize' => 'bool',
|
812 |
+
),
|
813 |
+
'profile_show_social_links' => array(
|
814 |
+
'sanitize' => 'bool',
|
815 |
+
),
|
816 |
+
'profile_show_bio' => array(
|
817 |
+
'sanitize' => 'bool',
|
818 |
+
),
|
819 |
+
'profile_show_html_bio' => array(
|
820 |
+
'sanitize' => 'bool',
|
821 |
+
),
|
822 |
+
'profile_bio_maxchars' => array(
|
823 |
+
'sanitize' => 'absint',
|
824 |
+
),
|
825 |
+
'profile_header_menu' => array(
|
826 |
+
'sanitize' => 'key',
|
827 |
+
),
|
828 |
+
'profile_empty_text' => array(
|
829 |
+
'sanitize' => 'bool',
|
830 |
+
),
|
831 |
+
'profile_empty_text_emo' => array(
|
832 |
+
'sanitize' => 'bool',
|
833 |
+
),
|
834 |
+
'register_template' => array(
|
835 |
+
'sanitize' => 'text',
|
836 |
+
),
|
837 |
+
'register_max_width' => array(
|
838 |
+
'sanitize' => 'text',
|
839 |
+
),
|
840 |
+
'register_align' => array(
|
841 |
+
'sanitize' => 'key',
|
842 |
+
),
|
843 |
+
'register_icons' => array(
|
844 |
+
'sanitize' => 'key',
|
845 |
+
),
|
846 |
+
'register_primary_btn_word' => array(
|
847 |
+
'sanitize' => 'text',
|
848 |
+
),
|
849 |
+
'register_secondary_btn' => array(
|
850 |
+
'sanitize' => 'bool',
|
851 |
+
),
|
852 |
+
'register_secondary_btn_word' => array(
|
853 |
+
'sanitize' => 'text',
|
854 |
+
),
|
855 |
+
'register_secondary_btn_url' => array(
|
856 |
+
'sanitize' => 'url',
|
857 |
+
),
|
858 |
+
'register_role' => array(
|
859 |
+
'sanitize' => 'key',
|
860 |
+
),
|
861 |
+
'login_template' => array(
|
862 |
+
'sanitize' => 'text',
|
863 |
+
),
|
864 |
+
'login_max_width' => array(
|
865 |
+
'sanitize' => 'text',
|
866 |
+
),
|
867 |
+
'login_align' => array(
|
868 |
+
'sanitize' => 'key',
|
869 |
+
),
|
870 |
+
'login_icons' => array(
|
871 |
+
'sanitize' => 'key',
|
872 |
+
),
|
873 |
+
'login_primary_btn_word' => array(
|
874 |
+
'sanitize' => 'text',
|
875 |
+
),
|
876 |
+
'login_secondary_btn' => array(
|
877 |
+
'sanitize' => 'bool',
|
878 |
+
),
|
879 |
+
'login_secondary_btn_word' => array(
|
880 |
+
'sanitize' => 'text',
|
881 |
+
),
|
882 |
+
'login_secondary_btn_url' => array(
|
883 |
+
'sanitize' => 'url',
|
884 |
+
),
|
885 |
+
'login_forgot_pass_link' => array(
|
886 |
+
'sanitize' => 'bool',
|
887 |
+
),
|
888 |
+
'login_show_rememberme' => array(
|
889 |
+
'sanitize' => 'bool',
|
890 |
+
),
|
891 |
+
'form_asterisk' => array(
|
892 |
+
'sanitize' => 'bool',
|
893 |
+
),
|
894 |
+
'profile_title' => array(
|
895 |
+
'sanitize' => 'text',
|
896 |
+
),
|
897 |
+
'profile_desc' => array(
|
898 |
+
'sanitize' => 'textarea',
|
899 |
+
),
|
900 |
+
'um_profile_object_cache_stop' => array(
|
901 |
+
'sanitize' => 'bool',
|
902 |
+
),
|
903 |
+
'enable_blocks' => array(
|
904 |
+
'sanitize' => 'bool',
|
905 |
+
),
|
906 |
+
'rest_api_version' => array(
|
907 |
+
'sanitize' => 'text',
|
908 |
+
),
|
909 |
+
'uninstall_on_delete' => array(
|
910 |
+
'sanitize' => 'bool',
|
911 |
+
),
|
912 |
+
)
|
913 |
+
);
|
914 |
+
|
915 |
+
$this->settings_map = apply_filters( 'um_settings_map', $settings_map );
|
916 |
+
|
917 |
+
/**
|
918 |
+
* UM hook
|
919 |
+
*
|
920 |
+
* @type filter
|
921 |
+
* @title um_settings_structure
|
922 |
+
* @description Extend UM Settings
|
923 |
+
* @input_vars
|
924 |
+
* [{"var":"$settings","type":"array","desc":"UM Settings"}]
|
925 |
+
* @change_log
|
926 |
+
* ["Since: 2.0"]
|
927 |
+
* @usage add_filter( 'um_settings_structure', 'function_name', 10, 1 );
|
928 |
+
* @example
|
929 |
+
* <?php
|
930 |
+
* add_filter( 'um_settings_structure', 'my_settings_structure', 10, 1 );
|
931 |
+
* function my_settings_structure( $settings ) {
|
932 |
+
* // your code here
|
933 |
+
* return $settings;
|
934 |
+
* }
|
935 |
+
* ?>
|
936 |
+
*/
|
937 |
+
$this->settings_structure = apply_filters(
|
938 |
+
'um_settings_structure',
|
939 |
+
array(
|
940 |
+
'' => array(
|
941 |
+
'title' => __( 'General', 'ultimate-member' ),
|
942 |
+
'sections' => array(
|
943 |
+
'' => array(
|
944 |
+
'title' => __( 'Pages', 'ultimate-member' ),
|
945 |
+
'fields' => $general_pages_fields,
|
946 |
+
),
|
947 |
+
'users' => array(
|
948 |
+
'title' => __( 'Users', 'ultimate-member' ),
|
949 |
+
'fields' => array(
|
950 |
+
array(
|
951 |
+
'id' => 'permalink_base',
|
952 |
+
'type' => 'select',
|
953 |
+
'size' => 'small',
|
954 |
+
'label' => __( 'Profile Permalink Base', 'ultimate-member' ),
|
955 |
+
// translators: %s: Profile page URL
|
956 |
+
'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' ) ) ),
|
957 |
+
'options' => array(
|
958 |
+
'user_login' => __( 'Username', 'ultimate-member' ),
|
959 |
+
'name' => __( 'First and Last Name with \'.\'', 'ultimate-member' ),
|
960 |
+
'name_dash' => __( 'First and Last Name with \'-\'', 'ultimate-member' ),
|
961 |
+
'name_plus' => __( 'First and Last Name with \'+\'', 'ultimate-member' ),
|
962 |
+
'user_id' => __( 'User ID', 'ultimate-member' ),
|
963 |
+
),
|
964 |
+
'placeholder' => __( 'Select...', 'ultimate-member' ),
|
965 |
+
),
|
966 |
+
array(
|
967 |
+
'id' => 'display_name',
|
968 |
+
'type' => 'select',
|
969 |
+
'size' => 'medium',
|
970 |
+
'label' => __( 'User Display Name', 'ultimate-member' ),
|
971 |
+
'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' ),
|
972 |
+
'options' => array(
|
973 |
+
'default' => __( 'Default WP Display Name', 'ultimate-member' ),
|
974 |
+
'nickname' => __( 'Nickname', 'ultimate-member' ),
|
975 |
+
'username' => __( 'Username', 'ultimate-member' ),
|
976 |
+
'full_name' => __( 'First name & last name', 'ultimate-member' ),
|
977 |
+
'sur_name' => __( 'Last name & first name', 'ultimate-member' ),
|
978 |
+
'initial_name' => __( 'First name & first initial of last name', 'ultimate-member' ),
|
979 |
+
'initial_name_f' => __( 'First initial of first name & last name', 'ultimate-member' ),
|
980 |
+
'first_name' => __( 'First name only', 'ultimate-member' ),
|
981 |
+
'field' => __( 'Custom field(s)', 'ultimate-member' ),
|
982 |
+
),
|
983 |
+
'placeholder' => __( 'Select...', 'ultimate-member' ),
|
984 |
+
),
|
985 |
+
array(
|
986 |
+
'id' => 'display_name_field',
|
987 |
+
'type' => 'text',
|
988 |
+
'label' => __( 'Display Name Custom Field(s)', 'ultimate-member' ),
|
989 |
+
'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' ),
|
990 |
+
'conditional' => array( 'display_name', '=', 'field' ),
|
991 |
+
),
|
992 |
+
array(
|
993 |
+
'id' => 'author_redirect',
|
994 |
+
'type' => 'checkbox',
|
995 |
+
'label' => __( 'Automatically redirect author page to their profile?', 'ultimate-member' ),
|
996 |
+
'tooltip' => __( 'If enabled, author pages will automatically redirect to the user\'s profile page', 'ultimate-member' ),
|
997 |
+
),
|
998 |
+
array(
|
999 |
+
'id' => 'members_page',
|
1000 |
+
'type' => 'checkbox',
|
1001 |
+
'label' => __( 'Enable Members Directory', 'ultimate-member' ),
|
1002 |
+
'tooltip' => __( 'Control whether to enable or disable member directories on this site', 'ultimate-member' ),
|
1003 |
+
),
|
1004 |
+
array(
|
1005 |
+
'id' => 'use_gravatars',
|
1006 |
+
'type' => 'checkbox',
|
1007 |
+
'label' => __( 'Use Gravatars?', 'ultimate-member' ),
|
1008 |
+
'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' ),
|
1009 |
+
),
|
1010 |
+
array(
|
1011 |
+
'id' => 'use_um_gravatar_default_builtin_image',
|
1012 |
+
'type' => 'select',
|
1013 |
+
'label' => __( 'Use Gravatar builtin image', 'ultimate-member' ),
|
1014 |
+
'tooltip' => __( 'Gravatar has a number of built in options which you can also use as defaults', 'ultimate-member' ),
|
1015 |
+
'options' => array(
|
1016 |
+
'default' => __( 'Default', 'ultimate-member' ),
|
1017 |
+
'404' => __( '404 ( File Not Found response )', 'ultimate-member' ),
|
1018 |
+
'mm' => __( 'Mystery Man', 'ultimate-member' ),
|
1019 |
+
'identicon' => __( 'Identicon', 'ultimate-member' ),
|
1020 |
+
'monsterid' => __( 'Monsterid', 'ultimate-member' ),
|
1021 |
+
'wavatar' => __( 'Wavatar', 'ultimate-member' ),
|
1022 |
+
'retro' => __( 'Retro', 'ultimate-member' ),
|
1023 |
+
'blank' => __( 'Blank ( a transparent PNG image )', 'ultimate-member' ),
|
1024 |
+
),
|
1025 |
+
'conditional' => array( 'use_gravatars', '=', 1 ),
|
1026 |
+
'size' => 'medium',
|
1027 |
+
),
|
1028 |
+
array(
|
1029 |
+
'id' => 'use_um_gravatar_default_image',
|
1030 |
+
'type' => 'checkbox',
|
1031 |
+
'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar', 'ultimate-member' ),
|
1032 |
+
'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' ),
|
1033 |
+
'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
|
1034 |
+
),
|
1035 |
+
array(
|
1036 |
+
'id' => 'reset_require_strongpass',
|
1037 |
+
'type' => 'checkbox',
|
1038 |
+
'label' => __( 'Require a strong password? (when user resets password only)', 'ultimate-member' ),
|
1039 |
+
'tooltip' => __( 'Enable or disable a strong password rules on password reset and change procedure', 'ultimate-member' ),
|
1040 |
+
),
|
1041 |
+
array(
|
1042 |
+
'id' => 'profile_noindex',
|
1043 |
+
'type' => 'select',
|
1044 |
+
'size' => 'small',
|
1045 |
+
'label' => __( 'Avoid indexing profile by search engines', 'ultimate-member' ),
|
1046 |
+
'tooltip' => __( 'Hides the profile page for robots. This setting can be overridden by individual role settings.', 'ultimate-member' ),
|
1047 |
+
'options' => array(
|
1048 |
+
'0' => __( 'No', 'ultimate-member' ),
|
1049 |
+
'1' => __( 'Yes', 'ultimate-member' ),
|
1050 |
+
),
|
1051 |
+
),
|
1052 |
+
array(
|
1053 |
+
'id' => 'activation_link_expiry_time',
|
1054 |
+
'type' => 'number',
|
1055 |
+
'label' => __( 'Activation link lifetime', 'ultimate-member' ),
|
1056 |
+
'tooltip' => __( 'How long does an activation link live in seconds? Leave empty for endless links.', 'ultimate-member' ),
|
1057 |
+
'size' => 'small',
|
1058 |
+
),
|
1059 |
+
),
|
1060 |
+
),
|
1061 |
+
'account' => array(
|
1062 |
+
'title' => __( 'Account', 'ultimate-member' ),
|
1063 |
+
'fields' => array(
|
1064 |
+
array(
|
1065 |
+
'id' => 'account_tab_password',
|
1066 |
+
'type' => 'checkbox',
|
1067 |
+
'label' => __( 'Password Account Tab', 'ultimate-member' ),
|
1068 |
+
'tooltip' => __( 'Enable/disable the Password account tab in account page', 'ultimate-member' ),
|
1069 |
+
),
|
1070 |
+
array(
|
1071 |
+
'id' => 'account_tab_privacy',
|
1072 |
+
'type' => 'checkbox',
|
1073 |
+
'label' => __( 'Privacy Account Tab', 'ultimate-member' ),
|
1074 |
+
'tooltip' => __( 'Enable/disable the Privacy account tab in account page', 'ultimate-member' ),
|
1075 |
+
),
|
1076 |
+
array(
|
1077 |
+
'id' => 'account_tab_notifications',
|
1078 |
+
'type' => 'checkbox',
|
1079 |
+
'label' => __( 'Notifications Account Tab', 'ultimate-member' ),
|
1080 |
+
'tooltip' => __( 'Enable/disable the Notifications account tab in account page', 'ultimate-member' ),
|
1081 |
+
),
|
1082 |
+
array(
|
1083 |
+
'id' => 'account_tab_delete',
|
1084 |
+
'type' => 'checkbox',
|
1085 |
+
'label' => __( 'Delete Account Tab', 'ultimate-member' ),
|
1086 |
+
'tooltip' => __( 'Enable/disable the Delete account tab in account page', 'ultimate-member' ),
|
1087 |
+
),
|
1088 |
+
array(
|
1089 |
+
'id' => 'delete_account_text',
|
1090 |
+
'type' => 'textarea', // bug with wp 4.4? should be editor
|
1091 |
+
'label' => __( 'Account Deletion Custom Text', 'ultimate-member' ),
|
1092 |
+
'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' ),
|
1093 |
+
'args' => array(
|
1094 |
+
'textarea_rows' => 6,
|
1095 |
+
),
|
1096 |
+
),
|
1097 |
+
array(
|
1098 |
+
'id' => 'delete_account_no_pass_required_text',
|
1099 |
+
'type' => 'textarea',
|
1100 |
+
'label' => __( 'Account Deletion without password Custom Text', 'ultimate-member' ),
|
1101 |
+
'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' ),
|
1102 |
+
'args' => array(
|
1103 |
+
'textarea_rows' => 6,
|
1104 |
+
),
|
1105 |
+
),
|
1106 |
+
array(
|
1107 |
+
'id' => 'account_name',
|
1108 |
+
'type' => 'checkbox',
|
1109 |
+
'label' => __( 'Add a First & Last Name fields', 'ultimate-member' ),
|
1110 |
+
'tooltip' => __( 'Whether to enable these fields on the user account page by default or hide them.', 'ultimate-member' ),
|
1111 |
+
),
|
1112 |
+
array(
|
1113 |
+
'id' => 'account_name_disable',
|
1114 |
+
'type' => 'checkbox',
|
1115 |
+
'label' => __( 'Disable First & Last Name fields', 'ultimate-member' ),
|
1116 |
+
'tooltip' => __( 'Whether to allow users changing their first and last name in account page.', 'ultimate-member' ),
|
1117 |
+
'conditional' => array( 'account_name', '=', '1' ),
|
1118 |
+
),
|
1119 |
+
array(
|
1120 |
+
'id' => 'account_name_require',
|
1121 |
+
'type' => 'checkbox',
|
1122 |
+
'label' => __( 'Require First & Last Name', 'ultimate-member' ),
|
1123 |
+
'tooltip' => __( 'Require first and last name?', 'ultimate-member' ),
|
1124 |
+
'conditional' => array( 'account_name', '=', '1' ),
|
1125 |
+
),
|
1126 |
+
array(
|
1127 |
+
'id' => 'account_email',
|
1128 |
+
'type' => 'checkbox',
|
1129 |
+
'label' => __( 'Allow users to change e-mail', 'ultimate-member' ),
|
1130 |
+
'tooltip' => __( 'Whether to allow users changing their email in account page.', 'ultimate-member' ),
|
1131 |
+
),
|
1132 |
+
array(
|
1133 |
+
'id' => 'account_general_password',
|
1134 |
+
'type' => 'checkbox',
|
1135 |
+
'label' => __( 'Password is required?', 'ultimate-member' ),
|
1136 |
+
'tooltip' => __( 'Password is required to save account data.', 'ultimate-member' ),
|
1137 |
+
),
|
1138 |
+
array(
|
1139 |
+
'id' => 'account_require_strongpass',
|
1140 |
+
'type' => 'checkbox',
|
1141 |
+
'label' => __( 'Require a strong password?', 'ultimate-member' ),
|
1142 |
+
'tooltip' => __( 'Enable or disable a strong password rules on account page / change password tab', 'ultimate-member' ),
|
1143 |
+
),
|
1144 |
+
array(
|
1145 |
+
'id' => 'account_hide_in_directory',
|
1146 |
+
'type' => 'checkbox',
|
1147 |
+
'label' => __( 'Allow users to hide their profiles from directory', 'ultimate-member' ),
|
1148 |
+
'tooltip' => __( 'Whether to allow users changing their profile visibility from member directory in account page.', 'ultimate-member' ),
|
1149 |
+
'conditional' => array( 'account_tab_privacy', '=', '1' ),
|
1150 |
+
),
|
1151 |
+
array(
|
1152 |
+
'id' => 'account_hide_in_directory_default',
|
1153 |
+
'type' => 'select',
|
1154 |
+
'label' => __( 'Hide profiles from directory by default', 'ultimate-member' ),
|
1155 |
+
'tooltip' => __( 'Set default value for the "Hide my profile from directory" option', 'ultimate-member' ),
|
1156 |
+
'options' => array(
|
1157 |
+
'No' => __( 'No', 'ultimate-member' ),
|
1158 |
+
'Yes' => __( 'Yes', 'ultimate-member' ),
|
1159 |
+
),
|
1160 |
+
'size' => 'small',
|
1161 |
+
'conditional' => array( 'account_hide_in_directory', '=', '1' ),
|
1162 |
+
),
|
1163 |
+
),
|
1164 |
+
),
|
1165 |
+
'uploads' => array(
|
1166 |
+
'title' => __( 'Uploads', 'ultimate-member' ),
|
1167 |
+
'fields' => array(
|
1168 |
+
array(
|
1169 |
+
'id' => 'profile_photo_max_size',
|
1170 |
+
'type' => 'text',
|
1171 |
+
'size' => 'small',
|
1172 |
+
'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ),
|
1173 |
+
'tooltip' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ),
|
1174 |
+
),
|
1175 |
+
array(
|
1176 |
+
'id' => 'cover_photo_max_size',
|
1177 |
+
'type' => 'text',
|
1178 |
+
'size' => 'small',
|
1179 |
+
'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ),
|
1180 |
+
'tooltip' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ),
|
1181 |
+
),
|
1182 |
+
array(
|
1183 |
+
'id' => 'photo_thumb_sizes',
|
1184 |
+
'type' => 'multi_text',
|
1185 |
+
'size' => 'small',
|
1186 |
+
'label' => __( 'Profile Photo Thumbnail Sizes (px)', 'ultimate-member' ),
|
1187 |
+
'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.', 'ultimate-member' ),
|
1188 |
+
'validate' => 'numeric',
|
1189 |
+
'add_text' => __( 'Add New Size', 'ultimate-member' ),
|
1190 |
+
'show_default_number' => 1,
|
1191 |
+
),
|
1192 |
+
array(
|
1193 |
+
'id' => 'cover_thumb_sizes',
|
1194 |
+
'type' => 'multi_text',
|
1195 |
+
'size' => 'small',
|
1196 |
+
'label' => __( 'Cover Photo Thumbnail Sizes (px)', 'ultimate-member' ),
|
1197 |
+
'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each cover photo upload.', 'ultimate-member' ),
|
1198 |
+
'validate' => 'numeric',
|
1199 |
+
'add_text' => __( 'Add New Size', 'ultimate-member' ),
|
1200 |
+
'show_default_number' => 1,
|
1201 |
+
),
|
1202 |
+
array(
|
1203 |
+
'id' => 'image_orientation_by_exif',
|
1204 |
+
'type' => 'checkbox',
|
1205 |
+
'label' => __( 'Change image orientation', 'ultimate-member' ),
|
1206 |
+
'tooltip' => __( 'Rotate image to and use orientation by the camera EXIF data.', 'ultimate-member' ),
|
1207 |
+
),
|
1208 |
+
array(
|
1209 |
+
'id' => 'image_compression',
|
1210 |
+
'type' => 'text',
|
1211 |
+
'size' => 'small',
|
1212 |
+
'label' => __( 'Image Quality', 'ultimate-member' ),
|
1213 |
+
'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' ),
|
1214 |
+
),
|
1215 |
+
|
1216 |
+
array(
|
1217 |
+
'id' => 'image_max_width',
|
1218 |
+
'type' => 'text',
|
1219 |
+
'size' => 'small',
|
1220 |
+
'label' => __( 'Image Upload Maximum Width (px)', 'ultimate-member' ),
|
1221 |
+
'tooltip' => __( 'Any image upload above this width will be resized to this limit automatically.', 'ultimate-member' ),
|
1222 |
+
),
|
1223 |
+
|
1224 |
+
array(
|
1225 |
+
'id' => 'cover_min_width',
|
1226 |
+
'type' => 'text',
|
1227 |
+
'size' => 'small',
|
1228 |
+
'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ),
|
1229 |
+
'tooltip' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ),
|
1230 |
+
),
|
1231 |
+
),
|
1232 |
+
),
|
1233 |
+
),
|
1234 |
+
),
|
1235 |
+
'access' => array(
|
1236 |
+
'title' => __( 'Access', 'ultimate-member' ),
|
1237 |
+
'sections' => array(
|
1238 |
+
'' => array(
|
1239 |
+
'title' => __( 'Restriction Content', 'ultimate-member' ),
|
1240 |
+
'fields' => $access_fields,
|
1241 |
+
),
|
1242 |
+
'other' => array(
|
1243 |
+
'title' => __( 'Other', 'ultimate-member' ),
|
1244 |
+
'fields' => array(
|
1245 |
+
array(
|
1246 |
+
'id' => 'enable_reset_password_limit',
|
1247 |
+
'type' => 'checkbox',
|
1248 |
+
'label' => __( 'Enable the Reset Password Limit?', 'ultimate-member' ),
|
1249 |
+
),
|
1250 |
+
array(
|
1251 |
+
'id' => 'reset_password_limit_number',
|
1252 |
+
'type' => 'text',
|
1253 |
+
'label' => __( 'Reset Password Limit', 'ultimate-member' ),
|
1254 |
+
'tooltip' => __( 'Set the maximum reset password limit. If reached the maximum limit, user will be locked from using this.', 'ultimate-member' ),
|
1255 |
+
'validate' => 'numeric',
|
1256 |
+
'conditional' => array( 'enable_reset_password_limit', '=', 1 ),
|
1257 |
+
'size' => 'small',
|
1258 |
+
),
|
1259 |
+
array(
|
1260 |
+
'id' => 'blocked_emails',
|
1261 |
+
'type' => 'textarea',
|
1262 |
+
'label' => __( 'Blocked Email Addresses', 'ultimate-member' ),
|
1263 |
+
'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' ),
|
1264 |
+
),
|
1265 |
+
array(
|
1266 |
+
'id' => 'blocked_words',
|
1267 |
+
'type' => 'textarea',
|
1268 |
+
'label' => __( 'Blacklist Words', 'ultimate-member' ),
|
1269 |
+
'tooltip' => __( 'This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username', 'ultimate-member' ),
|
1270 |
+
),
|
1271 |
+
),
|
1272 |
+
),
|
1273 |
+
),
|
1274 |
+
),
|
1275 |
+
'email' => array(
|
1276 |
+
'title' => __( 'Email', 'ultimate-member' ),
|
1277 |
+
'fields' => array(
|
1278 |
+
array(
|
1279 |
+
'id' => 'admin_email',
|
1280 |
+
'type' => 'text',
|
1281 |
+
'label' => __( 'Admin E-mail Address', 'ultimate-member' ),
|
1282 |
+
'tooltip' => __( 'e.g. admin@companyname.com', 'ultimate-member' ),
|
1283 |
+
),
|
1284 |
+
array(
|
1285 |
+
'id' => 'mail_from',
|
1286 |
+
'type' => 'text',
|
1287 |
+
'label' => __( 'Mail appears from', 'ultimate-member' ),
|
1288 |
+
'tooltip' => __( 'e.g. Site Name', 'ultimate-member' ),
|
1289 |
+
),
|
1290 |
+
array(
|
1291 |
+
'id' => 'mail_from_addr',
|
1292 |
+
'type' => 'text',
|
1293 |
+
'label' => __( 'Mail appears from address', 'ultimate-member' ),
|
1294 |
+
'tooltip' => __( 'e.g. admin@companyname.com', 'ultimate-member' ),
|
1295 |
+
),
|
1296 |
+
array(
|
1297 |
+
'id' => 'email_html',
|
1298 |
+
'type' => 'checkbox',
|
1299 |
+
'label' => __( 'Use HTML for E-mails?', 'ultimate-member' ),
|
1300 |
+
'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' ),
|
1301 |
+
),
|
1302 |
+
),
|
1303 |
+
),
|
1304 |
+
'appearance' => array(
|
1305 |
+
'title' => __( 'Appearance', 'ultimate-member' ),
|
1306 |
+
'sections' => array(
|
1307 |
+
'' => array(
|
1308 |
+
'title' => __( 'Profile', 'ultimate-member' ),
|
1309 |
+
'fields' => array(
|
1310 |
+
array(
|
1311 |
+
'id' => 'profile_template',
|
1312 |
+
'type' => 'select',
|
1313 |
+
'label' => __( 'Profile Default Template', 'ultimate-member' ),
|
1314 |
+
'tooltip' => __( 'This will be the default template to output profile', 'ultimate-member' ),
|
1315 |
+
'default' => um_get_metadefault( 'profile_template' ),
|
1316 |
+
'options' => UM()->shortcodes()->get_templates( 'profile' ),
|
1317 |
+
'size' => 'small',
|
1318 |
+
),
|
1319 |
+
array(
|
1320 |
+
'id' => 'profile_max_width',
|
1321 |
+
'type' => 'text',
|
1322 |
+
'label' => __( 'Profile Maximum Width', 'ultimate-member' ),
|
1323 |
+
'default' => um_get_metadefault( 'profile_max_width' ),
|
1324 |
+
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
|
1325 |
+
'size' => 'small',
|
1326 |
+
),
|
1327 |
+
array(
|
1328 |
+
'id' => 'profile_area_max_width',
|
1329 |
+
'type' => 'text',
|
1330 |
+
'label' => __( 'Profile Area Maximum Width', 'ultimate-member' ),
|
1331 |
+
'default' => um_get_metadefault( 'profile_area_max_width' ),
|
1332 |
+
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
|
1333 |
+
'size' => 'small',
|
1334 |
+
),
|
1335 |
+
array(
|
1336 |
+
'id' => 'profile_icons',
|
1337 |
+
'type' => 'select',
|
1338 |
+
'label' => __( 'Profile Field Icons', 'ultimate-member' ),
|
1339 |
+
'tooltip' => __( 'This is applicable for edit mode only', 'ultimate-member' ),
|
1340 |
+
'default' => um_get_metadefault( 'profile_icons' ),
|
1341 |
+
'options' => array(
|
1342 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
1343 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
1344 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
1345 |
+
),
|
1346 |
+
'size' => 'small',
|
1347 |
+
),
|
1348 |
+
array(
|
1349 |
+
'id' => 'profile_primary_btn_word',
|
1350 |
+
'type' => 'text',
|
1351 |
+
'label' => __( 'Profile Primary Button Text', 'ultimate-member' ),
|
1352 |
+
'default' => um_get_metadefault( 'profile_primary_btn_word' ),
|
1353 |
+
'tooltip' => __( 'The text that is used for updating profile button', 'ultimate-member' ),
|
1354 |
+
'size' => 'medium',
|
1355 |
+
),
|
1356 |
+
array(
|
1357 |
+
'id' => 'profile_secondary_btn',
|
1358 |
+
'type' => 'checkbox',
|
1359 |
+
'label' => __( 'Profile Secondary Button', 'ultimate-member' ),
|
1360 |
+
'default' => um_get_metadefault( 'profile_secondary_btn' ),
|
1361 |
+
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
|
1362 |
+
),
|
1363 |
+
array(
|
1364 |
+
'id' => 'profile_secondary_btn_word',
|
1365 |
+
'type' => 'text',
|
1366 |
+
'label' => __( 'Profile Secondary Button Text', 'ultimate-member' ),
|
1367 |
+
'default' => um_get_metadefault( 'profile_secondary_btn_word' ),
|
1368 |
+
'tooltip' => __( 'The text that is used for cancelling update profile button', 'ultimate-member' ),
|
1369 |
+
'conditional' => array( 'profile_secondary_btn', '=', 1 ),
|
1370 |
+
'size' => 'medium',
|
1371 |
+
),
|
1372 |
+
array(
|
1373 |
+
'id' => 'default_avatar',
|
1374 |
+
'type' => 'media',
|
1375 |
+
'label' => __( 'Default Profile Photo', 'ultimate-member' ),
|
1376 |
+
'tooltip' => __( 'You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member' ),
|
1377 |
+
'upload_frame_title' => __( 'Select Default Profile Photo', 'ultimate-member' ),
|
1378 |
+
'default' => array(
|
1379 |
+
'url' => um_url . 'assets/img/default_avatar.jpg',
|
1380 |
+
),
|
1381 |
+
),
|
1382 |
+
array(
|
1383 |
+
'id' => 'default_cover',
|
1384 |
+
'type' => 'media',
|
1385 |
+
'url' => true,
|
1386 |
+
'preview' => false,
|
1387 |
+
'label' => __( 'Default Cover Photo', 'ultimate-member' ),
|
1388 |
+
'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' ),
|
1389 |
+
'upload_frame_title' => __( 'Select Default Cover Photo', 'ultimate-member' ),
|
1390 |
+
),
|
1391 |
+
array(
|
1392 |
+
'id' => 'disable_profile_photo_upload',
|
1393 |
+
'type' => 'checkbox',
|
1394 |
+
'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ),
|
1395 |
+
'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ),
|
1396 |
+
'default' => um_get_metadefault( 'disable_profile_photo_upload' ),
|
1397 |
+
),
|
1398 |
+
array(
|
1399 |
+
'id' => 'profile_photosize',
|
1400 |
+
'type' => 'select',
|
1401 |
+
'label' => __( 'Profile Photo Size', 'ultimate-member' ),
|
1402 |
+
'default' => um_get_metadefault( 'profile_photosize' ),
|
1403 |
+
'options' => UM()->files()->get_profile_photo_size( 'photo_thumb_sizes' ),
|
1404 |
+
'tooltip' => __( 'The global default of profile photo size. This can be overridden by individual form settings', 'ultimate-member' ),
|
1405 |
+
'size' => 'small',
|
1406 |
+
),
|
1407 |
+
array(
|
1408 |
+
'id' => 'profile_cover_enabled',
|
1409 |
+
'type' => 'checkbox',
|
1410 |
+
'label' => __( 'Profile Cover Photos', 'ultimate-member' ),
|
1411 |
+
'default' => um_get_metadefault( 'profile_cover_enabled' ),
|
1412 |
+
'tooltip' => __( 'Switch on/off the profile cover photos', 'ultimate-member' ),
|
1413 |
+
),
|
1414 |
+
array(
|
1415 |
+
'id' => 'profile_coversize',
|
1416 |
+
'type' => 'select',
|
1417 |
+
'label' => __( 'Profile Cover Size', 'ultimate-member' ),
|
1418 |
+
'default' => um_get_metadefault( 'profile_coversize' ),
|
1419 |
+
'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ),
|
1420 |
+
'tooltip' => __( 'The global default width of cover photo size. This can be overridden by individual form settings', 'ultimate-member' ),
|
1421 |
+
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
|
1422 |
+
'size' => 'small',
|
1423 |
+
),
|
1424 |
+
array(
|
1425 |
+
'id' => 'profile_cover_ratio',
|
1426 |
+
'type' => 'select',
|
1427 |
+
'label' => __( 'Profile Cover Ratio', 'ultimate-member' ),
|
1428 |
+
'tooltip' => __( 'Choose global ratio for cover photos of profiles', 'ultimate-member' ),
|
1429 |
+
'default' => um_get_metadefault( 'profile_cover_ratio' ),
|
1430 |
+
'options' => array(
|
1431 |
+
'1.6:1' => '1.6:1',
|
1432 |
+
'2.7:1' => '2.7:1',
|
1433 |
+
'2.2:1' => '2.2:1',
|
1434 |
+
'3.2:1' => '3.2:1',
|
1435 |
+
),
|
1436 |
+
'conditional' => array( 'profile_cover_enabled', '=', 1 ),
|
1437 |
+
'size' => 'small',
|
1438 |
+
),
|
1439 |
+
array(
|
1440 |
+
'id' => 'profile_show_metaicon',
|
1441 |
+
'type' => 'checkbox',
|
1442 |
+
'label' => __( 'Profile Header Meta Text Icon', 'ultimate-member' ),
|
1443 |
+
'default' => 0,
|
1444 |
+
'tooltip' => __( 'Display field icons for related user meta fields in header or not', 'ultimate-member' ),
|
1445 |
+
),
|
1446 |
+
array(
|
1447 |
+
'id' => 'profile_show_name',
|
1448 |
+
'type' => 'checkbox',
|
1449 |
+
'label' => __( 'Show display name in profile header', 'ultimate-member' ),
|
1450 |
+
'default' => um_get_metadefault( 'profile_show_name' ),
|
1451 |
+
'tooltip' => __( 'Switch on/off the user name on profile header', 'ultimate-member' ),
|
1452 |
+
),
|
1453 |
+
array(
|
1454 |
+
'id' => 'profile_show_social_links',
|
1455 |
+
'type' => 'checkbox',
|
1456 |
+
'label' => __( 'Show social links in profile header', 'ultimate-member' ),
|
1457 |
+
'default' => um_get_metadefault( 'profile_show_social_links' ),
|
1458 |
+
'tooltip' => __( 'Switch on/off the social links on profile header', 'ultimate-member' ),
|
1459 |
+
),
|
1460 |
+
array(
|
1461 |
+
'id' => 'profile_show_bio',
|
1462 |
+
'type' => 'checkbox',
|
1463 |
+
'label' => __( 'Show user description in header', 'ultimate-member' ),
|
1464 |
+
'default' => um_get_metadefault( 'profile_show_bio' ),
|
1465 |
+
'tooltip' => __( 'Switch on/off the user description on profile header', 'ultimate-member' ),
|
1466 |
+
),
|
1467 |
+
array(
|
1468 |
+
'id' => 'profile_show_html_bio',
|
1469 |
+
'type' => 'checkbox',
|
1470 |
+
'label' => __( 'Enable HTML support for user description', 'ultimate-member' ),
|
1471 |
+
'tooltip' => __( 'Switch on/off to enable/disable support for html tags on user description.', 'ultimate-member' ),
|
1472 |
+
),
|
1473 |
+
array(
|
1474 |
+
'id' => 'profile_bio_maxchars',
|
1475 |
+
'type' => 'text',
|
1476 |
+
'label' => __( 'User description maximum chars', 'ultimate-member' ),
|
1477 |
+
'default' => um_get_metadefault( 'profile_bio_maxchars' ),
|
1478 |
+
'tooltip' => __( 'Maximum number of characters to allow in user description field in header.', 'ultimate-member' ),
|
1479 |
+
'conditional' => array( 'profile_show_bio', '=', 1 ),
|
1480 |
+
'size' => 'small',
|
1481 |
+
),
|
1482 |
+
array(
|
1483 |
+
'id' => 'profile_header_menu',
|
1484 |
+
'type' => 'select',
|
1485 |
+
'label' => __( 'Profile Header Menu Position', 'ultimate-member' ),
|
1486 |
+
'default' => um_get_metadefault( 'profile_header_menu' ),
|
1487 |
+
'tooltip' => __( 'For incompatible themes, please make the menu open from left instead of bottom by default.', 'ultimate-member' ),
|
1488 |
+
'options' => array(
|
1489 |
+
'bc' => __( 'Bottom of Icon', 'ultimate-member' ),
|
1490 |
+
'lc' => __( 'Left of Icon (right for RTL)', 'ultimate-member' ),
|
1491 |
+
),
|
1492 |
+
'size' => 'small',
|
1493 |
+
),
|
1494 |
+
array(
|
1495 |
+
'id' => 'profile_empty_text',
|
1496 |
+
'type' => 'checkbox',
|
1497 |
+
'label' => __( 'Show a custom message if profile is empty', 'ultimate-member' ),
|
1498 |
+
'default' => um_get_metadefault( 'profile_empty_text' ),
|
1499 |
+
'tooltip' => __( 'Switch on/off the custom message that appears when the profile is empty', 'ultimate-member' ),
|
1500 |
+
),
|
1501 |
+
array(
|
1502 |
+
'id' => 'profile_empty_text_emo',
|
1503 |
+
'type' => 'checkbox',
|
1504 |
+
'label' => __( 'Show the emoticon', 'ultimate-member' ),
|
1505 |
+
'default' => um_get_metadefault( 'profile_empty_text_emo' ),
|
1506 |
+
'tooltip' => __( 'Switch on/off the emoticon (sad face) that appears above the message', 'ultimate-member' ),
|
1507 |
+
'conditional' => array( 'profile_empty_text', '=', 1 ),
|
1508 |
+
),
|
1509 |
+
),
|
1510 |
+
),
|
1511 |
+
'profile_menu' => array(
|
1512 |
+
'title' => __( 'Profile Menu', 'ultimate-member' ),
|
1513 |
+
'fields' => $appearances_profile_menu_fields,
|
1514 |
+
),
|
1515 |
+
'registration_form' => array(
|
1516 |
+
'title' => __( 'Registration Form', 'ultimate-member' ),
|
1517 |
+
'fields' => array(
|
1518 |
+
array(
|
1519 |
+
'id' => 'register_template',
|
1520 |
+
'type' => 'select',
|
1521 |
+
'label' => __( 'Registration Default Template', 'ultimate-member' ),
|
1522 |
+
'tooltip' => __( 'This will be the default template to output registration', 'ultimate-member' ),
|
1523 |
+
'default' => um_get_metadefault( 'register_template' ),
|
1524 |
+
'options' => UM()->shortcodes()->get_templates( 'register' ),
|
1525 |
+
'size' => 'small',
|
1526 |
+
),
|
1527 |
+
array(
|
1528 |
+
'id' => 'register_max_width',
|
1529 |
+
'type' => 'text',
|
1530 |
+
'label' => __( 'Registration Maximum Width', 'ultimate-member' ),
|
1531 |
+
'default' => um_get_metadefault( 'register_max_width' ),
|
1532 |
+
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
|
1533 |
+
'size' => 'small',
|
1534 |
+
),
|
1535 |
+
array(
|
1536 |
+
'id' => 'register_align',
|
1537 |
+
'type' => 'select',
|
1538 |
+
'label' => __( 'Registration Shortcode Alignment', 'ultimate-member' ),
|
1539 |
+
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
|
1540 |
+
'default' => um_get_metadefault( 'register_align' ),
|
1541 |
+
'options' => array(
|
1542 |
+
'center' => __( 'Centered', 'ultimate-member' ),
|
1543 |
+
'left' => __( 'Left aligned', 'ultimate-member' ),
|
1544 |
+
'right' => __( 'Right aligned', 'ultimate-member' ),
|
1545 |
+
),
|
1546 |
+
'size' => 'small',
|
1547 |
+
),
|
1548 |
+
array(
|
1549 |
+
'id' => 'register_icons',
|
1550 |
+
'type' => 'select',
|
1551 |
+
'label' => __( 'Registration Field Icons', 'ultimate-member' ),
|
1552 |
+
'tooltip' => __( 'This controls the display of field icons in the registration form', 'ultimate-member' ),
|
1553 |
+
'default' => um_get_metadefault( 'register_icons' ),
|
1554 |
+
'options' => array(
|
1555 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
1556 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
1557 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
1558 |
+
),
|
1559 |
+
'size' => 'small',
|
1560 |
+
),
|
1561 |
+
array(
|
1562 |
+
'id' => 'register_primary_btn_word',
|
1563 |
+
'type' => 'text',
|
1564 |
+
'label' => __( 'Registration Primary Button Text', 'ultimate-member' ),
|
1565 |
+
'default' => um_get_metadefault( 'register_primary_btn_word' ),
|
1566 |
+
'tooltip' => __( 'The text that is used for primary button text', 'ultimate-member' ),
|
1567 |
+
'size' => 'medium',
|
1568 |
+
),
|
1569 |
+
array(
|
1570 |
+
'id' => 'register_secondary_btn',
|
1571 |
+
'type' => 'checkbox',
|
1572 |
+
'label' => __( 'Registration Secondary Button', 'ultimate-member' ),
|
1573 |
+
'default' => 1,
|
1574 |
+
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
|
1575 |
+
),
|
1576 |
+
array(
|
1577 |
+
'id' => 'register_secondary_btn_word',
|
1578 |
+
'type' => 'text',
|
1579 |
+
'label' => __( 'Registration Secondary Button Text', 'ultimate-member' ),
|
1580 |
+
'default' => um_get_metadefault( 'register_secondary_btn_word' ),
|
1581 |
+
'tooltip' => __( 'The text that is used for the secondary button text', 'ultimate-member' ),
|
1582 |
+
'conditional' => array( 'register_secondary_btn', '=', 1 ),
|
1583 |
+
'size' => 'medium',
|
1584 |
+
),
|
1585 |
+
array(
|
1586 |
+
'id' => 'register_secondary_btn_url',
|
1587 |
+
'type' => 'text',
|
1588 |
+
'label' => __( 'Registration Secondary Button URL', 'ultimate-member' ),
|
1589 |
+
'default' => um_get_metadefault( 'register_secondary_btn_url' ),
|
1590 |
+
'tooltip' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ),
|
1591 |
+
'conditional' => array( 'register_secondary_btn', '=', 1 ),
|
1592 |
+
'size' => 'medium',
|
1593 |
+
),
|
1594 |
+
array(
|
1595 |
+
'id' => 'register_role',
|
1596 |
+
'type' => 'select',
|
1597 |
+
'label' => __( 'Registration Default Role', 'ultimate-member' ),
|
1598 |
+
'tooltip' => __( 'This will be the default role assigned to users registering thru registration form', 'ultimate-member' ),
|
1599 |
+
'default' => um_get_metadefault( 'register_role' ),
|
1600 |
+
'options' => UM()->roles()->get_roles( __( 'Default', 'ultimate-member' ) ),
|
1601 |
+
'size' => 'small',
|
1602 |
+
),
|
1603 |
+
),
|
1604 |
+
),
|
1605 |
+
'login_form' => array(
|
1606 |
+
'title' => __( 'Login Form', 'ultimate-member' ),
|
1607 |
+
'fields' => array(
|
1608 |
+
array(
|
1609 |
+
'id' => 'login_template',
|
1610 |
+
'type' => 'select',
|
1611 |
+
'label' => __( 'Login Default Template', 'ultimate-member' ),
|
1612 |
+
'tooltip' => __( 'This will be the default template to output login', 'ultimate-member' ),
|
1613 |
+
'default' => um_get_metadefault( 'login_template' ),
|
1614 |
+
'options' => UM()->shortcodes()->get_templates( 'login' ),
|
1615 |
+
'size' => 'small',
|
1616 |
+
),
|
1617 |
+
array(
|
1618 |
+
'id' => 'login_max_width',
|
1619 |
+
'type' => 'text',
|
1620 |
+
'label' => __( 'Login Maximum Width', 'ultimate-member' ),
|
1621 |
+
'default' => um_get_metadefault( 'login_max_width' ),
|
1622 |
+
'tooltip' => __( 'The maximum width this shortcode can take from the page width', 'ultimate-member' ),
|
1623 |
+
'size' => 'small',
|
1624 |
+
),
|
1625 |
+
array(
|
1626 |
+
'id' => 'login_align',
|
1627 |
+
'type' => 'select',
|
1628 |
+
'label' => __( 'Login Shortcode Alignment', 'ultimate-member' ),
|
1629 |
+
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
|
1630 |
+
'default' => um_get_metadefault( 'login_align' ),
|
1631 |
+
'options' => array(
|
1632 |
+
'center' => __( 'Centered', 'ultimate-member' ),
|
1633 |
+
'left' => __( 'Left aligned', 'ultimate-member' ),
|
1634 |
+
'right' => __( 'Right aligned', 'ultimate-member' ),
|
1635 |
+
),
|
1636 |
+
'size' => 'small',
|
1637 |
+
),
|
1638 |
+
array(
|
1639 |
+
'id' => 'login_icons',
|
1640 |
+
'type' => 'select',
|
1641 |
+
'label' => __( 'Login Field Icons', 'ultimate-member' ),
|
1642 |
+
'tooltip' => __( 'This controls the display of field icons in the login form', 'ultimate-member' ),
|
1643 |
+
'default' => um_get_metadefault( 'login_icons' ),
|
1644 |
+
'options' => array(
|
1645 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
1646 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
1647 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
1648 |
+
),
|
1649 |
+
'size' => 'small',
|
1650 |
+
),
|
1651 |
+
array(
|
1652 |
+
'id' => 'login_primary_btn_word',
|
1653 |
+
'type' => 'text',
|
1654 |
+
'label' => __( 'Login Primary Button Text', 'ultimate-member' ),
|
1655 |
+
'default' => um_get_metadefault( 'login_primary_btn_word' ),
|
1656 |
+
'tooltip' => __( 'The text that is used for primary button text', 'ultimate-member' ),
|
1657 |
+
'size' => 'medium',
|
1658 |
+
),
|
1659 |
+
array(
|
1660 |
+
'id' => 'login_secondary_btn',
|
1661 |
+
'type' => 'checkbox',
|
1662 |
+
'label' => __( 'Login Secondary Button', 'ultimate-member' ),
|
1663 |
+
'default' => 1,
|
1664 |
+
'tooltip' => __( 'Switch on/off the secondary button display in the form', 'ultimate-member' ),
|
1665 |
+
),
|
1666 |
+
array(
|
1667 |
+
'id' => 'login_secondary_btn_word',
|
1668 |
+
'type' => 'text',
|
1669 |
+
'label' => __( 'Login Secondary Button Text', 'ultimate-member' ),
|
1670 |
+
'default' => um_get_metadefault( 'login_secondary_btn_word' ),
|
1671 |
+
'tooltip' => __( 'The text that is used for the secondary button text', 'ultimate-member' ),
|
1672 |
+
'conditional' => array( 'login_secondary_btn', '=', 1 ),
|
1673 |
+
'size' => 'medium',
|
1674 |
+
),
|
1675 |
+
array(
|
1676 |
+
'id' => 'login_secondary_btn_url',
|
1677 |
+
'type' => 'text',
|
1678 |
+
'label' => __( 'Login Secondary Button URL', 'ultimate-member' ),
|
1679 |
+
'default' => um_get_metadefault( 'login_secondary_btn_url' ),
|
1680 |
+
'tooltip' => __( 'You can replace default link for this button by entering custom URL', 'ultimate-member' ),
|
1681 |
+
'conditional' => array( 'login_secondary_btn', '=', 1 ),
|
1682 |
+
'size' => 'medium',
|
1683 |
+
),
|
1684 |
+
array(
|
1685 |
+
'id' => 'login_forgot_pass_link',
|
1686 |
+
'type' => 'checkbox',
|
1687 |
+
'label' => __( 'Login Forgot Password Link', 'ultimate-member' ),
|
1688 |
+
'default' => 1,
|
1689 |
+
'tooltip' => __( 'Switch on/off the forgot password link in login form', 'ultimate-member' ),
|
1690 |
+
),
|
1691 |
+
array(
|
1692 |
+
'id' => 'login_show_rememberme',
|
1693 |
+
'type' => 'checkbox',
|
1694 |
+
'label' => __( 'Show "Remember Me"', 'ultimate-member' ),
|
1695 |
+
'default' => 1,
|
1696 |
+
'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' ),
|
1697 |
+
),
|
1698 |
+
),
|
1699 |
+
),
|
1700 |
+
),
|
1701 |
+
),
|
1702 |
+
'extensions' => array(
|
1703 |
+
'title' => __( 'Extensions', 'ultimate-member' ),
|
1704 |
+
),
|
1705 |
+
'licenses' => array(
|
1706 |
+
'title' => __( 'Licenses', 'ultimate-member' ),
|
1707 |
+
),
|
1708 |
+
'misc' => array(
|
1709 |
+
'title' => __( 'Misc', 'ultimate-member' ),
|
1710 |
+
'fields' => array(
|
1711 |
+
array(
|
1712 |
+
'id' => 'form_asterisk',
|
1713 |
+
'type' => 'checkbox',
|
1714 |
+
'label' => __( 'Show an asterisk for required fields', 'ultimate-member' ),
|
1715 |
+
),
|
1716 |
+
array(
|
1717 |
+
'id' => 'profile_title',
|
1718 |
+
'type' => 'text',
|
1719 |
+
'label' => __( 'User Profile Title', 'ultimate-member' ),
|
1720 |
+
'tooltip' => __( 'This is the title that is displayed on a specific user profile', 'ultimate-member' ),
|
1721 |
+
'size' => 'medium',
|
1722 |
+
),
|
1723 |
+
array(
|
1724 |
+
'id' => 'profile_desc',
|
1725 |
+
'type' => 'textarea',
|
1726 |
+
'label' => __( 'User Profile Dynamic Meta Description', 'ultimate-member' ),
|
1727 |
+
'tooltip' => __( 'This will be used in the meta description that is available for search-engines.', 'ultimate-member' ),
|
1728 |
+
'args' => array(
|
1729 |
+
'textarea_rows' => 6,
|
1730 |
+
),
|
1731 |
+
),
|
1732 |
+
array(
|
1733 |
+
'id' => 'um_profile_object_cache_stop',
|
1734 |
+
'type' => 'checkbox',
|
1735 |
+
'label' => __( 'Disable Cache User Profile', 'ultimate-member' ),
|
1736 |
+
'tooltip' => __( 'Check this box if you would like to disable Ultimate Member user\'s cache.', 'ultimate-member' ),
|
1737 |
+
),
|
1738 |
+
array(
|
1739 |
+
'id' => 'enable_blocks',
|
1740 |
+
'type' => 'checkbox',
|
1741 |
+
'label' => __( 'Enable Gutenberg Blocks', 'ultimate-member' ),
|
1742 |
+
'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' ),
|
1743 |
+
),
|
1744 |
+
array(
|
1745 |
+
'id' => 'rest_api_version',
|
1746 |
+
'type' => 'select',
|
1747 |
+
'label' => __( 'REST API version', 'ultimate-member' ),
|
1748 |
+
'tooltip' => __( 'This controls the REST API version, we recommend to use the last version', 'ultimate-member' ),
|
1749 |
+
'options' => array(
|
1750 |
+
'1.0' => __( '1.0 version', 'ultimate-member' ),
|
1751 |
+
'2.0' => __( '2.0 version', 'ultimate-member' ),
|
1752 |
+
),
|
1753 |
+
),
|
1754 |
+
$same_page_update,
|
1755 |
+
array(
|
1756 |
+
'id' => 'uninstall_on_delete',
|
1757 |
+
'type' => 'checkbox',
|
1758 |
+
'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ),
|
1759 |
+
'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' ),
|
1760 |
+
),
|
1761 |
+
),
|
1762 |
+
),
|
1763 |
+
'install_info' => array(
|
1764 |
+
'title' => __( 'Install Info', 'ultimate-member' ),
|
1765 |
+
'fields' => array(
|
1766 |
+
array(
|
1767 |
+
'type' => 'install_info',
|
1768 |
+
),
|
1769 |
+
),
|
1770 |
+
),
|
1771 |
+
)
|
1772 |
+
);
|
1773 |
+
|
1774 |
+
}
|
1775 |
+
|
1776 |
+
|
1777 |
+
/**
|
1778 |
+
* @param array $settings
|
1779 |
+
*
|
1780 |
+
* @return array
|
1781 |
+
*/
|
1782 |
+
public function sorting_licenses_options( $settings ) {
|
1783 |
+
//sorting licenses
|
1784 |
+
if ( empty( $settings['licenses']['fields'] ) ) {
|
1785 |
+
return $settings;
|
1786 |
+
}
|
1787 |
+
|
1788 |
+
$licenses = $settings['licenses']['fields'];
|
1789 |
+
@uasort( $licenses, function( $a, $b ) {
|
1790 |
+
return strnatcasecmp( $a['label'], $b['label'] );
|
1791 |
+
} );
|
1792 |
+
$settings['licenses']['fields'] = $licenses;
|
1793 |
+
|
1794 |
+
//sorting extensions
|
1795 |
+
if ( empty( $settings['extensions']['sections'] ) ) {
|
1796 |
+
return $settings;
|
1797 |
+
}
|
1798 |
+
|
1799 |
+
$extensions = $settings['extensions']['sections'];
|
1800 |
+
@uasort( $extensions, function( $a, $b ) {
|
1801 |
+
return strnatcasecmp( $a['title'], $b['title'] );
|
1802 |
+
} );
|
1803 |
+
|
1804 |
+
$keys = array_keys( $extensions );
|
1805 |
+
if ( $keys[0] !== '' ) {
|
1806 |
+
$new_key = strtolower( str_replace( ' ', '_', $extensions['']['title'] ) );
|
1807 |
+
$temp = $extensions[''];
|
1808 |
+
$extensions[ $new_key ] = $temp;
|
1809 |
+
$extensions[''] = $extensions[ $keys[0] ];
|
1810 |
+
unset( $extensions[ $keys[0] ] );
|
1811 |
+
@uasort( $extensions, function( $a, $b ) {
|
1812 |
+
return strnatcasecmp( $a['title'], $b['title'] );
|
1813 |
+
} );
|
1814 |
+
}
|
1815 |
+
|
1816 |
+
$settings['extensions']['sections'] = $extensions;
|
1817 |
+
|
1818 |
+
return $settings;
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
|
1822 |
+
/**
|
1823 |
+
* @param $tab
|
1824 |
+
* @param $section
|
1825 |
+
*
|
1826 |
+
* @return array
|
1827 |
+
*/
|
1828 |
+
function get_section_fields( $tab, $section ) {
|
1829 |
+
|
1830 |
+
if ( empty( $this->settings_structure[ $tab ] ) ) {
|
1831 |
+
return array();
|
1832 |
+
}
|
1833 |
+
|
1834 |
+
if ( ! empty( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) {
|
1835 |
+
return $this->settings_structure[ $tab ]['sections'][ $section ]['fields'];
|
1836 |
+
} elseif ( ! empty( $this->settings_structure[ $tab ]['fields'] ) ) {
|
1837 |
+
return $this->settings_structure[ $tab ]['fields'];
|
1838 |
+
}
|
1839 |
+
|
1840 |
+
return array();
|
1841 |
+
}
|
1842 |
+
|
1843 |
+
|
1844 |
+
/**
|
1845 |
+
* Setup admin menu
|
1846 |
+
*/
|
1847 |
+
function primary_admin_menu() {
|
1848 |
+
add_submenu_page( 'ultimatemember', __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( &$this, 'settings_page' ) );
|
1849 |
+
}
|
1850 |
+
|
1851 |
+
|
1852 |
+
/**
|
1853 |
+
* Settings page callback
|
1854 |
+
*/
|
1855 |
+
function settings_page() {
|
1856 |
+
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
1857 |
+
$current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] );
|
1858 |
+
|
1859 |
+
$settings_struct = $this->settings_structure[ $current_tab ];
|
1860 |
+
|
1861 |
+
//remove not option hidden fields
|
1862 |
+
if ( ! empty( $settings_struct['fields'] ) ) {
|
1863 |
+
foreach ( $settings_struct['fields'] as $field_key => $field_options ) {
|
1864 |
+
|
1865 |
+
if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) {
|
1866 |
+
unset( $settings_struct['fields'][ $field_key ] );
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
}
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) ) {
|
1873 |
+
um_js_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) );
|
1874 |
+
}
|
1875 |
+
|
1876 |
+
if ( ! empty( $settings_struct['sections'] ) ) {
|
1877 |
+
if ( empty( $settings_struct['sections'][ $current_subtab ] ) ) {
|
1878 |
+
um_js_redirect( add_query_arg( array( 'page' => 'um_options', 'tab' => $current_tab ), admin_url( 'admin.php' ) ) );
|
1879 |
+
}
|
1880 |
+
}
|
1881 |
+
|
1882 |
+
echo '<div id="um-settings-wrap" class="wrap"><h2>' . __( 'Ultimate Member - Settings', 'ultimate-member' ) . '</h2>';
|
1883 |
+
|
1884 |
+
echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab );
|
1885 |
+
|
1886 |
+
/**
|
1887 |
+
* UM hook
|
1888 |
+
*
|
1889 |
+
* @type action
|
1890 |
+
* @title um_settings_page_before_{$current_tab}_{$current_subtab}_content
|
1891 |
+
* @description Show some content before settings page content
|
1892 |
+
* @change_log
|
1893 |
+
* ["Since: 2.0"]
|
1894 |
+
* @usage add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'function_name', 10 );
|
1895 |
+
* @example
|
1896 |
+
* <?php
|
1897 |
+
* add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'my_settings_page_before', 10 );
|
1898 |
+
* function my_settings_page_before() {
|
1899 |
+
* // your code here
|
1900 |
+
* }
|
1901 |
+
* ?>
|
1902 |
+
*/
|
1903 |
+
do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" );
|
1904 |
+
|
1905 |
+
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 ) ) ) {
|
1906 |
+
|
1907 |
+
/**
|
1908 |
+
* UM hook
|
1909 |
+
*
|
1910 |
+
* @type action
|
1911 |
+
* @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
|
1912 |
+
* @description Show some content before section content at settings page
|
1913 |
+
* @change_log
|
1914 |
+
* ["Since: 2.0"]
|
1915 |
+
* @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
|
1916 |
+
* @example
|
1917 |
+
* <?php
|
1918 |
+
* add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'my_settings_page_before_section', 10 );
|
1919 |
+
* function my_settings_page_before_section() {
|
1920 |
+
* // your code here
|
1921 |
+
* }
|
1922 |
+
* ?>
|
1923 |
+
*/
|
1924 |
+
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1925 |
+
|
1926 |
+
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
1927 |
+
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
|
1928 |
+
|
1929 |
+
/**
|
1930 |
+
* UM hook
|
1931 |
+
*
|
1932 |
+
* @type filter
|
1933 |
+
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
1934 |
+
*
|
1935 |
+
* @description Render settings section
|
1936 |
+
* @input_vars
|
1937 |
+
* [{"var":"$content","type":"string","desc":"Section content"},
|
1938 |
+
* {"var":"$section_fields","type":"array","desc":"Section Fields"}]
|
1939 |
+
* @change_log
|
1940 |
+
* ["Since: 2.0"]
|
1941 |
+
* @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
|
1942 |
+
* @example
|
1943 |
+
* <?php
|
1944 |
+
* add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'my_settings_section', 10, 2 );
|
1945 |
+
* function my_settings_section( $content ) {
|
1946 |
+
* // your code here
|
1947 |
+
* return $content;
|
1948 |
+
* }
|
1949 |
+
* ?>
|
1950 |
+
*/
|
1951 |
+
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
1952 |
+
$settings_section,
|
1953 |
+
$section_fields
|
1954 |
+
);
|
1955 |
+
|
1956 |
+
} else { ?>
|
1957 |
+
|
1958 |
+
<form method="post" action="" name="um-settings-form" id="um-settings-form">
|
1959 |
+
<input type="hidden" value="save" name="um-settings-action" />
|
1960 |
+
|
1961 |
+
<?php
|
1962 |
+
/**
|
1963 |
+
* UM hook
|
1964 |
+
*
|
1965 |
+
* @type action
|
1966 |
+
* @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
|
1967 |
+
* @description Show some content before section content at settings page
|
1968 |
+
* @change_log
|
1969 |
+
* ["Since: 2.0"]
|
1970 |
+
* @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
|
1971 |
+
* @example
|
1972 |
+
* <?php
|
1973 |
+
* add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'my_settings_page_before_section', 10 );
|
1974 |
+
* function my_settings_page_before_section() {
|
1975 |
+
* // your code here
|
1976 |
+
* }
|
1977 |
+
* ?>
|
1978 |
+
*/
|
1979 |
+
do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
|
1980 |
+
|
1981 |
+
$section_fields = $this->get_section_fields( $current_tab, $current_subtab );
|
1982 |
+
$settings_section = $this->render_settings_section( $section_fields, $current_tab, $current_subtab );
|
1983 |
+
|
1984 |
+
/**
|
1985 |
+
* UM hook
|
1986 |
+
*
|
1987 |
+
* @type filter
|
1988 |
+
* @title um_settings_section_{$current_tab}_{$current_subtab}_content
|
1989 |
+
* @description Render settings section
|
1990 |
+
* @input_vars
|
1991 |
+
* [{"var":"$content","type":"string","desc":"Section content"},
|
1992 |
+
* {"var":"$section_fields","type":"array","desc":"Section Fields"}]
|
1993 |
+
* @change_log
|
1994 |
+
* ["Since: 2.0"]
|
1995 |
+
* @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
|
1996 |
+
* @example
|
1997 |
+
* <?php
|
1998 |
+
* add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'my_settings_section', 10, 2 );
|
1999 |
+
* function my_settings_section( $content ) {
|
2000 |
+
* // your code here
|
2001 |
+
* return $content;
|
2002 |
+
* }
|
2003 |
+
* ?>
|
2004 |
+
*/
|
2005 |
+
echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
|
2006 |
+
$settings_section,
|
2007 |
+
$section_fields
|
2008 |
+
); ?>
|
2009 |
+
|
2010 |
+
|
2011 |
+
<p class="submit">
|
2012 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Save Changes', 'ultimate-member' ) ?>" />
|
2013 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2014 |
+
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
|
2015 |
+
</p>
|
2016 |
+
</form>
|
2017 |
+
|
2018 |
+
<?php }
|
2019 |
+
}
|
2020 |
+
|
2021 |
+
|
2022 |
+
/**
|
2023 |
+
* Generate pages tabs
|
2024 |
+
*
|
2025 |
+
* @param string $page
|
2026 |
+
* @return string
|
2027 |
+
*/
|
2028 |
+
function generate_tabs_menu( $page = 'settings' ) {
|
2029 |
+
|
2030 |
+
$tabs = '<h2 class="nav-tab-wrapper um-nav-tab-wrapper">';
|
2031 |
+
|
2032 |
+
switch( $page ) {
|
2033 |
+
case 'settings':
|
2034 |
+
$menu_tabs = array();
|
2035 |
+
foreach ( $this->settings_structure as $slug => $tab ) {
|
2036 |
+
if ( ! empty( $tab['fields'] ) ) {
|
2037 |
+
foreach ( $tab['fields'] as $field_key => $field_options ) {
|
2038 |
+
if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) {
|
2039 |
+
unset( $tab['fields'][ $field_key ] );
|
2040 |
+
}
|
2041 |
+
}
|
2042 |
+
}
|
2043 |
+
|
2044 |
+
if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) ) {
|
2045 |
+
$menu_tabs[ $slug ] = $tab['title'];
|
2046 |
+
}
|
2047 |
+
}
|
2048 |
+
|
2049 |
+
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
2050 |
+
foreach ( $menu_tabs as $name => $label ) {
|
2051 |
+
$active = ( $current_tab == $name ) ? 'nav-tab-active' : '';
|
2052 |
+
$tabs .= '<a href="' . esc_url( admin_url( 'admin.php?page=um_options' . ( empty( $name ) ? '' : '&tab=' . $name ) ) ) . '" class="nav-tab ' . esc_attr( $active ) . '">' .
|
2053 |
+
$label .
|
2054 |
+
'</a>';
|
2055 |
+
}
|
2056 |
+
|
2057 |
+
break;
|
2058 |
+
default:
|
2059 |
+
/**
|
2060 |
+
* UM hook
|
2061 |
+
*
|
2062 |
+
* @type filter
|
2063 |
+
* @title um_generate_tabs_menu_{$page}
|
2064 |
+
* @description Generate tabs menu
|
2065 |
+
* @input_vars
|
2066 |
+
* [{"var":"$tabs","type":"array","desc":"UM menu tabs"}]
|
2067 |
+
* @change_log
|
2068 |
+
* ["Since: 2.0"]
|
2069 |
+
* @usage add_filter( 'um_generate_tabs_menu_{$page}', 'function_name', 10, 1 );
|
2070 |
+
* @example
|
2071 |
+
* <?php
|
2072 |
+
* add_filter( 'um_generate_tabs_menu_{$page}', 'my_tabs_menu', 10, 1 );
|
2073 |
+
* function my_tabs_menu( $tabs ) {
|
2074 |
+
* // your code here
|
2075 |
+
* return $tabs;
|
2076 |
+
* }
|
2077 |
+
* ?>
|
2078 |
+
*/
|
2079 |
+
$tabs = apply_filters( 'um_generate_tabs_menu_' . $page, $tabs );
|
2080 |
+
break;
|
2081 |
+
}
|
2082 |
+
|
2083 |
+
return $tabs . '</h2>';
|
2084 |
+
}
|
2085 |
+
|
2086 |
+
|
2087 |
+
/**
|
2088 |
+
* @param string $tab
|
2089 |
+
*
|
2090 |
+
* @return string
|
2091 |
+
*/
|
2092 |
+
function generate_subtabs_menu( $tab = '' ) {
|
2093 |
+
if ( empty( $this->settings_structure[ $tab ]['sections'] ) ) {
|
2094 |
+
return '';
|
2095 |
+
}
|
2096 |
+
|
2097 |
+
$menu_subtabs = array();
|
2098 |
+
foreach ( $this->settings_structure[ $tab ]['sections'] as $slug => $subtab ) {
|
2099 |
+
$menu_subtabs[ $slug ] = $subtab['title'];
|
2100 |
+
}
|
2101 |
+
|
2102 |
+
$subtabs = '<div><ul class="subsubsub">';
|
2103 |
+
|
2104 |
+
$current_tab = empty( $_GET['tab'] ) ? '' : sanitize_key( $_GET['tab'] );
|
2105 |
+
$current_subtab = empty( $_GET['section'] ) ? '' : sanitize_key( $_GET['section'] );
|
2106 |
+
foreach ( $menu_subtabs as $name => $label ) {
|
2107 |
+
$active = ( $current_subtab == $name ) ? 'current' : '';
|
2108 |
+
$subtabs .= '<a href="' . esc_url( admin_url( 'admin.php?page=um_options' . ( empty( $current_tab ) ? '' : '&tab=' . $current_tab ) . ( empty( $name ) ? '' : '§ion=' . $name ) ) ) . '" class="' . $active . '">'
|
2109 |
+
. $label .
|
2110 |
+
'</a> | ';
|
2111 |
+
}
|
2112 |
+
|
2113 |
+
return substr( $subtabs, 0, -3 ) . '</ul></div>';
|
2114 |
+
}
|
2115 |
+
|
2116 |
+
|
2117 |
+
/**
|
2118 |
+
* Handler for settings forms
|
2119 |
+
* when "Save Settings" button click
|
2120 |
+
*
|
2121 |
+
*/
|
2122 |
+
function save_settings_handler() {
|
2123 |
+
|
2124 |
+
if ( isset( $_POST['um-settings-action'] ) && 'save' === sanitize_key( $_POST['um-settings-action'] ) && ! empty( $_POST['um_options'] ) ) {
|
2125 |
+
|
2126 |
+
$nonce = ! empty( $_POST['__umnonce'] ) ? $_POST['__umnonce'] : '';
|
2127 |
+
|
2128 |
+
if ( ( ! wp_verify_nonce( $nonce, 'um-settings-nonce' ) || empty( $nonce ) ) || ! current_user_can( 'manage_options' ) ) {
|
2129 |
+
// This nonce is not valid.
|
2130 |
+
wp_die( __( 'Security Check', 'ultimate-member' ) );
|
2131 |
+
}
|
2132 |
+
|
2133 |
+
/**
|
2134 |
+
* UM hook
|
2135 |
+
*
|
2136 |
+
* @type action
|
2137 |
+
* @title um_settings_before_save
|
2138 |
+
* @description Before settings save action
|
2139 |
+
* @change_log
|
2140 |
+
* ["Since: 2.0"]
|
2141 |
+
* @usage add_action( 'um_settings_before_save', 'function_name', 10 );
|
2142 |
+
* @example
|
2143 |
+
* <?php
|
2144 |
+
* add_action( 'um_settings_before_save', 'my_settings_before_save', 10 );
|
2145 |
+
* function my_settings_before_save() {
|
2146 |
+
* // your code here
|
2147 |
+
* }
|
2148 |
+
* ?>
|
2149 |
+
*/
|
2150 |
+
do_action( "um_settings_before_save" );
|
2151 |
+
|
2152 |
+
/**
|
2153 |
+
* UM hook
|
2154 |
+
*
|
2155 |
+
* @type filter
|
2156 |
+
* @title um_change_settings_before_save
|
2157 |
+
* @description Change settings before save
|
2158 |
+
* @input_vars
|
2159 |
+
* [{"var":"$settings","type":"array","desc":"UM Settings on save"}]
|
2160 |
+
* @change_log
|
2161 |
+
* ["Since: 2.0"]
|
2162 |
+
* @usage add_filter( 'um_change_settings_before_save', 'function_name', 10, 1 );
|
2163 |
+
* @example
|
2164 |
+
* <?php
|
2165 |
+
* add_filter( 'um_change_settings_before_save', 'my_change_settings_before_save', 10, 1 );
|
2166 |
+
* function my_change_settings_before_save( $settings ) {
|
2167 |
+
* // your code here
|
2168 |
+
* return $settings;
|
2169 |
+
* }
|
2170 |
+
* ?>
|
2171 |
+
*/
|
2172 |
+
$settings = apply_filters( 'um_change_settings_before_save', $_POST['um_options'] );
|
2173 |
+
|
2174 |
+
$settings = UM()->admin()->sanitize_options( $settings );
|
2175 |
+
|
2176 |
+
foreach ( $settings as $key => $value ) {
|
2177 |
+
UM()->options()->update( $key, $value );
|
2178 |
+
}
|
2179 |
+
|
2180 |
+
/**
|
2181 |
+
* UM hook
|
2182 |
+
*
|
2183 |
+
* @type action
|
2184 |
+
* @title um_settings_save
|
2185 |
+
* @description After settings save action
|
2186 |
+
* @change_log
|
2187 |
+
* ["Since: 2.0"]
|
2188 |
+
* @usage add_action( 'um_settings_save', 'function_name', 10 );
|
2189 |
+
* @example
|
2190 |
+
* <?php
|
2191 |
+
* add_action( 'um_settings_save', 'my_settings_save', 10 );
|
2192 |
+
* function my_settings_save() {
|
2193 |
+
* // your code here
|
2194 |
+
* }
|
2195 |
+
* ?>
|
2196 |
+
*/
|
2197 |
+
do_action( 'um_settings_save' );
|
2198 |
+
|
2199 |
+
//redirect after save settings
|
2200 |
+
$arg = array(
|
2201 |
+
'page' => 'um_options',
|
2202 |
+
);
|
2203 |
+
|
2204 |
+
if ( ! empty( $_GET['tab'] ) ) {
|
2205 |
+
$arg['tab'] = sanitize_key( $_GET['tab'] );
|
2206 |
+
}
|
2207 |
+
|
2208 |
+
if ( ! empty( $_GET['section'] ) ) {
|
2209 |
+
$arg['section'] = sanitize_key( $_GET['section'] );
|
2210 |
+
}
|
2211 |
+
|
2212 |
+
um_js_redirect( add_query_arg( $arg, admin_url( 'admin.php' ) ) );
|
2213 |
+
}
|
2214 |
+
}
|
2215 |
+
|
2216 |
+
|
2217 |
+
function set_default_if_empty( $settings ) {
|
2218 |
+
$tab = '';
|
2219 |
+
if ( ! empty( $_GET['tab'] ) ) {
|
2220 |
+
$tab = sanitize_key( $_GET['tab'] );
|
2221 |
+
}
|
2222 |
+
|
2223 |
+
$section = '';
|
2224 |
+
if ( ! empty( $_GET['section'] ) ) {
|
2225 |
+
$section = sanitize_key( $_GET['section'] );
|
2226 |
+
}
|
2227 |
+
|
2228 |
+
|
2229 |
+
if ( 'access' === $tab && empty( $section ) ) {
|
2230 |
+
if ( ! array_key_exists( 'access_exclude_uris', $settings ) ) {
|
2231 |
+
$settings['access_exclude_uris'] = array();
|
2232 |
+
}
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
return $settings;
|
2236 |
+
}
|
2237 |
+
|
2238 |
+
|
2239 |
+
/**
|
2240 |
+
* Remove empty values from multi text fields
|
2241 |
+
*
|
2242 |
+
* @param $settings
|
2243 |
+
* @return array
|
2244 |
+
*/
|
2245 |
+
function remove_empty_values( $settings ) {
|
2246 |
+
$tab = '';
|
2247 |
+
if ( ! empty( $_GET['tab'] ) ) {
|
2248 |
+
$tab = sanitize_key( $_GET['tab'] );
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
$section = '';
|
2252 |
+
if ( ! empty( $_GET['section'] ) ) {
|
2253 |
+
$section = sanitize_key( $_GET['section'] );
|
2254 |
+
}
|
2255 |
+
|
2256 |
+
if ( isset( $this->settings_structure[ $tab ]['sections'][ $section ]['fields'] ) ) {
|
2257 |
+
$fields = $this->settings_structure[ $tab ]['sections'][ $section ]['fields'];
|
2258 |
+
} else {
|
2259 |
+
$fields = $this->settings_structure[ $tab ]['fields'];
|
2260 |
+
}
|
2261 |
+
|
2262 |
+
if ( empty( $fields ) ) {
|
2263 |
+
return $settings;
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
|
2267 |
+
$filtered_settings = array();
|
2268 |
+
foreach ( $settings as $key => $value ) {
|
2269 |
+
|
2270 |
+
$filtered_settings[ $key ] = $value;
|
2271 |
+
|
2272 |
+
foreach ( $fields as $field ) {
|
2273 |
+
if ( $field['id'] == $key && isset( $field['type'] ) && $field['type'] == 'multi_text' ) {
|
2274 |
+
$filtered_settings[ $key ] = array_filter( $settings[ $key ] );
|
2275 |
+
}
|
2276 |
+
}
|
2277 |
+
}
|
2278 |
+
|
2279 |
+
return $filtered_settings;
|
2280 |
+
}
|
2281 |
+
|
2282 |
+
|
2283 |
+
/**
|
2284 |
+
*
|
2285 |
+
*/
|
2286 |
+
function check_permalinks_changes() {
|
2287 |
+
if ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
|
2288 |
+
if ( UM()->options()->get( 'permalink_base' ) !== $_POST['um_options']['permalink_base'] ) {
|
2289 |
+
$this->need_change_permalinks = true;
|
2290 |
+
}
|
2291 |
+
}
|
2292 |
+
|
2293 |
+
// set variable if gravatar settings were changed
|
2294 |
+
// update for um_member_directory_data metakey
|
2295 |
+
if ( isset( $_POST['um_options']['use_gravatars'] ) ) {
|
2296 |
+
$use_gravatar = UM()->options()->get( 'use_gravatars' );
|
2297 |
+
if ( ( empty( $use_gravatar ) && ! empty( $_POST['um_options']['use_gravatars'] ) ) || ( ! empty( $use_gravatar ) && empty( $_POST['um_options']['use_gravatars'] ) ) ) {
|
2298 |
+
$this->gravatar_changed = true;
|
2299 |
+
}
|
2300 |
+
}
|
2301 |
+
}
|
2302 |
+
|
2303 |
+
|
2304 |
+
/**
|
2305 |
+
*
|
2306 |
+
*/
|
2307 |
+
function on_settings_save() {
|
2308 |
+
if ( ! empty( $_POST['um_options'] ) ) {
|
2309 |
+
|
2310 |
+
if ( ! empty( $_POST['um_options']['pages_settings'] ) ) {
|
2311 |
+
$post_ids = new \WP_Query( array(
|
2312 |
+
'post_type' => 'page',
|
2313 |
+
'meta_query' => array(
|
2314 |
+
array(
|
2315 |
+
'key' => '_um_core',
|
2316 |
+
'compare' => 'EXISTS'
|
2317 |
+
)
|
2318 |
+
),
|
2319 |
+
'posts_per_page' => -1,
|
2320 |
+
'fields' => 'ids'
|
2321 |
+
) );
|
2322 |
+
|
2323 |
+
$post_ids = $post_ids->get_posts();
|
2324 |
+
|
2325 |
+
if ( ! empty( $post_ids ) ) {
|
2326 |
+
foreach ( $post_ids as $post_id ) {
|
2327 |
+
delete_post_meta( $post_id, '_um_core' );
|
2328 |
+
}
|
2329 |
+
}
|
2330 |
+
|
2331 |
+
foreach ( $_POST['um_options'] as $option_slug => $post_id ) {
|
2332 |
+
$slug = str_replace( 'core_', '', $option_slug );
|
2333 |
+
update_post_meta( $post_id, '_um_core', $slug );
|
2334 |
+
}
|
2335 |
+
|
2336 |
+
// reset rewrite rules after re-save pages
|
2337 |
+
UM()->rewrite()->reset_rules();
|
2338 |
+
|
2339 |
+
} elseif ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
|
2340 |
+
if ( ! empty( $this->need_change_permalinks ) ) {
|
2341 |
+
$users = get_users( array(
|
2342 |
+
'fields' => 'ids',
|
2343 |
+
) );
|
2344 |
+
if ( ! empty( $users ) ) {
|
2345 |
+
foreach ( $users as $user_id ) {
|
2346 |
+
UM()->user()->generate_profile_slug( $user_id );
|
2347 |
+
}
|
2348 |
+
}
|
2349 |
+
}
|
2350 |
+
|
2351 |
+
|
2352 |
+
// update for um_member_directory_data metakey
|
2353 |
+
if ( isset( $_POST['um_options']['use_gravatars'] ) ) {
|
2354 |
+
if ( $this->gravatar_changed ) {
|
2355 |
+
global $wpdb;
|
2356 |
+
|
2357 |
+
if ( ! empty( $_POST['um_options']['use_gravatars'] ) ) {
|
2358 |
+
|
2359 |
+
$results = $wpdb->get_col(
|
2360 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2361 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND um.meta_key = 'synced_gravatar_hashed_id' )
|
2362 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2363 |
+
WHERE um.meta_value != '' AND um.meta_value IS NOT NULL AND
|
2364 |
+
um2.meta_value LIKE '%s:13:\"profile_photo\";b:0;%'"
|
2365 |
+
);
|
2366 |
+
|
2367 |
+
} else {
|
2368 |
+
|
2369 |
+
$results = $wpdb->get_col(
|
2370 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2371 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND ( um.meta_key = 'synced_profile_photo' || um.meta_key = 'profile_photo' ) )
|
2372 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2373 |
+
WHERE ( um.meta_value IS NULL OR um.meta_value = '' ) AND
|
2374 |
+
um2.meta_value LIKE '%s:13:\"profile_photo\";b:1;%'"
|
2375 |
+
);
|
2376 |
+
|
2377 |
+
}
|
2378 |
+
|
2379 |
+
if ( ! empty( $results ) ) {
|
2380 |
+
foreach ( $results as $user_id ) {
|
2381 |
+
$md_data = get_user_meta( $user_id, 'um_member_directory_data', true );
|
2382 |
+
if ( ! empty( $md_data ) ) {
|
2383 |
+
$md_data['profile_photo'] = ! empty( $_POST['um_options']['use_gravatars'] );
|
2384 |
+
update_user_meta( $user_id, 'um_member_directory_data', $md_data );
|
2385 |
+
}
|
2386 |
+
}
|
2387 |
+
}
|
2388 |
+
}
|
2389 |
+
}
|
2390 |
+
|
2391 |
+
} elseif ( isset( $_POST['um_options']['member_directory_own_table'] ) ) {
|
2392 |
+
if ( empty( $_POST['um_options']['member_directory_own_table'] ) ) {
|
2393 |
+
global $wpdb;
|
2394 |
+
|
2395 |
+
$results = $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}um_metadata LIMIT 1", ARRAY_A );
|
2396 |
+
|
2397 |
+
if ( ! empty( $results ) ) {
|
2398 |
+
$wpdb->query("TRUNCATE TABLE {$wpdb->prefix}um_metadata" );
|
2399 |
+
}
|
2400 |
+
|
2401 |
+
update_option( 'um_member_directory_truncated', time() );
|
2402 |
+
}
|
2403 |
+
} elseif ( isset( $_POST['um_options']['account_hide_in_directory_default'] ) ) {
|
2404 |
+
|
2405 |
+
global $wpdb;
|
2406 |
+
|
2407 |
+
if ( $_POST['um_options']['account_hide_in_directory_default'] === 'No' ) {
|
2408 |
+
|
2409 |
+
$results = $wpdb->get_col(
|
2410 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2411 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND um.meta_key = 'hide_in_members' )
|
2412 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2413 |
+
WHERE um.meta_value IS NULL AND
|
2414 |
+
um2.meta_value LIKE '%s:15:\"hide_in_members\";b:1;%'"
|
2415 |
+
);
|
2416 |
+
|
2417 |
+
} else {
|
2418 |
+
|
2419 |
+
$results = $wpdb->get_col(
|
2420 |
+
"SELECT u.ID FROM {$wpdb->users} AS u
|
2421 |
+
LEFT JOIN {$wpdb->usermeta} AS um ON ( um.user_id = u.ID AND um.meta_key = 'hide_in_members' )
|
2422 |
+
LEFT JOIN {$wpdb->usermeta} AS um2 ON ( um2.user_id = u.ID AND um2.meta_key = 'um_member_directory_data' )
|
2423 |
+
WHERE um.meta_value IS NULL AND
|
2424 |
+
um2.meta_value LIKE '%s:15:\"hide_in_members\";b:0;%'"
|
2425 |
+
);
|
2426 |
+
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
if ( ! empty( $results ) ) {
|
2430 |
+
foreach ( $results as $user_id ) {
|
2431 |
+
$md_data = get_user_meta( $user_id, 'um_member_directory_data', true );
|
2432 |
+
if ( ! empty( $md_data ) ) {
|
2433 |
+
$md_data['hide_in_members'] = ( $_POST['um_options']['account_hide_in_directory_default'] === 'No' ) ? false : true;
|
2434 |
+
update_user_meta( $user_id, 'um_member_directory_data', $md_data );
|
2435 |
+
}
|
2436 |
+
}
|
2437 |
+
}
|
2438 |
+
|
2439 |
+
}
|
2440 |
+
}
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
|
2444 |
+
/**
|
2445 |
+
*
|
2446 |
+
*/
|
2447 |
+
function before_licenses_save() {
|
2448 |
+
if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) ) {
|
2449 |
+
return;
|
2450 |
+
}
|
2451 |
+
|
2452 |
+
foreach ( $_POST['um_options'] as $key => $value ) {
|
2453 |
+
$this->previous_licenses[ sanitize_key( $key ) ] = UM()->options()->get( $key );
|
2454 |
+
}
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
|
2458 |
+
/**
|
2459 |
+
*
|
2460 |
+
*/
|
2461 |
+
function licenses_save() {
|
2462 |
+
if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) ) {
|
2463 |
+
return;
|
2464 |
+
}
|
2465 |
+
|
2466 |
+
foreach ( $_POST['um_options'] as $key => $value ) {
|
2467 |
+
$key = sanitize_key( $key );
|
2468 |
+
$value = sanitize_text_field( $value );
|
2469 |
+
|
2470 |
+
$edd_action = '';
|
2471 |
+
$license_key = '';
|
2472 |
+
if ( empty( $this->previous_licenses[ $key ] ) && ! empty( $value ) || ( ! empty( $this->previous_licenses[ $key ] ) && ! empty( $value ) && $this->previous_licenses[ $key ] != $value ) ) {
|
2473 |
+
$edd_action = 'activate_license';
|
2474 |
+
$license_key = $value;
|
2475 |
+
} elseif ( ! empty( $this->previous_licenses[ $key ] ) && empty( $value ) ) {
|
2476 |
+
$edd_action = 'deactivate_license';
|
2477 |
+
$license_key = $this->previous_licenses[ $key ];
|
2478 |
+
} elseif ( ! empty( $this->previous_licenses[ $key ] ) && ! empty( $value ) ) {
|
2479 |
+
$edd_action = 'check_license';
|
2480 |
+
$license_key = $value;
|
2481 |
+
}
|
2482 |
+
|
2483 |
+
if ( empty( $edd_action ) ) {
|
2484 |
+
continue;
|
2485 |
+
}
|
2486 |
+
|
2487 |
+
$item_name = false;
|
2488 |
+
$version = false;
|
2489 |
+
$author = false;
|
2490 |
+
foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) {
|
2491 |
+
if ( $field_data['id'] == $key ) {
|
2492 |
+
$item_name = ! empty( $field_data['item_name'] ) ? $field_data['item_name'] : false;
|
2493 |
+
$version = ! empty( $field_data['version'] ) ? $field_data['version'] : false;
|
2494 |
+
$author = ! empty( $field_data['author'] ) ? $field_data['author'] : false;
|
2495 |
+
}
|
2496 |
+
}
|
2497 |
+
|
2498 |
+
$api_params = array(
|
2499 |
+
'edd_action' => $edd_action,
|
2500 |
+
'license' => $license_key,
|
2501 |
+
'item_name' => $item_name,
|
2502 |
+
'version' => $version,
|
2503 |
+
'author' => $author,
|
2504 |
+
'url' => home_url(),
|
2505 |
+
);
|
2506 |
+
|
2507 |
+
$request = wp_remote_post(
|
2508 |
+
UM()->store_url,
|
2509 |
+
array(
|
2510 |
+
'timeout' => UM()->request_timeout,
|
2511 |
+
'sslverify' => false,
|
2512 |
+
'body' => $api_params
|
2513 |
+
)
|
2514 |
+
);
|
2515 |
+
|
2516 |
+
if ( ! is_wp_error( $request ) ) {
|
2517 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
2518 |
+
} else {
|
2519 |
+
$request = wp_remote_post(
|
2520 |
+
UM()->store_url,
|
2521 |
+
array(
|
2522 |
+
'timeout' => UM()->request_timeout,
|
2523 |
+
'sslverify' => true,
|
2524 |
+
'body' => $api_params
|
2525 |
+
)
|
2526 |
+
);
|
2527 |
+
|
2528 |
+
if ( ! is_wp_error( $request ) ) {
|
2529 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
2530 |
+
}
|
2531 |
+
}
|
2532 |
+
|
2533 |
+
$request = ( $request ) ? maybe_unserialize( $request ) : false;
|
2534 |
+
|
2535 |
+
if ( $edd_action == 'activate_license' || $edd_action == 'check_license' ) {
|
2536 |
+
update_option( "{$key}_edd_answer", $request );
|
2537 |
+
} else {
|
2538 |
+
delete_option( "{$key}_edd_answer" );
|
2539 |
+
}
|
2540 |
+
|
2541 |
+
}
|
2542 |
+
}
|
2543 |
+
|
2544 |
+
|
2545 |
+
/**
|
2546 |
+
*
|
2547 |
+
*/
|
2548 |
+
function settings_before_email_tab() {
|
2549 |
+
$email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] );
|
2550 |
+
$emails = UM()->config()->email_notifications;
|
2551 |
+
|
2552 |
+
if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
|
2553 |
+
include_once um_path . 'includes/admin/core/list-tables/emails-list-table.php';
|
2554 |
+
}
|
2555 |
+
}
|
2556 |
+
|
2557 |
+
|
2558 |
+
/**
|
2559 |
+
* @param $section
|
2560 |
+
*
|
2561 |
+
* @return string
|
2562 |
+
*/
|
2563 |
+
function settings_email_tab( $section ) {
|
2564 |
+
$email_key = empty( $_GET['email'] ) ? '' : sanitize_key( $_GET['email'] );
|
2565 |
+
$emails = UM()->config()->email_notifications;
|
2566 |
+
|
2567 |
+
if ( empty( $email_key ) || empty( $emails[ $email_key ] ) ) {
|
2568 |
+
return $section;
|
2569 |
+
}
|
2570 |
+
|
2571 |
+
$in_theme = UM()->mail()->template_in_theme( $email_key );
|
2572 |
+
|
2573 |
+
/**
|
2574 |
+
* UM hook
|
2575 |
+
*
|
2576 |
+
* @type filter
|
2577 |
+
* @title um_admin_settings_email_section_fields
|
2578 |
+
* @description Extend UM Email Settings
|
2579 |
+
* @input_vars
|
2580 |
+
* [{"var":"$settings","type":"array","desc":"UM Email Settings"},
|
2581 |
+
* {"var":"$email_key","type":"string","desc":"Email Key"}]
|
2582 |
+
* @change_log
|
2583 |
+
* ["Since: 2.0"]
|
2584 |
+
* @usage add_filter( 'um_admin_settings_email_section_fields', 'function_name', 10, 2 );
|
2585 |
+
* @example
|
2586 |
+
* <?php
|
2587 |
+
* add_filter( 'um_admin_settings_email_section_fields', 'my_admin_settings_email_section', 10, 2 );
|
2588 |
+
* function my_admin_settings_email_section( $settings, $email_key ) {
|
2589 |
+
* // your code here
|
2590 |
+
* return $settings;
|
2591 |
+
* }
|
2592 |
+
* ?>
|
2593 |
+
*/
|
2594 |
+
$section_fields = apply_filters( 'um_admin_settings_email_section_fields', array(
|
2595 |
+
array(
|
2596 |
+
'id' => 'um_email_template',
|
2597 |
+
'type' => 'hidden',
|
2598 |
+
'value' => $email_key,
|
2599 |
+
),
|
2600 |
+
array(
|
2601 |
+
'id' => $email_key . '_on',
|
2602 |
+
'type' => 'checkbox',
|
2603 |
+
'label' => $emails[ $email_key ]['title'],
|
2604 |
+
'tooltip' => $emails[ $email_key ]['description'],
|
2605 |
+
),
|
2606 |
+
array(
|
2607 |
+
'id' => $email_key . '_sub',
|
2608 |
+
'type' => 'text',
|
2609 |
+
'label' => __( 'Subject Line', 'ultimate-member' ),
|
2610 |
+
'conditional' => array( $email_key . '_on', '=', 1 ),
|
2611 |
+
'tooltip' => __( 'This is the subject line of the e-mail', 'ultimate-member' ),
|
2612 |
+
),
|
2613 |
+
array(
|
2614 |
+
'id' => $email_key,
|
2615 |
+
'type' => 'email_template',
|
2616 |
+
'label' => __( 'Message Body', 'ultimate-member' ),
|
2617 |
+
'conditional' => array( $email_key . '_on', '=', 1 ),
|
2618 |
+
'tooltip' => __( 'This is the content of the e-mail', 'ultimate-member' ),
|
2619 |
+
'value' => UM()->mail()->get_email_template( $email_key ),
|
2620 |
+
'in_theme' => $in_theme
|
2621 |
+
),
|
2622 |
+
), $email_key );
|
2623 |
+
|
2624 |
+
return $this->render_settings_section( $section_fields, 'email', $email_key );
|
2625 |
+
}
|
2626 |
+
|
2627 |
+
|
2628 |
+
/**
|
2629 |
+
*
|
2630 |
+
*/
|
2631 |
+
function settings_appearance_profile_tab() {
|
2632 |
+
wp_enqueue_media();
|
2633 |
+
}
|
2634 |
+
|
2635 |
+
|
2636 |
+
/**
|
2637 |
+
* @param $html
|
2638 |
+
* @param $section_fields
|
2639 |
+
*
|
2640 |
+
* @return string
|
2641 |
+
*/
|
2642 |
+
function settings_licenses_tab( $html, $section_fields ) {
|
2643 |
+
ob_start(); ?>
|
2644 |
+
|
2645 |
+
<div class="wrap-licenses">
|
2646 |
+
<input type="hidden" id="licenses_settings" name="licenses_settings" value="1">
|
2647 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2648 |
+
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
|
2649 |
+
<table class="form-table um-settings-section">
|
2650 |
+
<tbody>
|
2651 |
+
<?php foreach ( $section_fields as $field_data ) {
|
2652 |
+
$option_value = UM()->options()->get( $field_data['id'] );
|
2653 |
+
$value = isset( $option_value ) && ! empty( $option_value ) ? $option_value : ( isset( $field_data['default'] ) ? $field_data['default'] : '' );
|
2654 |
+
|
2655 |
+
$license = get_option( "{$field_data['id']}_edd_answer" );
|
2656 |
+
|
2657 |
+
if ( is_object( $license ) && ! empty( $value ) ) {
|
2658 |
+
// activate_license 'invalid' on anything other than valid, so if there was an error capture it
|
2659 |
+
if ( empty( $license->success ) ) {
|
2660 |
+
|
2661 |
+
if ( ! empty( $license->error ) ) {
|
2662 |
+
switch ( $license->error ) {
|
2663 |
+
|
2664 |
+
case 'expired' :
|
2665 |
+
|
2666 |
+
$class = 'expired';
|
2667 |
+
$messages[] = sprintf(
|
2668 |
+
__( 'Your license key expired on %s. Please <a href="%s" target="_blank">renew your license key</a>.', 'ultimate-member' ),
|
2669 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
2670 |
+
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
|
2671 |
+
);
|
2672 |
+
|
2673 |
+
$license_status = 'license-' . $class . '-notice';
|
2674 |
+
|
2675 |
+
break;
|
2676 |
+
|
2677 |
+
case 'revoked' :
|
2678 |
+
|
2679 |
+
$class = 'error';
|
2680 |
+
$messages[] = sprintf(
|
2681 |
+
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'ultimate-member' ),
|
2682 |
+
'https://ultimatemember.com/support?utm_campaign=admin&utm_source=licenses&utm_medium=revoked'
|
2683 |
+
);
|
2684 |
+
|
2685 |
+
$license_status = 'license-' . $class . '-notice';
|
2686 |
+
|
2687 |
+
break;
|
2688 |
+
|
2689 |
+
case 'missing' :
|
2690 |
+
|
2691 |
+
$class = 'error';
|
2692 |
+
$messages[] = sprintf(
|
2693 |
+
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'ultimate-member' ),
|
2694 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
|
2695 |
+
);
|
2696 |
+
|
2697 |
+
$license_status = 'license-' . $class . '-notice';
|
2698 |
+
|
2699 |
+
break;
|
2700 |
+
|
2701 |
+
case 'invalid' :
|
2702 |
+
case 'site_inactive' :
|
2703 |
+
|
2704 |
+
$class = 'error';
|
2705 |
+
$messages[] = sprintf(
|
2706 |
+
__( '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' ),
|
2707 |
+
$field_data['item_name'],
|
2708 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
|
2709 |
+
);
|
2710 |
+
|
2711 |
+
$license_status = 'license-' . $class . '-notice';
|
2712 |
+
|
2713 |
+
break;
|
2714 |
+
|
2715 |
+
case 'item_name_mismatch' :
|
2716 |
+
|
2717 |
+
$class = 'error';
|
2718 |
+
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'ultimate-member' ), $field_data['item_name'] );
|
2719 |
+
|
2720 |
+
$license_status = 'license-' . $class . '-notice';
|
2721 |
+
|
2722 |
+
break;
|
2723 |
+
|
2724 |
+
case 'no_activations_left':
|
2725 |
+
|
2726 |
+
$class = 'error';
|
2727 |
+
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'ultimate-member' ), 'https://ultimatemember.com/account' );
|
2728 |
+
|
2729 |
+
$license_status = 'license-' . $class . '-notice';
|
2730 |
+
|
2731 |
+
break;
|
2732 |
+
|
2733 |
+
case 'license_not_activable':
|
2734 |
+
|
2735 |
+
$class = 'error';
|
2736 |
+
$messages[] = __( 'The key you entered belongs to a bundle, please use the product specific license key.', 'ultimate-member' );
|
2737 |
+
|
2738 |
+
$license_status = 'license-' . $class . '-notice';
|
2739 |
+
break;
|
2740 |
+
|
2741 |
+
default :
|
2742 |
+
|
2743 |
+
$class = 'error';
|
2744 |
+
$error = ! empty( $license->error ) ? $license->error : __( 'unknown_error', 'ultimate-member' );
|
2745 |
+
$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' );
|
2746 |
+
|
2747 |
+
$license_status = 'license-' . $class . '-notice';
|
2748 |
+
break;
|
2749 |
+
}
|
2750 |
+
} else {
|
2751 |
+
$class = 'error';
|
2752 |
+
$error = ! empty( $license->error ) ? $license->error : __( 'unknown_error', 'ultimate-member' );
|
2753 |
+
$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' );
|
2754 |
+
|
2755 |
+
$license_status = 'license-' . $class . '-notice';
|
2756 |
+
}
|
2757 |
+
|
2758 |
+
} elseif ( ! empty( $license->errors ) ) {
|
2759 |
+
|
2760 |
+
$errors = array_keys( $license->errors );
|
2761 |
+
$errors_data = array_values( $license->errors );
|
2762 |
+
|
2763 |
+
$class = 'error';
|
2764 |
+
$error = ! empty( $errors[0] ) ? $errors[0] : __( 'unknown_error', 'ultimate-member' );
|
2765 |
+
$errors_data = ! empty( $errors_data[0][0] ) ? ', ' . $errors_data[0][0] : '';
|
2766 |
+
$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' );
|
2767 |
+
|
2768 |
+
$license_status = 'license-' . $class . '-notice';
|
2769 |
+
|
2770 |
+
} else {
|
2771 |
+
|
2772 |
+
switch( $license->license ) {
|
2773 |
+
|
2774 |
+
case 'expired' :
|
2775 |
+
|
2776 |
+
$class = 'expired';
|
2777 |
+
$messages[] = sprintf(
|
2778 |
+
__( 'Your license key expired on %s. Please <a href="%s" target="_blank">renew your license key</a>.', 'ultimate-member' ),
|
2779 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
2780 |
+
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
|
2781 |
+
);
|
2782 |
+
|
2783 |
+
$license_status = 'license-' . $class . '-notice';
|
2784 |
+
|
2785 |
+
break;
|
2786 |
+
|
2787 |
+
case 'revoked' :
|
2788 |
+
|
2789 |
+
$class = 'error';
|
2790 |
+
$messages[] = sprintf(
|
2791 |
+
__( 'Your license key has been disabled. Please <a href="%s" target="_blank">contact support</a> for more information.', 'ultimate-member' ),
|
2792 |
+
'https://ultimatemember.com/support?utm_campaign=admin&utm_source=licenses&utm_medium=revoked'
|
2793 |
+
);
|
2794 |
+
|
2795 |
+
$license_status = 'license-' . $class . '-notice';
|
2796 |
+
|
2797 |
+
break;
|
2798 |
+
|
2799 |
+
case 'missing' :
|
2800 |
+
|
2801 |
+
$class = 'error';
|
2802 |
+
$messages[] = sprintf(
|
2803 |
+
__( 'Invalid license. Please <a href="%s" target="_blank">visit your account page</a> and verify it.', 'ultimate-member' ),
|
2804 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
|
2805 |
+
);
|
2806 |
+
|
2807 |
+
$license_status = 'license-' . $class . '-notice';
|
2808 |
+
|
2809 |
+
break;
|
2810 |
+
|
2811 |
+
case 'invalid' :
|
2812 |
+
case 'site_inactive' :
|
2813 |
+
|
2814 |
+
$class = 'error';
|
2815 |
+
$messages[] = sprintf(
|
2816 |
+
__( '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' ),
|
2817 |
+
$field_data['item_name'],
|
2818 |
+
'https://ultimatemember.com/account?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
|
2819 |
+
);
|
2820 |
+
|
2821 |
+
$license_status = 'license-' . $class . '-notice';
|
2822 |
+
|
2823 |
+
break;
|
2824 |
+
|
2825 |
+
case 'item_name_mismatch' :
|
2826 |
+
|
2827 |
+
$class = 'error';
|
2828 |
+
$messages[] = sprintf( __( 'This appears to be an invalid license key for %s.', 'ultimate-member' ), $field_data['item_name'] );
|
2829 |
+
|
2830 |
+
$license_status = 'license-' . $class . '-notice';
|
2831 |
+
|
2832 |
+
break;
|
2833 |
+
|
2834 |
+
case 'no_activations_left':
|
2835 |
+
|
2836 |
+
$class = 'error';
|
2837 |
+
$messages[] = sprintf( __( 'Your license key has reached its activation limit. <a href="%s">View possible upgrades</a> now.', 'ultimate-member' ), 'https://ultimatemember.com/account' );
|
2838 |
+
|
2839 |
+
$license_status = 'license-' . $class . '-notice';
|
2840 |
+
|
2841 |
+
break;
|
2842 |
+
|
2843 |
+
case 'license_not_activable':
|
2844 |
+
|
2845 |
+
$class = 'error';
|
2846 |
+
$messages[] = __( 'The key you entered belongs to a bundle, please use the product specific license key.', 'ultimate-member' );
|
2847 |
+
|
2848 |
+
$license_status = 'license-' . $class . '-notice';
|
2849 |
+
break;
|
2850 |
+
|
2851 |
+
case 'valid' :
|
2852 |
+
default:
|
2853 |
+
|
2854 |
+
$class = 'valid';
|
2855 |
+
|
2856 |
+
$now = current_time( 'timestamp' );
|
2857 |
+
$expiration = strtotime( $license->expires, $now );
|
2858 |
+
|
2859 |
+
if( 'lifetime' === $license->expires ) {
|
2860 |
+
|
2861 |
+
$messages[] = __( 'License key never expires.', 'ultimate-member' );
|
2862 |
+
|
2863 |
+
$license_status = 'license-lifetime-notice';
|
2864 |
+
|
2865 |
+
} elseif( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
|
2866 |
+
|
2867 |
+
$messages[] = sprintf(
|
2868 |
+
__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank">Renew your license key</a>.', 'ultimate-member' ),
|
2869 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
|
2870 |
+
'https://ultimatemember.com/checkout/?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
|
2871 |
+
);
|
2872 |
+
|
2873 |
+
$license_status = 'license-expires-soon-notice';
|
2874 |
+
|
2875 |
+
} else {
|
2876 |
+
|
2877 |
+
$messages[] = sprintf(
|
2878 |
+
__( 'Your license key expires on %s.', 'ultimate-member' ),
|
2879 |
+
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
|
2880 |
+
);
|
2881 |
+
|
2882 |
+
$license_status = 'license-expiration-date-notice';
|
2883 |
+
|
2884 |
+
}
|
2885 |
+
|
2886 |
+
break;
|
2887 |
+
|
2888 |
+
}
|
2889 |
+
|
2890 |
+
}
|
2891 |
+
|
2892 |
+
} else {
|
2893 |
+
$class = 'empty';
|
2894 |
+
|
2895 |
+
$messages[] = sprintf(
|
2896 |
+
__( 'To receive updates, please enter your valid %s license key.', 'ultimate-member' ),
|
2897 |
+
$field_data['item_name']
|
2898 |
+
);
|
2899 |
+
|
2900 |
+
$license_status = null;
|
2901 |
+
|
2902 |
+
} ?>
|
2903 |
+
|
2904 |
+
<tr class="um-settings-line">
|
2905 |
+
<th><label for="um_options_<?php echo esc_attr( $field_data['id'] ) ?>"><?php echo esc_html( $field_data['label'] ) ?></label></th>
|
2906 |
+
<td>
|
2907 |
+
<form method="post" action="" name="um-settings-form" class="um-settings-form">
|
2908 |
+
<input type="hidden" value="save" name="um-settings-action" />
|
2909 |
+
<input type="hidden" name="licenses_settings" value="1" />
|
2910 |
+
<?php $um_settings_nonce = wp_create_nonce( 'um-settings-nonce' ); ?>
|
2911 |
+
<input type="hidden" name="__umnonce" value="<?php echo esc_attr( $um_settings_nonce ); ?>" />
|
2912 |
+
<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'] ) ?>" />
|
2913 |
+
<?php if ( ! empty( $field_data['description'] ) ) { ?>
|
2914 |
+
<div class="description"><?php echo $field_data['description'] ?></div>
|
2915 |
+
<?php } ?>
|
2916 |
+
|
2917 |
+
<?php if ( ! empty( $value ) && ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license ) ) { ?>
|
2918 |
+
<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' ) ?>"/>
|
2919 |
+
<?php } elseif ( empty( $value ) ) { ?>
|
2920 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Activate', 'ultimate-member' ) ?>" />
|
2921 |
+
<?php } else { ?>
|
2922 |
+
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Re-Activate', 'ultimate-member' ) ?>" />
|
2923 |
+
<?php }
|
2924 |
+
|
2925 |
+
if ( ! empty( $messages ) ) {
|
2926 |
+
foreach ( $messages as $message ) { ?>
|
2927 |
+
<div class="edd-license-data edd-license-<?php echo esc_attr( $class . ' ' . $license_status ) ?>">
|
2928 |
+
<p><?php echo $message ?></p>
|
2929 |
+
</div>
|
2930 |
+
<?php }
|
2931 |
+
} ?>
|
2932 |
+
</form>
|
2933 |
+
</td>
|
2934 |
+
</tr>
|
2935 |
+
<?php } ?>
|
2936 |
+
</tbody>
|
2937 |
+
</table>
|
2938 |
+
</div>
|
2939 |
+
<?php $section = ob_get_clean();
|
2940 |
+
|
2941 |
+
return $section;
|
2942 |
+
}
|
2943 |
+
|
2944 |
+
|
2945 |
+
/**
|
2946 |
+
* @param $html
|
2947 |
+
* @param $section_fields
|
2948 |
+
*/
|
2949 |
+
function settings_install_info_tab( $html, $section_fields ) {
|
2950 |
+
global $wpdb;
|
2951 |
+
|
2952 |
+
if ( ! class_exists( '\Browser' ) )
|
2953 |
+
require_once um_path . 'includes/lib/browser.php';
|
2954 |
+
|
2955 |
+
// Detect browser
|
2956 |
+
$browser = new \Browser();
|
2957 |
+
|
2958 |
+
// Get theme info
|
2959 |
+
$theme_data = wp_get_theme();
|
2960 |
+
$theme = $theme_data->Name . ' ' . $theme_data->Version;
|
2961 |
+
|
2962 |
+
// Identify Hosting Provider
|
2963 |
+
$host = um_get_host();
|
2964 |
+
|
2965 |
+
um_fetch_user( get_current_user_id() );
|
2966 |
+
|
2967 |
+
if ( isset( $this->content ) ) {
|
2968 |
+
echo $this->content;
|
2969 |
+
} else { ?>
|
2970 |
+
|
2971 |
+
<h3>Install Info</h3>
|
2972 |
+
|
2973 |
+
<form action="" method="post" dir="ltr">
|
2974 |
+
<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' ); ?>">
|
2975 |
+
### Begin Install Info ###
|
2976 |
+
|
2977 |
+
## Please include this information when posting support requests ##
|
2978 |
+
|
2979 |
+
<?php
|
2980 |
+
/**
|
2981 |
+
* UM hook
|
2982 |
+
*
|
2983 |
+
* @type action
|
2984 |
+
* @title um_install_info_before
|
2985 |
+
* @description Before install info settings
|
2986 |
+
* @change_log
|
2987 |
+
* ["Since: 2.0"]
|
2988 |
+
* @usage add_action( 'um_install_info_before', 'function_name', 10 );
|
2989 |
+
* @example
|
2990 |
+
* <?php
|
2991 |
+
* add_action( 'um_install_info_before', 'my_install_info_before', 10 );
|
2992 |
+
* function my_install_info_before() {
|
2993 |
+
* // your code here
|
2994 |
+
* }
|
2995 |
+
* ?>
|
2996 |
+
*/
|
2997 |
+
do_action( 'um_install_info_before' ); ?>
|
2998 |
+
|
2999 |
+
--- Site Info ---
|
3000 |
+
|
3001 |
+
Site URL: <?php echo site_url() . "\n"; ?>
|
3002 |
+
Home URL: <?php echo home_url() . "\n"; ?>
|
3003 |
+
Multisite: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
|
3004 |
+
|
3005 |
+
--- Hosting Provider ---
|
3006 |
+
|
3007 |
+
<?php if( $host ) : ?>
|
3008 |
+
Host: <?php echo $host . "\n"; ?>
|
3009 |
+
<?php endif; ?>
|
3010 |
+
|
3011 |
+
--- User Browser ---
|
3012 |
+
|
3013 |
+
<?php echo $browser ; ?>
|
3014 |
+
|
3015 |
+
---- Current User Details --
|
3016 |
+
|
3017 |
+
<?php $user = wp_get_current_user(); ?>
|
3018 |
+
Role: <?php echo implode( ', ', um_user( 'roles' ) ). "\n"; ?>
|
3019 |
+
|
3020 |
+
|
3021 |
+
--- WordPress Configurations ---
|
3022 |
+
|
3023 |
+
Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
|
3024 |
+
Language: <?php echo get_locale()."\n"; ?>
|
3025 |
+
Permalink Structure: <?php echo get_option( 'permalink_structure' ) . "\n"; ?>
|
3026 |
+
Active Theme: <?php echo $theme . "\n"; ?>
|
3027 |
+
<?php $show_on_front = get_option( 'show_on_front' ); ?>
|
3028 |
+
<?php if( $show_on_front == "posts" ): ?>
|
3029 |
+
Show On Front: <?php echo get_option( 'show_on_front' ) . "/static\n" ?>
|
3030 |
+
<?php elseif( $show_on_front == "page" ): ?>
|
3031 |
+
Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
|
3032 |
+
Page For Posts: <?php $id = get_option( 'page_for_posts' ); echo get_the_title( $id ) . ' (#' . $id . ')' . "\n" ?>
|
3033 |
+
<?php endif; ?>
|
3034 |
+
ABSPATH: <?php echo ABSPATH."\n"; ?>
|
3035 |
+
<?php $wp_count_posts = wp_count_posts(); ?>
|
3036 |
+
All Posts/Pages: <?php echo array_sum((array)$wp_count_posts)."\n";?>
|
3037 |
+
<?php
|
3038 |
+
$request['cmd'] = '_notify-validate';
|
3039 |
+
|
3040 |
+
$params = array(
|
3041 |
+
'sslverify' => false,
|
3042 |
+
'timeout' => 60,
|
3043 |
+
'user-agent' => 'UltimateMember/' . ultimatemember_version,
|
3044 |
+
'body' => $request
|
3045 |
+
);
|
3046 |
+
|
3047 |
+
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params );
|
3048 |
+
|
3049 |
+
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
|
3050 |
+
$WP_REMOTE_POST = 'wp_remote_post() works' . "\n";
|
3051 |
+
} else {
|
3052 |
+
$WP_REMOTE_POST = 'wp_remote_post() does not work' . "\n";
|
3053 |
+
}
|
3054 |
+
?>
|
3055 |
+
WP Remote Post: <?php echo $WP_REMOTE_POST; ?>
|
3056 |
+
WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
|
3057 |
+
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"; ?>
|
3058 |
+
Memory Limit: <?php echo ( um_let_to_num( WP_MEMORY_LIMIT )/( 1024 ) )."MB"; ?><?php echo "\n"; ?>
|
3059 |
+
|
3060 |
+
|
3061 |
+
--- UM Configurations ---
|
3062 |
+
|
3063 |
+
Version: <?php echo ultimatemember_version . "\n"; ?>
|
3064 |
+
Upgraded From: <?php echo get_option( 'um_last_version_upgrade', 'None' ) . "\n"; ?>
|
3065 |
+
Current URL Method: <?php echo UM()->options()->get( 'current_url_method' ). "\n"; ?>
|
3066 |
+
Cache User Profile: <?php if( UM()->options()->get( 'um_profile_object_cache_stop' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
3067 |
+
Generate Slugs on Directories: <?php if( UM()->options()->get( 'um_generate_slug_in_directory' ) == 1 ){ echo "No"; }else{ echo "Yes"; } echo "\n"; ?>
|
3068 |
+
Force UTF-8 Encoding: <?php if( UM()->options()->get( 'um_force_utf8_strings' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3069 |
+
JS/CSS Compression: <?php if ( defined('SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3070 |
+
<?php if( is_multisite() ): ?>
|
3071 |
+
Network Structure: <?php echo UM()->options()->get( 'network_permalink_structure' ). "\n"; ?>
|
3072 |
+
<?php endif; ?>
|
3073 |
+
Port Forwarding in URL: <?php if( UM()->options()->get( 'um_port_forwarding_url' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3074 |
+
Exclude CSS/JS on Home: <?php if( UM()->options()->get( 'js_css_exlcude_home' ) == 1 ){ echo "Yes"; }else{ echo "No"; } echo "\n"; ?>
|
3075 |
+
|
3076 |
+
|
3077 |
+
--- UM Pages Configuration ---
|
3078 |
+
|
3079 |
+
<?php
|
3080 |
+
/**
|
3081 |
+
* UM hook
|
3082 |
+
*
|
3083 |
+
* @type action
|
3084 |
+
* @title um_install_info_before_page_config
|
3085 |
+
* @description Before page config install info
|
3086 |
+
* @change_log
|
3087 |
+
* ["Since: 2.0"]
|
3088 |
+
* @usage add_action( 'um_install_info_before_page_config', 'function_name', 10 );
|
3089 |
+
* @example
|
3090 |
+
* <?php
|
3091 |
+
* add_action( 'um_install_info_before_page_config', 'my_install_info_before_page_config', 10 );
|
3092 |
+
* function my_install_info_before_page_config() {
|
3093 |
+
* // your code here
|
3094 |
+
* }
|
3095 |
+
* ?>
|
3096 |
+
*/
|
3097 |
+
do_action( "um_install_info_before_page_config" ); ?>
|
3098 |
+
User: <?php echo get_permalink( UM()->options()->get('core_user') ) . "\n"; ?>
|
3099 |
+
Account: <?php echo get_permalink( UM()->options()->get('core_account') ) . "\n"; ?>
|
3100 |
+
Members: <?php echo get_permalink( UM()->options()->get('core_members') ) . "\n"; ?>
|
3101 |
+
Register: <?php echo get_permalink( UM()->options()->get('core_register') ) . "\n"; ?>
|
3102 |
+
Login: <?php echo get_permalink( UM()->options()->get('core_login') ) . "\n"; ?>
|
3103 |
+
Logout: <?php echo get_permalink( UM()->options()->get('core_logout') ) . "\n"; ?>
|
3104 |
+
Password Reset: <?php echo get_permalink( UM()->options()->get('core_password-reset') ) . "\n"; ?>
|
3105 |
+
<?php
|
3106 |
+
/**
|
3107 |
+
* UM hook
|
3108 |
+
*
|
3109 |
+
* @type action
|
3110 |
+
* @title um_install_info_after_page_config
|
3111 |
+
* @description After page config install info
|
3112 |
+
* @change_log
|
3113 |
+
* ["Since: 2.0"]
|
3114 |
+
* @usage add_action( 'um_install_info_after_page_config', 'function_name', 10 );
|
3115 |
+
* @example
|
3116 |
+
* <?php
|
3117 |
+
* add_action( 'um_install_info_after_page_config', 'my_install_info_after_page_config', 10 );
|
3118 |
+
* function my_install_info_after_page_config() {
|
3119 |
+
* // your code here
|
3120 |
+
* }
|
3121 |
+
* ?>
|
3122 |
+
*/
|
3123 |
+
do_action( "um_install_info_after_page_config" ); ?>
|
3124 |
+
|
3125 |
+
|
3126 |
+
--- UM Users Configuration ---
|
3127 |
+
|
3128 |
+
Default New User Role: <?php echo UM()->options()->get('register_role') . "\n"; ?>
|
3129 |
+
Profile Permalink Base: <?php echo UM()->options()->get('permalink_base') . "\n"; ?>
|
3130 |
+
User Display Name: <?php echo UM()->options()->get('display_name') . "\n"; ?>
|
3131 |
+
Force Name to Uppercase: <?php echo $this->info_value( UM()->options()->get('force_display_name_capitlized'), 'yesno', true ); ?>
|
3132 |
+
Redirect author to profile: <?php echo $this->info_value( UM()->options()->get('author_redirect'), 'yesno', true ); ?>
|
3133 |
+
Enable Members Directory: <?php echo $this->info_value( UM()->options()->get('members_page'), 'yesno', true ); ?>
|
3134 |
+
Use Gravatars: <?php echo $this->info_value( UM()->options()->get('use_gravatars'), 'yesno', true ); ?>
|
3135 |
+
<?php if( UM()->options()->get('use_gravatars') ): ?>Gravatar builtin image: <?php echo UM()->options()->get('use_um_gravatar_default_builtin_image') . "\n"; ?>
|
3136 |
+
UM Avatar as blank Gravatar: <?php echo $this->info_value( UM()->options()->get('use_um_gravatar_default_image'), 'yesno', true ); ?><?php endif; ?>
|
3137 |
+
Require a strong password: <?php echo $this->info_value( UM()->options()->get('reset_require_strongpass'), 'onoff', true ); ?>
|
3138 |
+
|
3139 |
+
|
3140 |
+
--- UM Access Configuration ---
|
3141 |
+
|
3142 |
+
Panic Key: <?php echo UM()->options()->get('panic_key') . "\n"; ?>
|
3143 |
+
Global Site Access: <?php $arr = array('Site accessible to Everyone','','Site accessible to Logged In Users'); echo $arr[ (int) UM()->options()->get('accessible') ] . "\n"; ?>
|
3144 |
+
<?php if( UM()->options()->get('accessible') == 2 ) { ?>
|
3145 |
+
Custom Redirect URL: <?php echo UM()->options()->get('access_redirect')."\n";?>
|
3146 |
+
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";?>
|
3147 |
+
<?php } ?>
|
3148 |
+
Backend Login Screen for Guests: <?php echo $this->info_value( UM()->options()->get('wpadmin_login'), 'yesno', true ); ?>
|
3149 |
+
<?php if( ! UM()->options()->get('wpadmin_login') ) { ?>
|
3150 |
+
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"; }?>
|
3151 |
+
<?php } ?>
|
3152 |
+
Backend Register Screen for Guests: <?php echo $this->info_value( UM()->options()->get('wpadmin_register'), 'yesno', true ); ?>
|
3153 |
+
<?php if( ! UM()->options()->get('wpadmin_register') ) { ?>
|
3154 |
+
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"; }?>
|
3155 |
+
<?php } ?>
|
3156 |
+
Access Control widget for Admins only: <?php echo $this->info_value( UM()->options()->get('access_widget_admin_only'), 'yesno', true ); ?>
|
3157 |
+
Enable the Reset Password Limit: <?php echo $this->info_value( UM()->options()->get('enable_reset_password_limit'), 'yesno', true ); ?>
|
3158 |
+
<?php if( UM()->options()->get('enable_reset_password_limit') ) { ?>
|
3159 |
+
Reset Password Limit: <?php echo UM()->options()->get('reset_password_limit_number') ?>
|
3160 |
+
Disable Reset Password Limit for Admins: <?php echo $this->info_value( UM()->options()->get('disable_admin_reset_password_limit'), 'yesno', true ) ?>
|
3161 |
+
<?php } ?>
|
3162 |
+
<?php $wpadmin_allow_ips = UM()->options()->get( 'wpadmin_allow_ips' ); if( ! empty( $wpadmin_allow_ips ) ) { ?>
|
3163 |
+
Whitelisted Backend IPs: <?php echo count( explode("\n",trim(UM()->options()->get('wpadmin_allow_ips') ) ) )."\n"; ?>
|
3164 |
+
<?php } ?>
|
3165 |
+
<?php $blocked_ips = UM()->options()->get('blocked_ips'); if( ! empty( $blocked_ips ) ){ ?>
|
3166 |
+
Blocked IP Addresses: <?php echo count( explode("\n",UM()->options()->get('blocked_ips') ) )."\n"; ?>
|
3167 |
+
<?php } ?>
|
3168 |
+
<?php $blocked_emails = UM()->options()->get('blocked_emails'); if( ! empty( $blocked_emails ) ){ ?>
|
3169 |
+
Blocked Email Addresses: <?php echo count( explode("\n",UM()->options()->get('blocked_emails') ) )."\n"; ?>
|
3170 |
+
<?php } ?>
|
3171 |
+
<?php $blocked_words = UM()->options()->get('blocked_words'); if( ! empty( $blocked_words ) ){ ?>
|
3172 |
+
Blacklist Words: <?php echo count( explode("\n",UM()->options()->get('blocked_words') ) )."\n"; ?>
|
3173 |
+
<?php } ?>
|
3174 |
+
|
3175 |
+
|
3176 |
+
--- UM Email Configurations ---
|
3177 |
+
|
3178 |
+
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";?>
|
3179 |
+
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";?>
|
3180 |
+
Use HTML for E-mails: <?php echo $this->info_value( UM()->options()->get('email_html'), 'yesno', true ); ?>
|
3181 |
+
Account Welcome Email: <?php echo $this->info_value( UM()->options()->get('welcome_email_on'), 'yesno', true ); ?>
|
3182 |
+
Account Activation Email: <?php echo $this->info_value( UM()->options()->get('checkmail_email_on'), 'yesno', true ); ?>
|
3183 |
+
Pending Review Email: <?php echo $this->info_value( UM()->options()->get('pending_email_on'), 'yesno', true ); ?>
|
3184 |
+
Account Approved Email: <?php echo $this->info_value( UM()->options()->get('approved_email_on'), 'yesno', true ); ?>
|
3185 |
+
Account Rejected Email: <?php echo $this->info_value( UM()->options()->get('rejected_email_on'), 'yesno', true ); ?>
|
3186 |
+
Account Deactivated Email: <?php echo $this->info_value( UM()->options()->get('inactive_email_on'), 'yesno', true ); ?>
|
3187 |
+
Account Deleted Email: <?php echo $this->info_value( UM()->options()->get('deletion_email_on'), 'yesno', true ); ?>
|
3188 |
+
Password Reset Email: <?php echo $this->info_value( UM()->options()->get('resetpw_email_on'), 'yesno', true ); ?>
|
3189 |
+
Password Changed Email: <?php echo $this->info_value( UM()->options()->get('changedpw_email_on'), 'yesno', true ); ?>
|
3190 |
+
|
3191 |
+
|
3192 |
+
--- UM Total Users ---
|
3193 |
+
|
3194 |
+
<?php $result = count_users();
|
3195 |
+
echo 'All Users('.$result['total_users'].")\n";
|
3196 |
+
foreach( $result['avail_roles'] as $role => $count ) {
|
3197 |
+
echo $role."(".$count.")\n";
|
3198 |
+
} ?>
|
3199 |
+
|
3200 |
+
|
3201 |
+
--- UM Roles ---
|
3202 |
+
|
3203 |
+
<?php foreach( UM()->roles()->get_roles() as $role_id => $role ) {
|
3204 |
+
echo $role." ({$role_id})\n";
|
3205 |
+
} ?>
|
3206 |
+
|
3207 |
+
|
3208 |
+
--- UM Custom Templates ---
|
3209 |
+
|
3210 |
+
<?php // Show templates that have been copied to the theme's edd_templates dir
|
3211 |
+
$dir = get_stylesheet_directory() . '/ultimate-member/templates/*.php';
|
3212 |
+
if ( ! empty( $dir ) ) {
|
3213 |
+
$found = glob( $dir );
|
3214 |
+
if ( ! empty( $found ) ) {
|
3215 |
+
foreach ( glob( $dir ) as $file ) {
|
3216 |
+
echo "File: " . $file . "\n";
|
3217 |
+
}
|
3218 |
+
} else {
|
3219 |
+
echo 'N/A'."\n";
|
3220 |
+
}
|
3221 |
+
} ?>
|
3222 |
+
|
3223 |
+
|
3224 |
+
--- UM Email HTML Templates ---
|
3225 |
+
|
3226 |
+
<?php $dir = get_stylesheet_directory() . '/ultimate-member/templates/emails/*.html';
|
3227 |
+
|
3228 |
+
if ( ! empty( $dir ) ) {
|
3229 |
+
$found = glob( $dir );
|
3230 |
+
if ( ! empty( $found ) ){
|
3231 |
+
foreach ( glob( $dir ) as $file ) {
|
3232 |
+
echo "File: ". $file . "\n";
|
3233 |
+
}
|
3234 |
+
} else {
|
3235 |
+
echo 'N/A'."\n";
|
3236 |
+
}
|
3237 |
+
} ?>
|
3238 |
+
|
3239 |
+
|
3240 |
+
--- Web Server Configurations ---
|
3241 |
+
|
3242 |
+
PHP Version: <?php echo PHP_VERSION . "\n"; ?>
|
3243 |
+
MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?>
|
3244 |
+
Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
|
3245 |
+
|
3246 |
+
|
3247 |
+
--- PHP Configurations ---
|
3248 |
+
|
3249 |
+
PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
|
3250 |
+
PHP Upload Max Size: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
|
3251 |
+
PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
|
3252 |
+
PHP Upload Max Filesize: <?php echo ini_get( 'upload_max_filesize' ) . "\n"; ?>
|
3253 |
+
PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
|
3254 |
+
PHP Max Input Vars: <?php echo ini_get( 'max_input_vars' ) . "\n"; ?>
|
3255 |
+
PHP Arg Separator: <?php echo ini_get( 'arg_separator.output' ) . "\n"; ?>
|
3256 |
+
PHP Allow URL File Open: <?php echo ini_get( 'allow_url_fopen' ) ? "Yes\n" : "No\n"; ?>
|
3257 |
+
|
3258 |
+
|
3259 |
+
--- Web Server Extensions/Modules ---
|
3260 |
+
|
3261 |
+
DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
|
3262 |
+
FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? 'Your server supports fsockopen.' : 'Your server does not support fsockopen.'; ?><?php echo "\n"; ?>
|
3263 |
+
cURL: <?php echo ( function_exists( 'curl_init' ) ) ? 'Your server supports cURL.' : 'Your server does not support cURL.'; ?><?php echo "\n"; ?>
|
3264 |
+
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"; ?>
|
3265 |
+
SUHOSIN: <?php echo ( extension_loaded( 'suhosin' ) ) ? 'Your server has SUHOSIN installed.' : 'Your server does not have SUHOSIN installed.'; ?><?php echo "\n"; ?>
|
3266 |
+
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"; ?>
|
3267 |
+
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"; ?>
|
3268 |
+
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"; ?>
|
3269 |
+
|
3270 |
+
|
3271 |
+
--- Session Configurations ---
|
3272 |
+
|
3273 |
+
Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
|
3274 |
+
Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
|
3275 |
+
Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
|
3276 |
+
Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
|
3277 |
+
Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
3278 |
+
Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
|
3279 |
+
|
3280 |
+
|
3281 |
+
--- WordPress Active Plugins ---
|
3282 |
+
|
3283 |
+
<?php $plugins = get_plugins();
|
3284 |
+
$active_plugins = get_option( 'active_plugins', array() );
|
3285 |
+
|
3286 |
+
foreach ( $plugins as $plugin_path => $plugin ) {
|
3287 |
+
// If the plugin isn't active, don't show it.
|
3288 |
+
if ( ! in_array( $plugin_path, $active_plugins ) )
|
3289 |
+
continue;
|
3290 |
+
|
3291 |
+
echo $plugin['Name'] . ': ' . $plugin['Version'] ."\n";
|
3292 |
+
}
|
3293 |
+
|
3294 |
+
if ( is_multisite() ) { ?>
|
3295 |
+
|
3296 |
+
--- WordPress Network Active Plugins ---
|
3297 |
+
|
3298 |
+
<?php $plugins = wp_get_active_network_plugins();
|
3299 |
+
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
|
3300 |
+
|
3301 |
+
foreach ( $plugins as $plugin_path ) {
|
3302 |
+
$plugin_base = plugin_basename( $plugin_path );
|
3303 |
+
|
3304 |
+
// If the plugin isn't active, don't show it.
|
3305 |
+
if ( ! array_key_exists( $plugin_base, $active_plugins ) )
|
3306 |
+
continue;
|
3307 |
+
|
3308 |
+
$plugin = get_plugin_data( $plugin_path );
|
3309 |
+
|
3310 |
+
echo $plugin['Name'] . ' :' . $plugin['Version'] . "\n";
|
3311 |
+
}
|
3312 |
+
|
3313 |
+
}
|
3314 |
+
|
3315 |
+
/**
|
3316 |
+
* UM hook
|
3317 |
+
*
|
3318 |
+
* @type action
|
3319 |
+
* @title um_install_info_after
|
3320 |
+
* @description After install info
|
3321 |
+
* @change_log
|
3322 |
+
* ["Since: 2.0"]
|
3323 |
+
* @usage add_action( 'um_install_info_after', 'function_name', 10 );
|
3324 |
+
* @example
|
3325 |
+
* <?php
|
3326 |
+
* add_action( 'um_install_info_after', 'my_install_info_after', 10 );
|
3327 |
+
* function my_install_info_after() {
|
3328 |
+
* // your code here
|
3329 |
+
* }
|
3330 |
+
* ?>
|
3331 |
+
*/
|
3332 |
+
do_action( 'um_install_info_after' ); ?>
|
3333 |
+
|
3334 |
+
### End Install Info ###
|
3335 |
+
</textarea>
|
3336 |
+
<p class="submit">
|
3337 |
+
<input type="hidden" name="um-addon-hook" value="download_install_info" />
|
3338 |
+
<?php submit_button( 'Download Install Info File', 'primary', 'download_install_info', false ); ?>
|
3339 |
+
</p>
|
3340 |
+
</form>
|
3341 |
+
|
3342 |
+
<?php }
|
3343 |
+
}
|
3344 |
+
|
3345 |
+
|
3346 |
+
/**
|
3347 |
+
*
|
3348 |
+
*/
|
3349 |
+
function um_download_install_info() {
|
3350 |
+
if ( ! empty( $_POST['download_install_info'] ) ) {
|
3351 |
+
nocache_headers();
|
3352 |
+
|
3353 |
+
header( "Content-type: text/plain" );
|
3354 |
+
header( 'Content-Disposition: attachment; filename="ultimatemember-install-info.txt"' );
|
3355 |
+
|
3356 |
+
echo wp_strip_all_tags( sanitize_textarea_field( $_POST['um-install-info'] ) );
|
3357 |
+
exit;
|
3358 |
+
}
|
3359 |
+
}
|
3360 |
+
|
3361 |
+
|
3362 |
+
/**
|
3363 |
+
* @param string $raw_value
|
3364 |
+
* @param string $type
|
3365 |
+
* @param string $default
|
3366 |
+
*
|
3367 |
+
* @return string
|
3368 |
+
*/
|
3369 |
+
function info_value( $raw_value = '', $type = 'yesno', $default = '' ) {
|
3370 |
+
|
3371 |
+
if ( $type == 'yesno' ) {
|
3372 |
+
$raw_value = ( $default == $raw_value ) ? "Yes" : "No";
|
3373 |
+
} elseif( $type == 'onoff' ) {
|
3374 |
+
$raw_value = ( $default == $raw_value ) ? "On" : "Off";
|
3375 |
+
}
|
3376 |
+
|
3377 |
+
return $raw_value."\n";
|
3378 |
+
}
|
3379 |
+
|
3380 |
+
|
3381 |
+
/**
|
3382 |
+
* Render settings section
|
3383 |
+
*
|
3384 |
+
* @param array $section_fields
|
3385 |
+
* @param string $current_tab
|
3386 |
+
* @param string $current_subtab
|
3387 |
+
*
|
3388 |
+
* @return string
|
3389 |
+
*/
|
3390 |
+
function render_settings_section( $section_fields, $current_tab, $current_subtab ) {
|
3391 |
+
ob_start();
|
3392 |
+
|
3393 |
+
UM()->admin_forms_settings( array(
|
3394 |
+
'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column',
|
3395 |
+
'prefix_id' => 'um_options',
|
3396 |
+
'fields' => $section_fields
|
3397 |
+
) )->render_form(); ?>
|
3398 |
+
|
3399 |
+
<?php $section = ob_get_clean();
|
3400 |
+
|
3401 |
+
return $section;
|
3402 |
+
}
|
3403 |
+
|
3404 |
+
|
3405 |
+
/**
|
3406 |
+
* @param array $settings
|
3407 |
+
*
|
3408 |
+
* @return array
|
3409 |
+
*/
|
3410 |
+
function save_email_templates( $settings ) {
|
3411 |
+
|
3412 |
+
if ( empty( $settings['um_email_template'] ) ) {
|
3413 |
+
return $settings;
|
3414 |
+
}
|
3415 |
+
|
3416 |
+
$template = $settings['um_email_template'];
|
3417 |
+
$content = wp_kses_post( stripslashes( $settings[ $template ] ) );
|
3418 |
+
|
3419 |
+
$theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
|
3420 |
+
|
3421 |
+
if ( ! file_exists( $theme_template_path ) ) {
|
3422 |
+
UM()->mail()->copy_email_template( $template );
|
3423 |
+
}
|
3424 |
+
|
3425 |
+
$fp = fopen( $theme_template_path, "w" );
|
3426 |
+
$result = fputs( $fp, $content );
|
3427 |
+
fclose( $fp );
|
3428 |
+
|
3429 |
+
if ( $result !== false ) {
|
3430 |
+
unset( $settings['um_email_template'] );
|
3431 |
+
unset( $settings[ $template ] );
|
3432 |
+
}
|
3433 |
+
|
3434 |
+
return $settings;
|
3435 |
+
}
|
3436 |
+
}
|
3437 |
+
}
|
includes/admin/templates/access/restrict_content.php
CHANGED
@@ -1,160 +1,164 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
$data =
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
$post_type_object =
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
*
|
32 |
-
*
|
33 |
-
* @
|
34 |
-
* @
|
35 |
-
*
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
* @
|
40 |
-
*
|
41 |
-
*
|
42 |
-
*
|
43 |
-
*
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
47 |
-
*
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
'
|
54 |
-
'
|
55 |
-
'
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
'
|
61 |
-
'
|
62 |
-
'
|
63 |
-
'
|
64 |
-
|
65 |
-
'
|
66 |
-
'
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
'
|
73 |
-
'
|
74 |
-
'
|
75 |
-
'
|
76 |
-
'
|
77 |
-
'
|
78 |
-
'
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
'
|
83 |
-
'
|
84 |
-
'
|
85 |
-
'
|
86 |
-
'
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
'
|
91 |
-
|
92 |
-
|
93 |
-
'
|
94 |
-
'
|
95 |
-
'
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
'
|
103 |
-
|
104 |
-
|
105 |
-
'
|
106 |
-
'
|
107 |
-
'
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
'
|
115 |
-
'
|
116 |
-
'
|
117 |
-
'
|
118 |
-
'
|
119 |
-
'
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'
|
126 |
-
'
|
127 |
-
'
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
'
|
135 |
-
'
|
136 |
-
'
|
137 |
-
'
|
138 |
-
'
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
//
|
144 |
-
//
|
145 |
-
//
|
146 |
-
// '
|
147 |
-
// '
|
148 |
-
// '
|
149 |
-
// '
|
150 |
-
// '
|
151 |
-
//
|
152 |
-
//
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
?>
|
6 |
+
|
7 |
+
<div class="um-admin-metabox">
|
8 |
+
<?php
|
9 |
+
if ( ! empty( $object->ID ) ) {
|
10 |
+
$data = get_post_meta( $object->ID, 'um_content_restriction', true );
|
11 |
+
} else {
|
12 |
+
$data = array();
|
13 |
+
}
|
14 |
+
|
15 |
+
$_um_access_roles_value = array();
|
16 |
+
if ( ! empty( $data['_um_access_roles'] ) ) {
|
17 |
+
foreach ( $data['_um_access_roles'] as $key => $value ) {
|
18 |
+
if ( $value ) {
|
19 |
+
$_um_access_roles_value[] = $key;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
if ( ! empty( $object->post_type ) ) {
|
25 |
+
$post_type_object = get_post_type_object( $object->post_type );
|
26 |
+
} else {
|
27 |
+
$post_type_object = array();
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* UM hook
|
32 |
+
*
|
33 |
+
* @type filter
|
34 |
+
* @title um_admin_access_settings_fields
|
35 |
+
* @description Extend Admin Access Settings Fields
|
36 |
+
* @input_vars
|
37 |
+
* [{"var":"$fields","type":"array","desc":"Access Settings Fields"},
|
38 |
+
* {"var":"$data","type":"array","desc":"Form Data"}]
|
39 |
+
* @change_log
|
40 |
+
* ["Since: 2.0"]
|
41 |
+
* @usage add_filter( 'um_admin_access_settings_fields', 'function_name', 10, 2 );
|
42 |
+
* @example
|
43 |
+
* <?php
|
44 |
+
* add_filter( 'um_admin_access_settings_fields', 'my_admin_access_settings_fields', 10, 2 );
|
45 |
+
* function my_admin_access_settings_fields( $fields, $data ) {
|
46 |
+
* // your code here
|
47 |
+
* return $fields;
|
48 |
+
* }
|
49 |
+
* ?>
|
50 |
+
*/
|
51 |
+
$fields = apply_filters( 'um_admin_access_settings_fields', array(
|
52 |
+
array(
|
53 |
+
'id' => '_um_custom_access_settings',
|
54 |
+
'type' => 'checkbox',
|
55 |
+
'label' => __( 'Restrict access to this post?', 'ultimate-member' ),
|
56 |
+
'tooltip' => __( 'Activate individual content restriction settings for this post. Then ignore all terms restriction content settings if they exists.', 'ultimate-member' ),
|
57 |
+
'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
|
58 |
+
),
|
59 |
+
array(
|
60 |
+
'id' => '_um_accessible',
|
61 |
+
'type' => 'select',
|
62 |
+
'label' => __( 'Who can access this post?', 'ultimate-member' ),
|
63 |
+
'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : 0,
|
64 |
+
'options' => array(
|
65 |
+
'0' => __( 'Everyone', 'ultimate-member' ),
|
66 |
+
'1' => __( 'Logged out users', 'ultimate-member' ),
|
67 |
+
'2' => __( 'Logged in users', 'ultimate-member' ),
|
68 |
+
),
|
69 |
+
'conditional' => array( '_um_custom_access_settings', '=', '1' ),
|
70 |
+
),
|
71 |
+
array(
|
72 |
+
'id' => '_um_access_roles',
|
73 |
+
'type' => 'multi_checkbox',
|
74 |
+
'label' => __( 'Select which roles can access this post', 'ultimate-member' ),
|
75 |
+
'tooltip' => __( 'Leave empty if you want to display a post for all logged in users', 'ultimate-member' ),
|
76 |
+
'value' => $_um_access_roles_value,
|
77 |
+
'options' => UM()->roles()->get_roles( false ),
|
78 |
+
'columns' => 3,
|
79 |
+
'conditional' => array( '_um_accessible', '=', '2' ),
|
80 |
+
),
|
81 |
+
array(
|
82 |
+
'id' => '_um_access_hide_from_queries',
|
83 |
+
'type' => 'checkbox',
|
84 |
+
'label' => __( 'Would you like to display 404 page when users haven\'t access?', 'ultimate-member' ),
|
85 |
+
'tooltip' => __( 'Recommended to be enabled. Restricted post will be hidden by exclusion from WP Query. The safest and most effective method that hides post and its comments from all requests, RSS feeds, etc. on your site', 'ultimate-member' ),
|
86 |
+
'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
|
87 |
+
'conditional' => array( '_um_accessible', '!=', '0' ),
|
88 |
+
),
|
89 |
+
array(
|
90 |
+
'id' => '_um_noaccess_action',
|
91 |
+
'type' => 'select',
|
92 |
+
'label' => __( 'What happens when users without access try to view the post?', 'ultimate-member' ),
|
93 |
+
'tooltip' => __( 'Action when users without access tries to view the post', 'ultimate-member' ),
|
94 |
+
'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : 0,
|
95 |
+
'options' => array(
|
96 |
+
'0' => __( 'Show access restricted message', 'ultimate-member' ),
|
97 |
+
'1' => __( 'Redirect user', 'ultimate-member' ),
|
98 |
+
),
|
99 |
+
'conditional' => array( '_um_access_hide_from_queries', '=', '0' ),
|
100 |
+
),
|
101 |
+
array(
|
102 |
+
'id' => '_um_restrict_by_custom_message',
|
103 |
+
'type' => 'select',
|
104 |
+
'label' => __( 'Restricted access message type', 'ultimate-member' ),
|
105 |
+
'tooltip' => __( 'Would you like to use the global default message or apply a custom message to this post?', 'ultimate-member' ),
|
106 |
+
'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
|
107 |
+
'options' => array(
|
108 |
+
'0' => __( 'Global default message', 'ultimate-member' ),
|
109 |
+
'1' => __( 'Custom message', 'ultimate-member' ),
|
110 |
+
),
|
111 |
+
'conditional' => array( '_um_noaccess_action', '=', '0' ),
|
112 |
+
),
|
113 |
+
array(
|
114 |
+
'id' => '_um_restrict_custom_message',
|
115 |
+
'type' => 'wp_editor',
|
116 |
+
'label' => __( 'Custom restricted access message', 'ultimate-member' ),
|
117 |
+
'tooltip' => __( 'You may replace global restricted access message here', 'ultimate-member' ),
|
118 |
+
'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
|
119 |
+
'conditional' => array( '_um_restrict_by_custom_message', '=', '1' ),
|
120 |
+
),
|
121 |
+
array(
|
122 |
+
'id' => '_um_access_redirect',
|
123 |
+
'type' => 'select',
|
124 |
+
'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
|
125 |
+
'tooltip' => __( 'Select redirect to page when user hasn\'t access to post', 'ultimate-member' ),
|
126 |
+
'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
|
127 |
+
'options' => array(
|
128 |
+
'0' => __( 'Login page', 'ultimate-member' ),
|
129 |
+
'1' => __( 'Custom URL', 'ultimate-member' ),
|
130 |
+
),
|
131 |
+
'conditional' => array( '_um_noaccess_action', '=', '1' ),
|
132 |
+
),
|
133 |
+
array(
|
134 |
+
'id' => '_um_access_redirect_url',
|
135 |
+
'type' => 'text',
|
136 |
+
'label' => __( 'Redirect URL', 'ultimate-member' ),
|
137 |
+
'tooltip' => __( 'Set full URL where do you want to redirect the user', 'ultimate-member' ),
|
138 |
+
'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
|
139 |
+
'conditional' => array( '_um_access_redirect', '=', '1' ),
|
140 |
+
),
|
141 |
+
), $data, $object, $post_type_object );
|
142 |
+
|
143 |
+
// Hierarchical
|
144 |
+
// if ( $post_type_object->hierarchical ) {
|
145 |
+
// $fields[] = array(
|
146 |
+
// 'id' => '_um_access_hierarchical',
|
147 |
+
// 'type' => 'checkbox',
|
148 |
+
// 'label' => __( 'Hierarchical', 'ultimate-member' ),
|
149 |
+
// 'tooltip' => __( 'Use parent page settings for the child pages that doesn\'t have own restriction settings.', 'ultimate-member' ),
|
150 |
+
// 'value' => empty( $data['_um_access_hierarchical'] ) ? 0 : $data['_um_access_hierarchical'],
|
151 |
+
// 'conditional' => array( '_um_custom_access_settings', '=', '1' )
|
152 |
+
// );
|
153 |
+
// }
|
154 |
+
|
155 |
+
UM()->admin_forms(
|
156 |
+
array(
|
157 |
+
'class' => 'um-restrict-content um-third-column',
|
158 |
+
'prefix_id' => 'um_content_restriction',
|
159 |
+
'fields' => $fields,
|
160 |
+
)
|
161 |
+
)->render_form();
|
162 |
+
?>
|
163 |
+
|
164 |
+
</div>
|
includes/admin/templates/directory/appearance.php
CHANGED
@@ -1,23 +1,25 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
'
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
'
|
16 |
-
'
|
17 |
-
'
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id; ?>
|
6 |
+
|
7 |
+
<div class="um-admin-metabox">
|
8 |
+
<?php
|
9 |
+
UM()->admin_forms(
|
10 |
+
array(
|
11 |
+
'class' => 'um-member-directory-appearance um-top-label',
|
12 |
+
'prefix_id' => 'um_metadata',
|
13 |
+
'fields' => array(
|
14 |
+
array(
|
15 |
+
'id' => '_um_directory_template',
|
16 |
+
'type' => 'select',
|
17 |
+
'label' => __( 'Template', 'ultimate-member' ),
|
18 |
+
'value' => get_post_meta( $post_id, '_um_directory_template', true ),
|
19 |
+
'options' => UM()->shortcodes()->get_templates( 'members' ),
|
20 |
+
),
|
21 |
+
),
|
22 |
+
)
|
23 |
+
)->render_form();
|
24 |
+
?>
|
25 |
+
</div>
|
includes/admin/templates/directory/general.php
CHANGED
@@ -1,131 +1,133 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
global $post_id;
|
6 |
-
|
7 |
-
$_um_roles_value = get_post_meta( $post_id, '_um_roles', true );
|
8 |
-
$_um_roles_value = empty( $_um_roles_value ) ? array() : $_um_roles_value;
|
9 |
-
|
10 |
-
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
|
11 |
-
if ( $show_these_users ) {
|
12 |
-
$show_these_users = implode( "\n", str_replace( "\r", '', $show_these_users ) );
|
13 |
-
}
|
14 |
-
|
15 |
-
$exclude_these_users = get_post_meta( get_the_ID(), '_um_exclude_these_users', true );
|
16 |
-
if ( $exclude_these_users ) {
|
17 |
-
$exclude_these_users = implode( "\n", str_replace( "\r", '', $exclude_these_users ) );
|
18 |
-
}
|
19 |
-
|
20 |
-
$_um_view_types_value = get_post_meta( $post_id, '_um_view_types', true );
|
21 |
-
$_um_view_types_value = empty( $_um_view_types_value ) ? array( 'grid', 'list' ) : $_um_view_types_value;
|
22 |
-
|
23 |
-
$view_types_options = array_map(
|
24 |
-
function( $item ) {
|
25 |
-
return $item['title'];
|
26 |
-
},
|
27 |
-
UM()->member_directory()->view_types
|
28 |
-
);
|
29 |
-
|
30 |
-
$conditional = array();
|
31 |
-
foreach ( $view_types_options as $key => $value ) {
|
32 |
-
$conditional[] = '_um_view_types_' . $key;
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
$
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
'
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
'
|
46 |
-
'
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
'
|
56 |
-
'
|
57 |
-
'
|
58 |
-
'
|
59 |
-
'
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
'
|
65 |
-
'
|
66 |
-
'
|
67 |
-
'
|
68 |
-
'
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
'
|
74 |
-
'
|
75 |
-
'
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
'
|
81 |
-
'
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
'
|
87 |
-
'
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
'
|
93 |
-
'
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
*
|
101 |
-
*
|
102 |
-
* @
|
103 |
-
* @
|
104 |
-
*
|
105 |
-
* @
|
106 |
-
* ["
|
107 |
-
* @
|
108 |
-
*
|
109 |
-
*
|
110 |
-
*
|
111 |
-
*
|
112 |
-
*
|
113 |
-
*
|
114 |
-
*
|
115 |
-
*
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
'
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id;
|
6 |
+
|
7 |
+
$_um_roles_value = get_post_meta( $post_id, '_um_roles', true );
|
8 |
+
$_um_roles_value = empty( $_um_roles_value ) ? array() : $_um_roles_value;
|
9 |
+
|
10 |
+
$show_these_users = get_post_meta( get_the_ID(), '_um_show_these_users', true );
|
11 |
+
if ( $show_these_users ) {
|
12 |
+
$show_these_users = implode( "\n", str_replace( "\r", '', $show_these_users ) );
|
13 |
+
}
|
14 |
+
|
15 |
+
$exclude_these_users = get_post_meta( get_the_ID(), '_um_exclude_these_users', true );
|
16 |
+
if ( $exclude_these_users ) {
|
17 |
+
$exclude_these_users = implode( "\n", str_replace( "\r", '', $exclude_these_users ) );
|
18 |
+
}
|
19 |
+
|
20 |
+
$_um_view_types_value = get_post_meta( $post_id, '_um_view_types', true );
|
21 |
+
$_um_view_types_value = empty( $_um_view_types_value ) ? array( 'grid', 'list' ) : $_um_view_types_value;
|
22 |
+
|
23 |
+
$view_types_options = array_map(
|
24 |
+
function( $item ) {
|
25 |
+
return $item['title'];
|
26 |
+
},
|
27 |
+
UM()->member_directory()->view_types
|
28 |
+
);
|
29 |
+
|
30 |
+
$conditional = array();
|
31 |
+
foreach ( $view_types_options as $key => $value ) {
|
32 |
+
$conditional[] = '_um_view_types_' . $key;
|
33 |
+
}
|
34 |
+
|
35 |
+
$default_view = get_post_meta( $post_id, '_um_default_view', true );
|
36 |
+
$default_view = empty( $default_view ) ? 'grid' : $default_view;
|
37 |
+
|
38 |
+
$fields = array(
|
39 |
+
array(
|
40 |
+
'id' => '_um_mode',
|
41 |
+
'type' => 'hidden',
|
42 |
+
'value' => 'directory',
|
43 |
+
),
|
44 |
+
array(
|
45 |
+
'id' => '_um_view_types',
|
46 |
+
'type' => 'multi_checkbox',
|
47 |
+
'label' => __( 'View type(s)', 'ultimate-member' ),
|
48 |
+
'tooltip' => __( 'View type a specific parameter in the directory', 'ultimate-member' ),
|
49 |
+
'options' => $view_types_options,
|
50 |
+
'columns' => 3,
|
51 |
+
'value' => $_um_view_types_value,
|
52 |
+
'data' => array( 'fill__um_default_view' => 'checkbox_key' ),
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
'id' => '_um_default_view',
|
56 |
+
'type' => 'select',
|
57 |
+
'label' => __( 'Default view type', 'ultimate-member' ),
|
58 |
+
'tooltip' => __( 'Default directory view type', 'ultimate-member' ),
|
59 |
+
'options' => $view_types_options,
|
60 |
+
'value' => $default_view,
|
61 |
+
'conditional' => array( implode( '|', $conditional ), '~', 1 ),
|
62 |
+
),
|
63 |
+
array(
|
64 |
+
'id' => '_um_roles',
|
65 |
+
'type' => 'multi_checkbox',
|
66 |
+
'label' => __( 'User Roles to Display', 'ultimate-member' ),
|
67 |
+
'tooltip' => __( 'If you do not want to show all members, select only user roles to appear in this directory', 'ultimate-member' ),
|
68 |
+
'options' => UM()->roles()->get_roles(),
|
69 |
+
'columns' => 3,
|
70 |
+
'value' => $_um_roles_value,
|
71 |
+
),
|
72 |
+
array(
|
73 |
+
'id' => '_um_has_profile_photo',
|
74 |
+
'type' => 'checkbox',
|
75 |
+
'label' => __( 'Only show members who have uploaded a profile photo', 'ultimate-member' ),
|
76 |
+
'tooltip' => __( 'If \'Use Gravatars\' as profile photo is enabled, this option is ignored', 'ultimate-member' ),
|
77 |
+
'value' => (bool) get_post_meta( $post_id, '_um_has_profile_photo', true ),
|
78 |
+
),
|
79 |
+
array(
|
80 |
+
'id' => '_um_has_cover_photo',
|
81 |
+
'type' => 'checkbox',
|
82 |
+
'label' => __( 'Only show members who have uploaded a cover photo', 'ultimate-member' ),
|
83 |
+
'value' => (bool) get_post_meta( $post_id, '_um_has_cover_photo', true ),
|
84 |
+
),
|
85 |
+
array(
|
86 |
+
'id' => '_um_show_these_users',
|
87 |
+
'type' => 'textarea',
|
88 |
+
'label' => __( 'Only show specific users (Enter one username per line)', 'ultimate-member' ),
|
89 |
+
'value' => $show_these_users,
|
90 |
+
),
|
91 |
+
array(
|
92 |
+
'id' => '_um_exclude_these_users',
|
93 |
+
'type' => 'textarea',
|
94 |
+
'label' => __( 'Exclude specific users (Enter one username per line)', 'ultimate-member' ),
|
95 |
+
'value' => $exclude_these_users,
|
96 |
+
),
|
97 |
+
);
|
98 |
+
|
99 |
+
/**
|
100 |
+
* UM hook
|
101 |
+
*
|
102 |
+
* @type filter
|
103 |
+
* @title um_admin_extend_directory_options_general
|
104 |
+
* @description Extend Directory options fields
|
105 |
+
* @input_vars
|
106 |
+
* [{"var":"$fields","type":"array","desc":"Directory options fields"}]
|
107 |
+
* @change_log
|
108 |
+
* ["Since: 2.0"]
|
109 |
+
* @usage add_filter( 'um_admin_directory_sort_users_select', 'function_name', 10, 1 );
|
110 |
+
* @example
|
111 |
+
* <?php
|
112 |
+
* add_filter( 'um_admin_directory_sort_users_select', 'my_directory_sort_users_select', 10, 1 );
|
113 |
+
* function my_directory_sort_users_select( $sort_types ) {
|
114 |
+
* // your code here
|
115 |
+
* return $sort_types;
|
116 |
+
* }
|
117 |
+
* ?>
|
118 |
+
*/
|
119 |
+
$fields = apply_filters( 'um_admin_extend_directory_options_general', $fields ); ?>
|
120 |
+
|
121 |
+
<div class="um-admin-metabox">
|
122 |
+
<?php
|
123 |
+
UM()->admin_forms(
|
124 |
+
array(
|
125 |
+
'class' => 'um-member-directory-general um-half-column',
|
126 |
+
'prefix_id' => 'um_metadata',
|
127 |
+
'fields' => $fields,
|
128 |
+
)
|
129 |
+
)->render_form();
|
130 |
+
?>
|
131 |
+
|
132 |
+
<div class="um-admin-clear"></div>
|
133 |
+
</div>
|
includes/admin/templates/directory/pagination.php
CHANGED
@@ -1,72 +1,74 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
'
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
'
|
16 |
-
'
|
17 |
-
'
|
18 |
-
'
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
'
|
24 |
-
'
|
25 |
-
'
|
26 |
-
'
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
'
|
32 |
-
'
|
33 |
-
'
|
34 |
-
'
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
'
|
40 |
-
'
|
41 |
-
'
|
42 |
-
'
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
'
|
48 |
-
'
|
49 |
-
'
|
50 |
-
'
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
'
|
56 |
-
'
|
57 |
-
'
|
58 |
-
'
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
'
|
64 |
-
'
|
65 |
-
'
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id; ?>
|
6 |
+
|
7 |
+
<div class="um-admin-metabox">
|
8 |
+
<?php
|
9 |
+
UM()->admin_forms(
|
10 |
+
array(
|
11 |
+
'class' => 'um-member-directory-pagination um-half-column',
|
12 |
+
'prefix_id' => 'um_metadata',
|
13 |
+
'fields' => array(
|
14 |
+
array(
|
15 |
+
'id' => '_um_must_search',
|
16 |
+
'type' => 'checkbox',
|
17 |
+
'label' => __( 'Show results only after search/filtration', 'ultimate-member' ),
|
18 |
+
'tooltip' => __( 'If turned on, member results will only appear after search/filter is performed', 'ultimate-member' ),
|
19 |
+
'value' => (bool) get_post_meta( $post_id, '_um_must_search', true ),
|
20 |
+
'conditional' => array( '_um_search||_um_filters', '=', 1 ),
|
21 |
+
),
|
22 |
+
array(
|
23 |
+
'id' => '_um_max_users',
|
24 |
+
'type' => 'number',
|
25 |
+
'label' => __( 'Maximum number of profiles', 'ultimate-member' ),
|
26 |
+
'tooltip' => __( 'Use this setting to control the maximum number of profiles to appear in this directory. Leave blank to disable this limit', 'ultimate-member' ),
|
27 |
+
'value' => UM()->query()->get_meta_value( '_um_max_users', null, 'na' ),
|
28 |
+
'size' => 'small',
|
29 |
+
),
|
30 |
+
array(
|
31 |
+
'id' => '_um_profiles_per_page',
|
32 |
+
'type' => 'number',
|
33 |
+
'label' => __( 'Number of profiles per page', 'ultimate-member' ),
|
34 |
+
'tooltip' => __( 'Number of profiles to appear on page for standard users', 'ultimate-member' ),
|
35 |
+
'value' => UM()->query()->get_meta_value( '_um_profiles_per_page', null, 12 ),
|
36 |
+
'size' => 'small',
|
37 |
+
),
|
38 |
+
array(
|
39 |
+
'id' => '_um_profiles_per_page_mobile',
|
40 |
+
'type' => 'number',
|
41 |
+
'label' => __( 'Number of profiles per page (for Mobiles & Tablets)', 'ultimate-member' ),
|
42 |
+
'tooltip' => __( 'Number of profiles to appear on page for mobile users', 'ultimate-member' ),
|
43 |
+
'value' => UM()->query()->get_meta_value( '_um_profiles_per_page_mobile', null, 8 ),
|
44 |
+
'size' => 'small',
|
45 |
+
),
|
46 |
+
array(
|
47 |
+
'id' => '_um_directory_header',
|
48 |
+
'type' => 'text',
|
49 |
+
'label' => __( 'Results Text', 'ultimate-member' ),
|
50 |
+
'tooltip' => __( 'Customize the search result text . e.g. Found 3,000 Members. Leave this blank to not show result text', 'ultimate-member' ),
|
51 |
+
'description' => __( 'You could use {total_users} placeholder for getting users count', 'ultimate-member' ),
|
52 |
+
'value' => UM()->query()->get_meta_value( '_um_directory_header', null, 'na' ),
|
53 |
+
),
|
54 |
+
array(
|
55 |
+
'id' => '_um_directory_header_single',
|
56 |
+
'type' => 'text',
|
57 |
+
'label' => __( 'Single Result Text', 'ultimate-member' ),
|
58 |
+
'tooltip' => __( 'Same as above but in case of 1 user found only', 'ultimate-member' ),
|
59 |
+
'description' => __( 'You could use {total_users} placeholder for getting users count', 'ultimate-member' ),
|
60 |
+
'value' => UM()->query()->get_meta_value( '_um_directory_header_single', null, 'na' ),
|
61 |
+
),
|
62 |
+
array(
|
63 |
+
'id' => '_um_directory_no_users',
|
64 |
+
'type' => 'text',
|
65 |
+
'label' => __( 'Custom text if no users were found', 'ultimate-member' ),
|
66 |
+
'tooltip' => __( 'This is the text that is displayed if no users are found during a search', 'ultimate-member' ),
|
67 |
+
'value' => UM()->query()->get_meta_value( '_um_directory_no_users', null, 'na' ),
|
68 |
+
),
|
69 |
+
),
|
70 |
+
)
|
71 |
+
)->render_form();
|
72 |
+
?>
|
73 |
+
<div class="um-admin-clear"></div>
|
74 |
+
</div>
|
includes/admin/templates/directory/profile.php
CHANGED
@@ -1,120 +1,120 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
$
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
$
|
13 |
-
|
14 |
-
|
15 |
-
$fields = array(
|
16 |
-
array(
|
17 |
-
'id' => '_um_profile_photo',
|
18 |
-
'type' => 'checkbox',
|
19 |
-
'label' => __( 'Enable Profile Photo', 'ultimate-member' ),
|
20 |
-
'value' =>
|
21 |
-
),
|
22 |
-
array(
|
23 |
-
'id' => '_um_cover_photos',
|
24 |
-
'type' => 'checkbox',
|
25 |
-
'label' => __( 'Enable Cover Photo', 'ultimate-member' ),
|
26 |
-
'tooltip' => __( 'If turned on, the users cover photo will appear in the directory', 'ultimate-member' ),
|
27 |
-
'value' =>
|
28 |
-
),
|
29 |
-
array(
|
30 |
-
'id' => '_um_show_name',
|
31 |
-
'type' => 'checkbox',
|
32 |
-
'label' => __( 'Show display name', 'ultimate-member' ),
|
33 |
-
'value' =>
|
34 |
-
),
|
35 |
-
array(
|
36 |
-
'id' => '_um_show_tagline',
|
37 |
-
'type' => 'checkbox',
|
38 |
-
'label' => __( 'Show tagline below profile name', 'ultimate-member' ),
|
39 |
-
'value' =>
|
40 |
-
),
|
41 |
-
array(
|
42 |
-
'id' => '_um_tagline_fields',
|
43 |
-
'type' => 'multi_selects',
|
44 |
-
'label' => __( 'Choose field(s) to display in tagline', 'ultimate-member' ),
|
45 |
-
'value' => $_um_tagline_fields,
|
46 |
-
'conditional' => array( '_um_show_tagline', '=', 1 ),
|
47 |
-
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
48 |
-
'options' => $user_fields,
|
49 |
-
'show_default_number' => 1,
|
50 |
-
'sorting' => true,
|
51 |
-
),
|
52 |
-
array(
|
53 |
-
'id' => '_um_show_userinfo',
|
54 |
-
'type' => 'checkbox',
|
55 |
-
'label' => __( 'Show extra user information below tagline?', 'ultimate-member' ),
|
56 |
-
'value' =>
|
57 |
-
),
|
58 |
-
array(
|
59 |
-
'id' => '_um_reveal_fields',
|
60 |
-
'type' => 'multi_selects',
|
61 |
-
'label' => __( 'Choose field(s) to display in extra user information section', 'ultimate-member' ),
|
62 |
-
'value' => $_um_reveal_fields,
|
63 |
-
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
64 |
-
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
65 |
-
'options' => $user_fields,
|
66 |
-
'show_default_number' => 1,
|
67 |
-
'sorting' => true,
|
68 |
-
),
|
69 |
-
array(
|
70 |
-
'id' => '_um_show_social',
|
71 |
-
'type' => 'checkbox',
|
72 |
-
'label' => __( 'Show social connect icons in extra user information section', 'ultimate-member' ),
|
73 |
-
'value' =>
|
74 |
-
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
75 |
-
),
|
76 |
-
array(
|
77 |
-
'id' => '_um_userinfo_animate',
|
78 |
-
'type' => 'checkbox',
|
79 |
-
'label' => __( 'Hide extra user information to the reveal section', 'ultimate-member' ),
|
80 |
-
'tooltip' => __( 'If not checked always shown', 'ultimate-member' ),
|
81 |
-
'value' =>
|
82 |
-
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
83 |
-
),
|
84 |
-
);
|
85 |
-
|
86 |
-
|
87 |
-
/**
|
88 |
-
* UM hook
|
89 |
-
*
|
90 |
-
* @type filter
|
91 |
-
* @title um_admin_extend_directory_options_general
|
92 |
-
* @description Extend Directory options fields
|
93 |
-
* @input_vars
|
94 |
-
* [{"var":"$fields","type":"array","desc":"Directory options fields"}]
|
95 |
-
* @change_log
|
96 |
-
* ["Since: 2.0"]
|
97 |
-
* @usage add_filter( 'um_admin_directory_sort_users_select', 'function_name', 10, 1 );
|
98 |
-
* @example
|
99 |
-
* <?php
|
100 |
-
* add_filter( 'um_admin_directory_sort_users_select', 'my_directory_sort_users_select', 10, 1 );
|
101 |
-
* function my_directory_sort_users_select( $sort_types ) {
|
102 |
-
* // your code here
|
103 |
-
* return $sort_types;
|
104 |
-
* }
|
105 |
-
* ?>
|
106 |
-
*/
|
107 |
-
$fields = apply_filters( 'um_admin_extend_directory_options_profile', $fields ); ?>
|
108 |
-
|
109 |
-
<div class="um-admin-metabox">
|
110 |
-
<?php
|
111 |
-
UM()->admin_forms(
|
112 |
-
array(
|
113 |
-
'class' => 'um-member-directory-profile um-half-column',
|
114 |
-
'prefix_id' => 'um_metadata',
|
115 |
-
'fields' => $fields,
|
116 |
-
)
|
117 |
-
)->render_form();
|
118 |
-
?>
|
119 |
-
<div class="um-admin-clear"></div>
|
120 |
-
</div>
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id;
|
6 |
+
|
7 |
+
$user_fields = array();
|
8 |
+
foreach ( UM()->builtin()->all_user_fields() as $key => $arr ) {
|
9 |
+
$user_fields[ $key ] = isset( $arr['title'] ) ? $arr['title'] : '';
|
10 |
+
}
|
11 |
+
|
12 |
+
$_um_tagline_fields = get_post_meta( $post_id, '_um_tagline_fields', true );
|
13 |
+
$_um_reveal_fields = get_post_meta( $post_id, '_um_reveal_fields', true );
|
14 |
+
|
15 |
+
$fields = array(
|
16 |
+
array(
|
17 |
+
'id' => '_um_profile_photo',
|
18 |
+
'type' => 'checkbox',
|
19 |
+
'label' => __( 'Enable Profile Photo', 'ultimate-member' ),
|
20 |
+
'value' => (bool) get_post_meta( $post_id, '_um_profile_photo', true ),
|
21 |
+
),
|
22 |
+
array(
|
23 |
+
'id' => '_um_cover_photos',
|
24 |
+
'type' => 'checkbox',
|
25 |
+
'label' => __( 'Enable Cover Photo', 'ultimate-member' ),
|
26 |
+
'tooltip' => __( 'If turned on, the users cover photo will appear in the directory', 'ultimate-member' ),
|
27 |
+
'value' => (bool) get_post_meta( $post_id, '_um_cover_photos', true ),
|
28 |
+
),
|
29 |
+
array(
|
30 |
+
'id' => '_um_show_name',
|
31 |
+
'type' => 'checkbox',
|
32 |
+
'label' => __( 'Show display name', 'ultimate-member' ),
|
33 |
+
'value' => (bool) get_post_meta( $post_id, '_um_show_name', true ),
|
34 |
+
),
|
35 |
+
array(
|
36 |
+
'id' => '_um_show_tagline',
|
37 |
+
'type' => 'checkbox',
|
38 |
+
'label' => __( 'Show tagline below profile name', 'ultimate-member' ),
|
39 |
+
'value' => (bool) get_post_meta( $post_id, '_um_show_tagline', true ),
|
40 |
+
),
|
41 |
+
array(
|
42 |
+
'id' => '_um_tagline_fields',
|
43 |
+
'type' => 'multi_selects',
|
44 |
+
'label' => __( 'Choose field(s) to display in tagline', 'ultimate-member' ),
|
45 |
+
'value' => $_um_tagline_fields,
|
46 |
+
'conditional' => array( '_um_show_tagline', '=', 1 ),
|
47 |
+
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
48 |
+
'options' => $user_fields,
|
49 |
+
'show_default_number' => 1,
|
50 |
+
'sorting' => true,
|
51 |
+
),
|
52 |
+
array(
|
53 |
+
'id' => '_um_show_userinfo',
|
54 |
+
'type' => 'checkbox',
|
55 |
+
'label' => __( 'Show extra user information below tagline?', 'ultimate-member' ),
|
56 |
+
'value' => (bool) get_post_meta( $post_id, '_um_show_userinfo', true ),
|
57 |
+
),
|
58 |
+
array(
|
59 |
+
'id' => '_um_reveal_fields',
|
60 |
+
'type' => 'multi_selects',
|
61 |
+
'label' => __( 'Choose field(s) to display in extra user information section', 'ultimate-member' ),
|
62 |
+
'value' => $_um_reveal_fields,
|
63 |
+
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
64 |
+
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
65 |
+
'options' => $user_fields,
|
66 |
+
'show_default_number' => 1,
|
67 |
+
'sorting' => true,
|
68 |
+
),
|
69 |
+
array(
|
70 |
+
'id' => '_um_show_social',
|
71 |
+
'type' => 'checkbox',
|
72 |
+
'label' => __( 'Show social connect icons in extra user information section', 'ultimate-member' ),
|
73 |
+
'value' => (bool) get_post_meta( $post_id, '_um_show_social', true ),
|
74 |
+
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
75 |
+
),
|
76 |
+
array(
|
77 |
+
'id' => '_um_userinfo_animate',
|
78 |
+
'type' => 'checkbox',
|
79 |
+
'label' => __( 'Hide extra user information to the reveal section', 'ultimate-member' ),
|
80 |
+
'tooltip' => __( 'If not checked always shown', 'ultimate-member' ),
|
81 |
+
'value' => (bool) get_post_meta( $post_id, '_um_userinfo_animate', true ),
|
82 |
+
'conditional' => array( '_um_show_userinfo', '=', 1 ),
|
83 |
+
),
|
84 |
+
);
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* UM hook
|
89 |
+
*
|
90 |
+
* @type filter
|
91 |
+
* @title um_admin_extend_directory_options_general
|
92 |
+
* @description Extend Directory options fields
|
93 |
+
* @input_vars
|
94 |
+
* [{"var":"$fields","type":"array","desc":"Directory options fields"}]
|
95 |
+
* @change_log
|
96 |
+
* ["Since: 2.0"]
|
97 |
+
* @usage add_filter( 'um_admin_directory_sort_users_select', 'function_name', 10, 1 );
|
98 |
+
* @example
|
99 |
+
* <?php
|
100 |
+
* add_filter( 'um_admin_directory_sort_users_select', 'my_directory_sort_users_select', 10, 1 );
|
101 |
+
* function my_directory_sort_users_select( $sort_types ) {
|
102 |
+
* // your code here
|
103 |
+
* return $sort_types;
|
104 |
+
* }
|
105 |
+
* ?>
|
106 |
+
*/
|
107 |
+
$fields = apply_filters( 'um_admin_extend_directory_options_profile', $fields ); ?>
|
108 |
+
|
109 |
+
<div class="um-admin-metabox">
|
110 |
+
<?php
|
111 |
+
UM()->admin_forms(
|
112 |
+
array(
|
113 |
+
'class' => 'um-member-directory-profile um-half-column',
|
114 |
+
'prefix_id' => 'um_metadata',
|
115 |
+
'fields' => $fields,
|
116 |
+
)
|
117 |
+
)->render_form();
|
118 |
+
?>
|
119 |
+
<div class="um-admin-clear"></div>
|
120 |
+
</div>
|
includes/admin/templates/directory/search.php
CHANGED
@@ -1,100 +1,100 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
global $post_id;
|
6 |
-
|
7 |
-
$_um_roles_search_value = get_post_meta( $post_id, '_um_roles_can_search', true );
|
8 |
-
$_um_roles_search_value = empty( $_um_roles_search_value ) ? array() : $_um_roles_search_value;
|
9 |
-
|
10 |
-
$_um_roles_filter_value = get_post_meta( $post_id, '_um_roles_can_filter', true );
|
11 |
-
$_um_roles_filter_value = empty( $_um_roles_filter_value ) ? array() : $_um_roles_filter_value;
|
12 |
-
|
13 |
-
$_um_search_fields = get_post_meta( $post_id, '_um_search_fields', true );
|
14 |
-
$_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
|
15 |
-
|
16 |
-
|
17 |
-
<div class="um-admin-metabox">
|
18 |
-
<?php
|
19 |
-
UM()->admin_forms(
|
20 |
-
array(
|
21 |
-
'class' => 'um-member-directory-search um-half-column',
|
22 |
-
'prefix_id' => 'um_metadata',
|
23 |
-
'fields' => array(
|
24 |
-
array(
|
25 |
-
'id' => '_um_search',
|
26 |
-
'type' => 'checkbox',
|
27 |
-
'label' => __( 'Enable Search feature', 'ultimate-member' ),
|
28 |
-
'tooltip' => __( 'If turned on, users will be able to search members in this directory', 'ultimate-member' ),
|
29 |
-
'value' =>
|
30 |
-
),
|
31 |
-
array(
|
32 |
-
'id' => '_um_roles_can_search',
|
33 |
-
'type' => 'multi_checkbox',
|
34 |
-
'label' => __( 'User Roles that can use search', 'ultimate-member' ),
|
35 |
-
'tooltip' => __( 'If you want to allow specific user roles to be able to search only', 'ultimate-member' ),
|
36 |
-
'value' => $_um_roles_search_value,
|
37 |
-
'options' => UM()->roles()->get_roles(),
|
38 |
-
'columns' => 3,
|
39 |
-
'conditional' => array( '_um_search', '=', 1 ),
|
40 |
-
),
|
41 |
-
array(
|
42 |
-
'id' => '_um_filters',
|
43 |
-
'type' => 'checkbox',
|
44 |
-
'label' => __( 'Enable Filters feature', 'ultimate-member' ),
|
45 |
-
'tooltip' => __( 'If turned on, users will be able to filter members in this directory', 'ultimate-member' ),
|
46 |
-
'value' =>
|
47 |
-
),
|
48 |
-
array(
|
49 |
-
'id' => '_um_roles_can_filter',
|
50 |
-
'type' => 'multi_checkbox',
|
51 |
-
'label' => __( 'User Roles that can use filters', 'ultimate-member' ),
|
52 |
-
'tooltip' => __( 'If you want to allow specific user roles to be able to filter only', 'ultimate-member' ),
|
53 |
-
'value' => $_um_roles_filter_value,
|
54 |
-
'options' => UM()->roles()->get_roles(),
|
55 |
-
'columns' => 3,
|
56 |
-
'conditional' => array( '_um_filters', '=', 1 ),
|
57 |
-
),
|
58 |
-
array(
|
59 |
-
'id' => '_um_search_fields',
|
60 |
-
'type' => 'multi_selects',
|
61 |
-
'label' => __( 'Choose filter(s) meta to enable', 'ultimate-member' ),
|
62 |
-
'value' => $_um_search_fields,
|
63 |
-
'conditional' => array( '_um_filters', '=', 1 ),
|
64 |
-
'options' => UM()->member_directory()->filter_fields,
|
65 |
-
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
66 |
-
'show_default_number' => 0,
|
67 |
-
'sorting' => true,
|
68 |
-
),
|
69 |
-
array(
|
70 |
-
'id' => '_um_filters_expanded',
|
71 |
-
'type' => 'checkbox',
|
72 |
-
'label' => __( 'Expand the filter bar by default', 'ultimate-member' ),
|
73 |
-
'tooltip' => __( 'If turned on, filters bar will be visible after a page loading', 'ultimate-member' ),
|
74 |
-
'value' =>
|
75 |
-
'conditional' => array( '_um_filters', '=', 1 ),
|
76 |
-
),
|
77 |
-
array(
|
78 |
-
'id' => '_um_filters_is_collapsible',
|
79 |
-
'type' => 'checkbox',
|
80 |
-
'label' => __( 'Can filter bar be collapsed', 'ultimate-member' ),
|
81 |
-
'tooltip' => __( 'If turned on, filters bar can be collapsed after a page loading', 'ultimate-member' ),
|
82 |
-
'value' =>
|
83 |
-
'conditional' => array( '_um_filters_expanded', '=', 1 ),
|
84 |
-
),
|
85 |
-
array(
|
86 |
-
'id' => '_um_search_filters',
|
87 |
-
'type' => 'md_default_filters',
|
88 |
-
'label' => __( 'Admin filtering', 'ultimate-member' ),
|
89 |
-
'tooltip' => __( 'Limit which users appear in the member directory e.g only display users from USA', 'ultimate-member' ),
|
90 |
-
'value' => $_um_search_filters,
|
91 |
-
'options' => UM()->member_directory()->filter_fields,
|
92 |
-
'add_text' => __( 'Add New Filter', 'ultimate-member' ),
|
93 |
-
'show_default_number' => 0,
|
94 |
-
),
|
95 |
-
),
|
96 |
-
)
|
97 |
-
)->render_form();
|
98 |
-
?>
|
99 |
-
<div class="um-admin-clear"></div>
|
100 |
-
</div>
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id;
|
6 |
+
|
7 |
+
$_um_roles_search_value = get_post_meta( $post_id, '_um_roles_can_search', true );
|
8 |
+
$_um_roles_search_value = empty( $_um_roles_search_value ) ? array() : $_um_roles_search_value;
|
9 |
+
|
10 |
+
$_um_roles_filter_value = get_post_meta( $post_id, '_um_roles_can_filter', true );
|
11 |
+
$_um_roles_filter_value = empty( $_um_roles_filter_value ) ? array() : $_um_roles_filter_value;
|
12 |
+
|
13 |
+
$_um_search_fields = get_post_meta( $post_id, '_um_search_fields', true );
|
14 |
+
$_um_search_filters = get_post_meta( $post_id, '_um_search_filters', true ); ?>
|
15 |
+
|
16 |
+
|
17 |
+
<div class="um-admin-metabox">
|
18 |
+
<?php
|
19 |
+
UM()->admin_forms(
|
20 |
+
array(
|
21 |
+
'class' => 'um-member-directory-search um-half-column',
|
22 |
+
'prefix_id' => 'um_metadata',
|
23 |
+
'fields' => array(
|
24 |
+
array(
|
25 |
+
'id' => '_um_search',
|
26 |
+
'type' => 'checkbox',
|
27 |
+
'label' => __( 'Enable Search feature', 'ultimate-member' ),
|
28 |
+
'tooltip' => __( 'If turned on, users will be able to search members in this directory', 'ultimate-member' ),
|
29 |
+
'value' => (bool) get_post_meta( $post_id, '_um_search', true ),
|
30 |
+
),
|
31 |
+
array(
|
32 |
+
'id' => '_um_roles_can_search',
|
33 |
+
'type' => 'multi_checkbox',
|
34 |
+
'label' => __( 'User Roles that can use search', 'ultimate-member' ),
|
35 |
+
'tooltip' => __( 'If you want to allow specific user roles to be able to search only', 'ultimate-member' ),
|
36 |
+
'value' => $_um_roles_search_value,
|
37 |
+
'options' => UM()->roles()->get_roles(),
|
38 |
+
'columns' => 3,
|
39 |
+
'conditional' => array( '_um_search', '=', 1 ),
|
40 |
+
),
|
41 |
+
array(
|
42 |
+
'id' => '_um_filters',
|
43 |
+
'type' => 'checkbox',
|
44 |
+
'label' => __( 'Enable Filters feature', 'ultimate-member' ),
|
45 |
+
'tooltip' => __( 'If turned on, users will be able to filter members in this directory', 'ultimate-member' ),
|
46 |
+
'value' => (bool) get_post_meta( $post_id, '_um_filters', true ),
|
47 |
+
),
|
48 |
+
array(
|
49 |
+
'id' => '_um_roles_can_filter',
|
50 |
+
'type' => 'multi_checkbox',
|
51 |
+
'label' => __( 'User Roles that can use filters', 'ultimate-member' ),
|
52 |
+
'tooltip' => __( 'If you want to allow specific user roles to be able to filter only', 'ultimate-member' ),
|
53 |
+
'value' => $_um_roles_filter_value,
|
54 |
+
'options' => UM()->roles()->get_roles(),
|
55 |
+
'columns' => 3,
|
56 |
+
'conditional' => array( '_um_filters', '=', 1 ),
|
57 |
+
),
|
58 |
+
array(
|
59 |
+
'id' => '_um_search_fields',
|
60 |
+
'type' => 'multi_selects',
|
61 |
+
'label' => __( 'Choose filter(s) meta to enable', 'ultimate-member' ),
|
62 |
+
'value' => $_um_search_fields,
|
63 |
+
'conditional' => array( '_um_filters', '=', 1 ),
|
64 |
+
'options' => UM()->member_directory()->filter_fields,
|
65 |
+
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
|
66 |
+
'show_default_number' => 0,
|
67 |
+
'sorting' => true,
|
68 |
+
),
|
69 |
+
array(
|
70 |
+
'id' => '_um_filters_expanded',
|
71 |
+
'type' => 'checkbox',
|
72 |
+
'label' => __( 'Expand the filter bar by default', 'ultimate-member' ),
|
73 |
+
'tooltip' => __( 'If turned on, filters bar will be visible after a page loading', 'ultimate-member' ),
|
74 |
+
'value' => (bool) get_post_meta( $post_id, '_um_filters_expanded', true ),
|
75 |
+
'conditional' => array( '_um_filters', '=', 1 ),
|
76 |
+
),
|
77 |
+
array(
|
78 |
+
'id' => '_um_filters_is_collapsible',
|
79 |
+
'type' => 'checkbox',
|
80 |
+
'label' => __( 'Can filter bar be collapsed', 'ultimate-member' ),
|
81 |
+
'tooltip' => __( 'If turned on, filters bar can be collapsed after a page loading', 'ultimate-member' ),
|
82 |
+
'value' => (bool) get_post_meta( $post_id, '_um_filters_is_collapsible', true ),
|
83 |
+
'conditional' => array( '_um_filters_expanded', '=', 1 ),
|
84 |
+
),
|
85 |
+
array(
|
86 |
+
'id' => '_um_search_filters',
|
87 |
+
'type' => 'md_default_filters',
|
88 |
+
'label' => __( 'Admin filtering', 'ultimate-member' ),
|
89 |
+
'tooltip' => __( 'Limit which users appear in the member directory e.g only display users from USA', 'ultimate-member' ),
|
90 |
+
'value' => $_um_search_filters,
|
91 |
+
'options' => UM()->member_directory()->filter_fields,
|
92 |
+
'add_text' => __( 'Add New Filter', 'ultimate-member' ),
|
93 |
+
'show_default_number' => 0,
|
94 |
+
),
|
95 |
+
),
|
96 |
+
)
|
97 |
+
)->render_form();
|
98 |
+
?>
|
99 |
+
<div class="um-admin-clear"></div>
|
100 |
+
</div>
|
includes/admin/templates/directory/sorting.php
CHANGED
@@ -1,65 +1,65 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
global $post_id;
|
6 |
-
|
7 |
-
$_um_sorting_fields = get_post_meta( $post_id, '_um_sorting_fields', true );
|
8 |
-
$_um_sorting_fields = empty( $_um_sorting_fields ) ? array() : $_um_sorting_fields;
|
9 |
-
|
10 |
-
$fields = array(
|
11 |
-
array(
|
12 |
-
'id' => '_um_sortby',
|
13 |
-
'type' => 'select',
|
14 |
-
'label' => __( 'Default sort users by', 'ultimate-member' ),
|
15 |
-
'tooltip' => __( 'Default sorting users by a specific parameter in the directory', 'ultimate-member' ),
|
16 |
-
'options' => UM()->member_directory()->default_sorting,
|
17 |
-
'value' => UM()->query()->get_meta_value( '_um_sortby' ),
|
18 |
-
),
|
19 |
-
array(
|
20 |
-
'id' => '_um_sortby_custom',
|
21 |
-
'type' => 'text',
|
22 |
-
'label' => __( 'Meta key', 'ultimate-member' ),
|
23 |
-
'tooltip' => __( 'To sort by a custom field, enter the meta key of field here', 'ultimate-member' ),
|
24 |
-
'value' => UM()->query()->get_meta_value( '_um_sortby_custom', null, 'na' ),
|
25 |
-
'conditional' => array( '_um_sortby', '=', 'other' ),
|
26 |
-
),
|
27 |
-
array(
|
28 |
-
'id' => '_um_sortby_custom_label',
|
29 |
-
'type' => 'text',
|
30 |
-
'label' => __( 'Label of custom sort', 'ultimate-member' ),
|
31 |
-
'tooltip' => __( 'To sort by a custom field, enter the label of sorting here', 'ultimate-member' ),
|
32 |
-
'value' => UM()->query()->get_meta_value( '_um_sortby_custom_label', null, 'na' ),
|
33 |
-
'conditional' => array( '_um_sortby', '=', 'other' ),
|
34 |
-
),
|
35 |
-
array(
|
36 |
-
'id' => '_um_enable_sorting',
|
37 |
-
'type' => 'checkbox',
|
38 |
-
'label' => __( 'Enable custom sorting', 'ultimate-member' ),
|
39 |
-
'tooltip' => __( 'Whether to provide an ability to change the sorting on the directory page', 'ultimate-member' ),
|
40 |
-
'value' =>
|
41 |
-
),
|
42 |
-
array(
|
43 |
-
'id' => '_um_sorting_fields',
|
44 |
-
'type' => 'md_sorting_fields',
|
45 |
-
'label' => __( 'Choose field(s) to enable in sorting', 'ultimate-member' ),
|
46 |
-
'value' => $_um_sorting_fields,
|
47 |
-
'options' => array_merge( UM()->member_directory()->sort_fields, array( 'other' => __( 'Other (Custom Field)', 'ultimate-member' ) ) ),
|
48 |
-
'add_text' => __( 'Add New Field', 'ultimate-member' ),
|
49 |
-
'show_default_number' => 0,
|
50 |
-
'conditional' => array( '_um_enable_sorting', '=', 1 ),
|
51 |
-
),
|
52 |
-
); ?>
|
53 |
-
|
54 |
-
<div class="um-admin-metabox">
|
55 |
-
<?php
|
56 |
-
UM()->admin_forms(
|
57 |
-
array(
|
58 |
-
'class' => 'um-member-directory-sorting um-half-column',
|
59 |
-
'prefix_id' => 'um_metadata',
|
60 |
-
'fields' => $fields,
|
61 |
-
)
|
62 |
-
)->render_form();
|
63 |
-
?>
|
64 |
-
<div class="um-admin-clear"></div>
|
65 |
-
</div>
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id;
|
6 |
+
|
7 |
+
$_um_sorting_fields = get_post_meta( $post_id, '_um_sorting_fields', true );
|
8 |
+
$_um_sorting_fields = empty( $_um_sorting_fields ) ? array() : $_um_sorting_fields;
|
9 |
+
|
10 |
+
$fields = array(
|
11 |
+
array(
|
12 |
+
'id' => '_um_sortby',
|
13 |
+
'type' => 'select',
|
14 |
+
'label' => __( 'Default sort users by', 'ultimate-member' ),
|
15 |
+
'tooltip' => __( 'Default sorting users by a specific parameter in the directory', 'ultimate-member' ),
|
16 |
+
'options' => UM()->member_directory()->default_sorting,
|
17 |
+
'value' => UM()->query()->get_meta_value( '_um_sortby' ),
|
18 |
+
),
|
19 |
+
array(
|
20 |
+
'id' => '_um_sortby_custom',
|
21 |
+
'type' => 'text',
|
22 |
+
'label' => __( 'Meta key', 'ultimate-member' ),
|
23 |
+
'tooltip' => __( 'To sort by a custom field, enter the meta key of field here', 'ultimate-member' ),
|
24 |
+
'value' => UM()->query()->get_meta_value( '_um_sortby_custom', null, 'na' ),
|
25 |
+
'conditional' => array( '_um_sortby', '=', 'other' ),
|
26 |
+
),
|
27 |
+
array(
|
28 |
+
'id' => '_um_sortby_custom_label',
|
29 |
+
'type' => 'text',
|
30 |
+
'label' => __( 'Label of custom sort', 'ultimate-member' ),
|
31 |
+
'tooltip' => __( 'To sort by a custom field, enter the label of sorting here', 'ultimate-member' ),
|
32 |
+
'value' => UM()->query()->get_meta_value( '_um_sortby_custom_label', null, 'na' ),
|
33 |
+
'conditional' => array( '_um_sortby', '=', 'other' ),
|
34 |
+
),
|
35 |
+
array(
|
36 |
+
'id' => '_um_enable_sorting',
|
37 |
+
'type' => 'checkbox',
|
38 |
+
'label' => __( 'Enable custom sorting', 'ultimate-member' ),
|
39 |
+
'tooltip' => __( 'Whether to provide an ability to change the sorting on the directory page', 'ultimate-member' ),
|
40 |
+
'value' => (bool) get_post_meta( $post_id, '_um_enable_sorting', true ),
|
41 |
+
),
|
42 |
+
array(
|
43 |
+
'id' => '_um_sorting_fields',
|
44 |
+
'type' => 'md_sorting_fields',
|
45 |
+
'label' => __( 'Choose field(s) to enable in sorting', 'ultimate-member' ),
|
46 |
+
'value' => $_um_sorting_fields,
|
47 |
+
'options' => array_merge( UM()->member_directory()->sort_fields, array( 'other' => __( 'Other (Custom Field)', 'ultimate-member' ) ) ),
|
48 |
+
'add_text' => __( 'Add New Field', 'ultimate-member' ),
|
49 |
+
'show_default_number' => 0,
|
50 |
+
'conditional' => array( '_um_enable_sorting', '=', 1 ),
|
51 |
+
),
|
52 |
+
); ?>
|
53 |
+
|
54 |
+
<div class="um-admin-metabox">
|
55 |
+
<?php
|
56 |
+
UM()->admin_forms(
|
57 |
+
array(
|
58 |
+
'class' => 'um-member-directory-sorting um-half-column',
|
59 |
+
'prefix_id' => 'um_metadata',
|
60 |
+
'fields' => $fields,
|
61 |
+
)
|
62 |
+
)->render_form();
|
63 |
+
?>
|
64 |
+
<div class="um-admin-clear"></div>
|
65 |
+
</div>
|
includes/admin/templates/form/login_customize.php
CHANGED
@@ -1,106 +1,114 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
'
|
25 |
-
'
|
26 |
-
'
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
),
|
31 |
-
array(
|
32 |
-
'id' => '
|
33 |
-
'type' => '
|
34 |
-
'label' => __( '
|
35 |
-
'
|
36 |
-
'
|
37 |
-
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
38 |
-
),
|
39 |
-
array(
|
40 |
-
'id' => '
|
41 |
-
'type' => '
|
42 |
-
'label' => __( '
|
43 |
-
'tooltip' => __( '
|
44 |
-
'value' => UM()->query()->get_meta_value( '
|
45 |
-
'
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
'
|
51 |
-
|
52 |
-
|
53 |
-
'
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
59 |
-
),
|
60 |
-
array(
|
61 |
-
'id' => '
|
62 |
-
'type' => '
|
63 |
-
'label' => __( '
|
64 |
-
'
|
65 |
-
'
|
66 |
-
'
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
'
|
73 |
-
'
|
74 |
-
'
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
),
|
79 |
-
array(
|
80 |
-
'id' => '
|
81 |
-
'type' => '
|
82 |
-
'label' => __( '
|
83 |
-
'
|
84 |
-
'
|
85 |
-
'
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
'
|
92 |
-
'
|
93 |
-
'
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id;
|
6 |
+
|
7 |
+
$use_custom_settings = ! isset( $post_id ) ? false : get_post_meta( $post_id, '_um_login_use_custom_settings', true );
|
8 |
+
$login_secondary_btn = ! isset( $post_id ) ? UM()->options()->get( 'login_secondary_btn' ) : get_post_meta( $post_id, '_um_login_secondary_btn', true );
|
9 |
+
$login_forgot_pass_link = ! isset( $post_id ) ? UM()->options()->get( 'login_forgot_pass_link' ) : get_post_meta( $post_id, '_um_login_forgot_pass_link', true );
|
10 |
+
$login_show_rememberme = ! isset( $post_id ) ? UM()->options()->get( 'login_show_rememberme' ) : get_post_meta( $post_id, '_um_login_show_rememberme', true );
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="um-admin-metabox">
|
14 |
+
<?php
|
15 |
+
UM()->admin_forms(
|
16 |
+
array(
|
17 |
+
'class' => 'um-form-login-customize um-top-label',
|
18 |
+
'prefix_id' => 'form',
|
19 |
+
'fields' => array(
|
20 |
+
array(
|
21 |
+
'id' => '_um_login_use_custom_settings',
|
22 |
+
'type' => 'select',
|
23 |
+
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
24 |
+
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
25 |
+
'value' => $use_custom_settings,
|
26 |
+
'options' => array(
|
27 |
+
0 => __( 'No', 'ultimate-member' ),
|
28 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
29 |
+
),
|
30 |
+
),
|
31 |
+
array(
|
32 |
+
'id' => '_um_login_template',
|
33 |
+
'type' => 'select',
|
34 |
+
'label' => __( 'Template', 'ultimate-member' ),
|
35 |
+
'value' => UM()->query()->get_meta_value( '_um_login_template', null, UM()->options()->get( 'login_template' ) ),
|
36 |
+
'options' => UM()->shortcodes()->get_templates( 'login' ),
|
37 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
38 |
+
),
|
39 |
+
array(
|
40 |
+
'id' => '_um_login_max_width',
|
41 |
+
'type' => 'text',
|
42 |
+
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
|
43 |
+
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
|
44 |
+
'value' => UM()->query()->get_meta_value( '_um_login_max_width', null, UM()->options()->get( 'login_max_width' ) ),
|
45 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
46 |
+
),
|
47 |
+
array(
|
48 |
+
'id' => '_um_login_icons',
|
49 |
+
'type' => 'select',
|
50 |
+
'label' => __( 'Field Icons', 'ultimate-member' ),
|
51 |
+
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
|
52 |
+
'value' => UM()->query()->get_meta_value( '_um_login_icons', null, UM()->options()->get( 'login_icons' ) ),
|
53 |
+
'options' => array(
|
54 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
55 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
56 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
57 |
+
),
|
58 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
59 |
+
),
|
60 |
+
array(
|
61 |
+
'id' => '_um_login_primary_btn_word',
|
62 |
+
'type' => 'text',
|
63 |
+
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
64 |
+
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
65 |
+
'value' => UM()->query()->get_meta_value( '_um_login_primary_btn_word', null, UM()->options()->get( 'login_primary_btn_word' ) ),
|
66 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
67 |
+
),
|
68 |
+
array(
|
69 |
+
'id' => '_um_login_secondary_btn',
|
70 |
+
'type' => 'select',
|
71 |
+
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
|
72 |
+
'value' => $login_secondary_btn,
|
73 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
74 |
+
'options' => array(
|
75 |
+
0 => __( 'No', 'ultimate-member' ),
|
76 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
77 |
+
),
|
78 |
+
),
|
79 |
+
array(
|
80 |
+
'id' => '_um_login_secondary_btn_word',
|
81 |
+
'type' => 'text',
|
82 |
+
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
|
83 |
+
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
84 |
+
'value' => UM()->query()->get_meta_value( '_um_login_secondary_btn_word', null, UM()->options()->get( 'login_secondary_btn_word' ) ),
|
85 |
+
'conditional' => array( '_um_login_secondary_btn', '=', 1 ),
|
86 |
+
),
|
87 |
+
array(
|
88 |
+
'id' => '_um_login_forgot_pass_link',
|
89 |
+
'type' => 'select',
|
90 |
+
'label' => __( 'Show Forgot Password Link?', 'ultimate-member' ),
|
91 |
+
'value' => $login_forgot_pass_link,
|
92 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
93 |
+
'options' => array(
|
94 |
+
0 => __( 'No', 'ultimate-member' ),
|
95 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
96 |
+
),
|
97 |
+
),
|
98 |
+
array(
|
99 |
+
'id' => '_um_login_show_rememberme',
|
100 |
+
'type' => 'select',
|
101 |
+
'label' => __( 'Show "Remember Me"?', 'ultimate-member' ),
|
102 |
+
'value' => $login_show_rememberme,
|
103 |
+
'conditional' => array( '_um_login_use_custom_settings', '=', 1 ),
|
104 |
+
'options' => array(
|
105 |
+
0 => __( 'No', 'ultimate-member' ),
|
106 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
107 |
+
),
|
108 |
+
),
|
109 |
+
),
|
110 |
+
)
|
111 |
+
)->render_form();
|
112 |
+
?>
|
113 |
+
<div class="um-admin-clear"></div>
|
114 |
+
</div>
|
includes/admin/templates/form/profile_customize.php
CHANGED
@@ -1,211 +1,225 @@
|
|
1 |
-
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
-
exit;
|
3 |
-
}
|
4 |
-
|
5 |
-
$
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
'
|
37 |
-
'
|
38 |
-
'
|
39 |
-
'
|
40 |
-
'
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
'
|
48 |
-
'
|
49 |
-
|
50 |
-
|
51 |
-
'
|
52 |
-
'
|
53 |
-
'
|
54 |
-
'
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
'
|
60 |
-
'
|
61 |
-
'
|
62 |
-
'
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
'
|
68 |
-
'
|
69 |
-
'
|
70 |
-
'
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
),
|
77 |
-
'
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
'
|
82 |
-
'
|
83 |
-
'
|
84 |
-
'
|
85 |
-
'
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
'
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
),
|
97 |
-
|
98 |
-
|
99 |
-
'
|
100 |
-
|
101 |
-
|
102 |
-
'
|
103 |
-
'
|
104 |
-
'
|
105 |
-
|
106 |
-
|
107 |
-
'
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
),
|
116 |
-
|
117 |
-
|
118 |
-
'
|
119 |
-
|
120 |
-
|
121 |
-
'
|
122 |
-
'
|
123 |
-
'
|
124 |
-
'
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
'
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
),
|
138 |
-
'conditional' => array( '_um_profile_cover_enabled', '=', 1 ),
|
139 |
-
),
|
140 |
-
array(
|
141 |
-
'id' => '
|
142 |
-
'type' => 'select',
|
143 |
-
'label' => __( '
|
144 |
-
'tooltip' => __( '
|
145 |
-
'value' => UM()->query()->get_meta_value( '
|
146 |
-
'
|
147 |
-
|
148 |
-
|
149 |
-
1 =>
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
'
|
156 |
-
'
|
157 |
-
'
|
158 |
-
'
|
159 |
-
'
|
160 |
-
),
|
161 |
-
array(
|
162 |
-
'id' => '_um_profile_photo_required',
|
163 |
-
'type' => 'select',
|
164 |
-
'label' => __( 'Make Profile Photo Required', 'ultimate-member' ),
|
165 |
-
'tooltip' => __( 'Require user to update a profile photo when updating their profile', 'ultimate-member' ),
|
166 |
-
'value' => UM()->query()->get_meta_value( '_um_profile_photo_required' ),
|
167 |
-
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
168 |
-
'options' => array(
|
169 |
-
0 => __( 'No', 'ultimate-member' ),
|
170 |
-
1 => __( 'Yes', 'ultimate-member' ),
|
171 |
-
),
|
172 |
-
),
|
173 |
-
array(
|
174 |
-
'id' => '_um_profile_show_name',
|
175 |
-
'type' => 'select',
|
176 |
-
'label' => __( 'Show display name in profile header?', 'ultimate-member' ),
|
177 |
-
'value' => UM()->query()->get_meta_value( '_um_profile_show_name', null, 1 ),
|
178 |
-
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
179 |
-
'options' => array(
|
180 |
-
0 => __( 'No', 'ultimate-member' ),
|
181 |
-
1 => __( 'Yes', 'ultimate-member' ),
|
182 |
-
),
|
183 |
-
),
|
184 |
-
array(
|
185 |
-
'id' => '_um_profile_show_social_links',
|
186 |
-
'type' => 'select',
|
187 |
-
'label' => __( 'Show social links in profile header?', 'ultimate-member' ),
|
188 |
-
'value' => UM()->query()->get_meta_value( '_um_profile_show_social_links', null, UM()->options()->get( 'profile_show_social_links' ) ),
|
189 |
-
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
190 |
-
'options' => array(
|
191 |
-
0 => __( 'No', 'ultimate-member' ),
|
192 |
-
1 => __( 'Yes', 'ultimate-member' ),
|
193 |
-
),
|
194 |
-
),
|
195 |
-
array(
|
196 |
-
'id' => '_um_profile_show_bio',
|
197 |
-
'type' => 'select',
|
198 |
-
'label' => __( 'Show user description in profile header?', 'ultimate-member' ),
|
199 |
-
'value' => UM()->query()->get_meta_value( '_um_profile_show_bio', null, 1 ),
|
200 |
-
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
201 |
-
'options' => array(
|
202 |
-
0 => __( 'No', 'ultimate-member' ),
|
203 |
-
1 => __( 'Yes', 'ultimate-member' ),
|
204 |
-
),
|
205 |
-
),
|
206 |
-
),
|
207 |
-
)
|
208 |
-
)->render_form();
|
209 |
-
?>
|
210 |
-
<div class="um-admin-clear"></div>
|
211 |
-
</div>
|
1 |
+
<?php if ( ! defined( 'ABSPATH' ) ) {
|
2 |
+
exit;
|
3 |
+
}
|
4 |
+
|
5 |
+
global $post_id;
|
6 |
+
|
7 |
+
$use_custom_settings = ! isset( $post_id ) ? false : get_post_meta( $post_id, '_um_profile_use_custom_settings', true );
|
8 |
+
|
9 |
+
$profile_role_array = array();
|
10 |
+
foreach ( UM()->roles()->get_roles() as $key => $value ) {
|
11 |
+
$_um_profile_role = UM()->query()->get_meta_value( '_um_profile_role', $key );
|
12 |
+
if ( ! empty( $_um_profile_role ) ) {
|
13 |
+
$profile_role_array[] = $_um_profile_role;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
$profile_secondary_btn = ! isset( $post_id ) ? UM()->options()->get( 'profile_secondary_btn' ) : get_post_meta( $post_id, '_um_profile_secondary_btn', true );
|
18 |
+
$profile_cover_enabled = ! isset( $post_id ) ? true : get_post_meta( $post_id, '_um_profile_cover_enabled', true );
|
19 |
+
$profile_disable_photo_upload = ! isset( $post_id ) ? UM()->options()->get( 'disable_profile_photo_upload' ) : get_post_meta( $post_id, '_um_profile_disable_photo_upload', true );
|
20 |
+
$profile_photo_required = ! isset( $post_id ) ? false : get_post_meta( $post_id, '_um_profile_photo_required', true );
|
21 |
+
$profile_show_name = ! isset( $post_id ) ? true : get_post_meta( $post_id, '_um_profile_show_name', true );
|
22 |
+
$profile_show_social_links = ! isset( $post_id ) ? UM()->options()->get( 'profile_show_social_links' ) : get_post_meta( $post_id, '_um_profile_show_social_links', true );
|
23 |
+
$profile_show_bio = ! isset( $post_id ) ? true : get_post_meta( $post_id, '_um_profile_show_bio', true );
|
24 |
+
|
25 |
+
?>
|
26 |
+
|
27 |
+
|
28 |
+
<div class="um-admin-metabox">
|
29 |
+
<?php
|
30 |
+
UM()->admin_forms(
|
31 |
+
array(
|
32 |
+
'class' => 'um-form-profile-customize um-top-label',
|
33 |
+
'prefix_id' => 'form',
|
34 |
+
'fields' => array(
|
35 |
+
array(
|
36 |
+
'id' => '_um_profile_use_custom_settings',
|
37 |
+
'type' => 'select',
|
38 |
+
'label' => __( 'Apply custom settings to this form', 'ultimate-member' ),
|
39 |
+
'tooltip' => __( 'Switch to yes if you want to customize this form settings, styling & appearance', 'ultimate-member' ),
|
40 |
+
'value' => $use_custom_settings,
|
41 |
+
'options' => array(
|
42 |
+
0 => __( 'No', 'ultimate-member' ),
|
43 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
44 |
+
),
|
45 |
+
),
|
46 |
+
array(
|
47 |
+
'id' => '_um_profile_role',
|
48 |
+
'type' => 'select',
|
49 |
+
'multi' => true,
|
50 |
+
'label' => __( 'Make this profile form role-specific', 'ultimate-member' ),
|
51 |
+
'tooltip' => __( 'Please note if you make a profile form specific to a role then you must make sure that every other role is assigned a profile form', 'ultimate-member' ),
|
52 |
+
'value' => $profile_role_array,
|
53 |
+
'options' => UM()->roles()->get_roles(),
|
54 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
55 |
+
),
|
56 |
+
array(
|
57 |
+
'id' => '_um_profile_template',
|
58 |
+
'type' => 'select',
|
59 |
+
'label' => __( 'Template', 'ultimate-member' ),
|
60 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_template', null, UM()->options()->get( 'profile_template' ) ),
|
61 |
+
'options' => UM()->shortcodes()->get_templates( 'profile' ),
|
62 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
63 |
+
),
|
64 |
+
array(
|
65 |
+
'id' => '_um_profile_max_width',
|
66 |
+
'type' => 'text',
|
67 |
+
'label' => __( 'Max. Width (px)', 'ultimate-member' ),
|
68 |
+
'tooltip' => __( 'The maximum width of shortcode in pixels e.g. 600px', 'ultimate-member' ),
|
69 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_max_width', null, UM()->options()->get( 'profile_max_width' ) ),
|
70 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
71 |
+
),
|
72 |
+
array(
|
73 |
+
'id' => '_um_profile_area_max_width',
|
74 |
+
'type' => 'text',
|
75 |
+
'label' => __( 'Profile Area Max. Width (px)', 'ultimate-member' ),
|
76 |
+
'tooltip' => __( 'The maximum width of the profile area inside profile (below profile header)', 'ultimate-member' ),
|
77 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_area_max_width', null, UM()->options()->get( 'profile_area_max_width' ) ),
|
78 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
79 |
+
),
|
80 |
+
array(
|
81 |
+
'id' => '_um_profile_icons',
|
82 |
+
'type' => 'select',
|
83 |
+
'label' => __( 'Field Icons', 'ultimate-member' ),
|
84 |
+
'tooltip' => __( 'Whether to show field icons and where to show them relative to the field', 'ultimate-member' ),
|
85 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_icons', null, UM()->options()->get( 'profile_icons' ) ),
|
86 |
+
'options' => array(
|
87 |
+
'field' => __( 'Show inside text field', 'ultimate-member' ),
|
88 |
+
'label' => __( 'Show with label', 'ultimate-member' ),
|
89 |
+
'off' => __( 'Turn off', 'ultimate-member' ),
|
90 |
+
),
|
91 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
92 |
+
),
|
93 |
+
array(
|
94 |
+
'id' => '_um_profile_primary_btn_word',
|
95 |
+
'type' => 'text',
|
96 |
+
'label' => __( 'Primary Button Text', 'ultimate-member' ),
|
97 |
+
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
98 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_primary_btn_word', null, UM()->options()->get( 'profile_primary_btn_word' ) ),
|
99 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
100 |
+
),
|
101 |
+
array(
|
102 |
+
'id' => '_um_profile_secondary_btn',
|
103 |
+
'type' => 'select',
|
104 |
+
'label' => __( 'Show Secondary Button', 'ultimate-member' ),
|
105 |
+
'value' => $profile_secondary_btn,
|
106 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
107 |
+
'options' => array(
|
108 |
+
0 => __( 'No', 'ultimate-member' ),
|
109 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
110 |
+
),
|
111 |
+
),
|
112 |
+
array(
|
113 |
+
'id' => '_um_profile_secondary_btn_word',
|
114 |
+
'type' => 'text',
|
115 |
+
'label' => __( 'Secondary Button Text', 'ultimate-member' ),
|
116 |
+
'tooltip' => __( 'Customize the button text', 'ultimate-member' ),
|
117 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_secondary_btn_word', null, UM()->options()->get( 'profile_secondary_btn_word' ) ),
|
118 |
+
'conditional' => array( '_um_profile_secondary_btn', '=', 1 ),
|
119 |
+
),
|
120 |
+
array(
|
121 |
+
'id' => '_um_profile_cover_enabled',
|
122 |
+
'type' => 'select',
|
123 |
+
'label' => __( 'Enable Cover Photos', 'ultimate-member' ),
|
124 |
+
'value' => $profile_cover_enabled,
|
125 |
+
'conditional' => array( '_um_profile_use_custom_settings', '=', 1 ),
|
126 |
+
'options' => array(
|
127 |
+
0 => __( 'No', 'ultimate-member' ),
|
128 |
+
1 => __( 'Yes', 'ultimate-member' ),
|
129 |
+
),
|
130 |
+
),
|
131 |
+
array(
|
132 |
+
'id' => '_um_profile_coversize',
|
133 |
+
'type' => 'select',
|
134 |
+
'label' => __( 'Cover Photo Size', 'ultimate-member' ),
|
135 |
+
'tooltip' => __( 'Set the profile photo size in pixels here', 'ultimate-member' ),
|
136 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_coversize', null, UM()->options()->get( 'profile_coversize' ) ),
|
137 |
+
'options' => UM()->files()->get_profile_photo_size( 'cover_thumb_sizes' ),
|
138 |
+
'conditional' => array( '_um_profile_cover_enabled', '=', 1 ),
|
139 |
+
),
|
140 |
+
array(
|
141 |
+
'id' => '_um_profile_cover_ratio',
|
142 |
+
'type' => 'select',
|
143 |
+
'label' => __( 'Cover photo ratio', 'ultimate-member' ),
|
144 |
+
'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here', 'ultimate-member' ),
|
145 |
+
'value' => UM()->query()->get_meta_value( '_um_profile_cover_ratio', null, UM()->options()->get( 'profile_cover_ratio' ) ),
|
146 |
+
'options' => array(
|
147 |
+
'1.6:1' => '1.6:1',
|
148 |
+
'2.7:1' => '2.7:1',
|
149 |
+
'2.2:1' => '2.2:1',
|
150 |
+
'3.2:1' => '3.2:1',
|
151 |
+
),
|
152 |
+
'conditional' => array( '_um_profile_cover_enabled', '=', 1 ),
|
153 |
+
),
|
154 |
+
array(
|
155 |
+
'id' => '_um_profile_disable_photo_upload',
|
156 |
+
'type' => 'select',
|
157 |
+
'label' => __( 'Disable Profile Photo Upload', 'ultimate-member' ),
|
158 |
+
'tooltip' => __( 'Switch on/off the profile photo uploader', 'ultimate-member' ),
|
159 |
+
'value' => $profile_disable_photo_upl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|