Ultimate Member – User Profile & Membership Plugin - Version 1.3.14

Version Description

Download this release

Release Info

Developer ultimatemember
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 1.3.14
Comparing to
See all releases

Code changes from version 1.3.13 to 1.3.14

admin/core/um-admin-notices.php CHANGED
@@ -38,7 +38,7 @@ class UM_Admin_Notices {
38
*** @show main notices
39
***/
40
function main_notices(){
41
-
42
$hide_register_notice = get_option('um_can_register_notice');
43
44
if ( !get_option('users_can_register') && !$hide_register_notice ) {
@@ -63,6 +63,40 @@ class UM_Admin_Notices {
63
64
}
65
66
}
67
68
38
*** @show main notices
39
***/
40
function main_notices(){
41
+ global $ultimatemember;
42
$hide_register_notice = get_option('um_can_register_notice');
43
44
if ( !get_option('users_can_register') && !$hide_register_notice ) {
63
64
}
65
66
+ // Regarding page setup
67
+ $pages = $ultimatemember->permalinks->core;
68
+ if ( $pages && is_array( $pages ) ) {
69
+
70
+ $err = false;
71
+ foreach( $pages as $slug => $page_id ) {
72
+
73
+ $page = get_post( $page_id );
74
+ if ( !isset( $page->ID ) ) {
75
+ $err = true;
76
+ }
77
+
78
+ }
79
+
80
+ if ( $err ) {
81
+ echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit <strong>Ultimate Member > Settings</strong> to re-assign your missing pages.','ultimatemember') . '</p></div>';
82
+ }
83
+
84
+ if ( isset( $pages['user'] ) ) {
85
+ $test = get_post( $pages['user'] );
86
+ if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
87
+ echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimatemember') . '</p></div>';
88
+ }
89
+ }
90
+
91
+ if ( isset( $pages['account'] ) ) {
92
+ $test = get_post( $pages['account'] );
93
+ if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
94
+ echo '<div class="updated" style="border-color: #3ba1da;"><p>' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimatemember') . '</p></div>';
95
+ }
96
+ }
97
+
98
+ }
99
+
100
}
101
102
admin/core/um-admin-users.php CHANGED
@@ -48,17 +48,13 @@ class UM_Admin_Users {
48
*** @sort users by newest first
49
***/
50
function sort_by_newest( $query ){
51
- global $pagenow;
52
53
if ( is_admin() && $pagenow == 'users.php' ) {
54
-
55
- global $wpdb;
56
-
57
if (!isset($_REQUEST['orderby'])) {
58
$query->query_vars["order"] = 'desc';
59
$query->query_orderby = " ORDER BY user_registered ".($query->query_vars["order"] == "desc" ? "desc " : "asc ");//set sort order
60
}
61
-
62
}
63
64
return $query;
@@ -69,14 +65,11 @@ class UM_Admin_Users {
69
*** @custom users filter
70
***/
71
function custom_users_filter( $query ){
72
- global $pagenow;
73
74
if ( is_admin() && $pagenow=='users.php' && isset($_GET[ $this->custom_role ]) && $_GET[ $this->custom_role ] != '') {
75
76
- $role = urldecode($_GET[ $this->custom_role ]);
77
-
78
- global $wpdb;
79
-
80
$query->query_where =
81
str_replace('WHERE 1=1',
82
"WHERE 1=1 AND {$wpdb->users}.ID IN (
@@ -91,16 +84,12 @@ class UM_Admin_Users {
91
if ( is_admin() && $pagenow=='users.php' && isset($_GET[ 'status' ]) && $_GET[ 'status' ] != '') {
92
93
$status = urldecode($_GET[ 'status' ]);
94
-
95
- global $wpdb;
96
-
97
- $query->query_where =
98
- str_replace('WHERE 1=1',
99
- "WHERE 1=1 AND {$wpdb->users}.ID IN (
100
- SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
101
- WHERE {$wpdb->usermeta}.meta_key = 'account_status'
102
- AND {$wpdb->usermeta}.meta_value = '{$status}')",
103
- $query->query_where
104
);
105
106
}
@@ -130,9 +119,11 @@ class UM_Admin_Users {
130
'awaiting_admin_review' => __('Pending review','ultimatemember'),
131
'awaiting_email_confirmation' => __('Waiting e-mail confirmation','ultimatemember'),
132
'inactive' => __('Inactive','ultimatemember'),
133
- 'rejected' => __('Rejected','ultimatemember'),
134
);
135
136
foreach( $status as $k => $v ) {
137
if ( isset($_REQUEST['status']) && $_REQUEST['status'] == $k ) {
138
$current = 'class="current"';
@@ -270,7 +261,7 @@ class UM_Admin_Users {
270
<?php
271
$roles = $ultimatemember->query->get_roles();
272
foreach( $roles as $role => $role_name ) { ?>
273
- <option value="<?php echo $role; ?>"><?php echo $role_name; ?></option>
274
<?php } ?>
275
</select>
276
48
*** @sort users by newest first
49
***/
50
function sort_by_newest( $query ){
51
+ global $wpdb, $pagenow;
52
53
if ( is_admin() && $pagenow == 'users.php' ) {
54
if (!isset($_REQUEST['orderby'])) {
55
$query->query_vars["order"] = 'desc';
56
$query->query_orderby = " ORDER BY user_registered ".($query->query_vars["order"] == "desc" ? "desc " : "asc ");//set sort order
57
}
58
}
59
60
return $query;
65
*** @custom users filter
66
***/
67
function custom_users_filter( $query ){
68
+ global $wpdb, $pagenow;
69
70
if ( is_admin() && $pagenow=='users.php' && isset($_GET[ $this->custom_role ]) && $_GET[ $this->custom_role ] != '') {
71
72
+ $role = $_GET[ $this->custom_role ];
73
$query->query_where =
74
str_replace('WHERE 1=1',
75
"WHERE 1=1 AND {$wpdb->users}.ID IN (
84
if ( is_admin() && $pagenow=='users.php' && isset($_GET[ 'status' ]) && $_GET[ 'status' ] != '') {
85
86
$status = urldecode($_GET[ 'status' ]);
87
+ $query->query_where = str_replace('WHERE 1=1',
88
+ "WHERE 1=1 AND {$wpdb->users}.ID IN (
89
+ SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
90
+ WHERE {$wpdb->usermeta}.meta_key = 'account_status'
91
+ AND {$wpdb->usermeta}.meta_value = '{$status}')",
92
+ $query->query_where
93
);
94
95
}
119
'awaiting_admin_review' => __('Pending review','ultimatemember'),
120
'awaiting_email_confirmation' => __('Waiting e-mail confirmation','ultimatemember'),
121
'inactive' => __('Inactive','ultimatemember'),
122
+ 'rejected' => __('Rejected','ultimatemember')
123
);
124
125
+ $ultimatemember->query->count_users_by_status( 'unassigned' );
126
+
127
foreach( $status as $k => $v ) {
128
if ( isset($_REQUEST['status']) && $_REQUEST['status'] == $k ) {
129
$current = 'class="current"';
261
<?php
262
$roles = $ultimatemember->query->get_roles();
263
foreach( $roles as $role => $role_name ) { ?>
264
+ <option value="<?php echo urlencode( $role ); ?>"><?php echo $role_name; ?></option>
265
<?php } ?>
266
</select>
267
admin/templates/directory/general.php CHANGED
@@ -51,13 +51,13 @@
51
<span class="um-admin-half">
52
53
<select name="_um_sortby" id="_um_sortby" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
54
- <option value="user_registered_desc" <?php selected('user_registered_desc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>New users first</option>
55
- <option value="user_registered_asc" <?php selected('user_registered_asc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>Old users first</option>
56
- <option value="display_name" <?php selected('display_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>Display Name</option>
57
- <option value="first_name" <?php selected('first_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>First Name</option>
58
- <option value="last_name" <?php selected('last_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>Last Name</option>
59
- <option value="random" <?php selected('random', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>Random</option>
60
- <option value="other" <?php selected('other', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>>Other (custom field)</option>
61
<?php do_action('um_admin_directory_sort_users_select', '_um_sortby'); ?>
62
</select>
63
51
<span class="um-admin-half">
52
53
<select name="_um_sortby" id="_um_sortby" class="umaf-selectjs um-adm-conditional" style="width: 300px" data-cond1='other' data-cond1-show='custom-field'>
54
+ <option value="user_registered_desc" <?php selected('user_registered_desc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('New users first','ultimatemember'); ?></option>
55
+ <option value="user_registered_asc" <?php selected('user_registered_asc', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Old users first','ultimatemember'); ?></option>
56
+ <option value="last_login" <?php selected('last_login', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Last login','ultimatemember'); ?></option>
57
+ <option value="display_name" <?php selected('display_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Display Name','ultimatemember'); ?></option>
58
+ <option value="first_name" <?php selected('first_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('First Name','ultimatemember'); ?></option>
59
+ <option value="last_name" <?php selected('last_name', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Last Name','ultimatemember'); ?></option>
60
+ <option value="other" <?php selected('other', $ultimatemember->query->get_meta_value('_um_sortby') ); ?>><?php _e('Other (custom field)','ultimatemember'); ?></option>
61
<?php do_action('um_admin_directory_sort_users_select', '_um_sortby'); ?>
62
</select>
63
assets/css/um.rtl.css CHANGED
@@ -67,6 +67,23 @@ div.uimob800 .um-header .um-profile-meta {
67
margin-left: 10px;
68
}
69
70
.um-field-label .um-field-label-icon {
71
float: right;
72
margin: 0 0 0 8px;
67
margin-left: 10px;
68
}
69
70
+ .um-account-side li a span.um-account-icon,
71
+ .um-account-side li a.current span.um-account-icon,
72
+ .um-account-side li a.current:hover span.um-account-icon {
73
+ float: right;
74
+ border-left: 1px solid #ccc;
75
+ }
76
+
77
+ .um-account-side li a span.um-account-title {
78
+ padding-right: 20px;
79
+ float: right;
80
+ }
81
+
82
+ .um-account-side li a span.um-account-arrow {
83
+ right: auto;
84
+ left: 10px;
85
+ }
86
+
87
.um-field-label .um-field-label-icon {
88
float: right;
89
margin: 0 0 0 8px;
assets/dynamic_css/dynamic_global.php CHANGED
@@ -86,17 +86,24 @@ print ".um-$form_id.um {
86
}
87
88
if ( $primary_btn_color ) {
89
print ".um-$form_id.um input[type=submit]:disabled:hover {
90
background: $primary_btn_color;
91
}";
92
print ".um-$form_id.um input[type=submit].um-button,
93
.um-$form_id.um input[type=submit].um-button:focus,
94
- .um-$form_id.um a.um-button {
95
background: $primary_btn_color;
96
}";
97
print ".um-$form_id.um a.um-link {
98
color: $primary_btn_color;
99
}";
100
}
101
102
if ( $primary_btn_hover ) {
86
}
87
88
if ( $primary_btn_color ) {
89
+
90
print ".um-$form_id.um input[type=submit]:disabled:hover {
91
background: $primary_btn_color;
92
}";
93
+
94
print ".um-$form_id.um input[type=submit].um-button,
95
.um-$form_id.um input[type=submit].um-button:focus,
96
+ .um-$form_id.um a.um-button,
97
+ .um-$form_id.um a.um-button.um-disabled:hover,
98
+ .um-$form_id.um a.um-button.um-disabled:focus,
99
+ .um-$form_id.um a.um-button.um-disabled:active {
100
background: $primary_btn_color;
101
}";
102
+
103
print ".um-$form_id.um a.um-link {
104
color: $primary_btn_color;
105
}";
106
+
107
}
108
109
if ( $primary_btn_hover ) {
core/um-actions-account.php CHANGED
@@ -404,7 +404,7 @@
404
405
<span class="um-account-icon uimob800-hide"><i class="<?php echo $icon; ?>"></i></span>
406
<span class="um-account-title uimob800-hide"><?php echo $title; ?></span>
407
- <span class="um-account-arrow uimob800-hide"><i class="um-faicon-angle-right"></i></span>
408
</a>
409
</li>
410
404
405
<span class="um-account-icon uimob800-hide"><i class="<?php echo $icon; ?>"></i></span>
406
<span class="um-account-title uimob800-hide"><?php echo $title; ?></span>
407
+ <span class="um-account-arrow uimob800-hide"><?php echo ( is_rtl() ) ? '<i class="um-faicon-angle-left"></i>' : '<i class="um-faicon-angle-right"></i>'; ?></span>
408
</a>
409
</li>
410
core/um-actions-core.php CHANGED
@@ -80,16 +80,4 @@
80
break;
81
82
}
83
- }
84
-
85
- /***
86
- *** @prevent moving core posts to trash
87
- ***/
88
- add_action('wp_trash_post','um_core_posts_delete');
89
- function um_core_posts_delete($post_id){
90
- global $ultimatemember;
91
- if ( $ultimatemember->query->is_core($post_id) ) {
92
- wp_die('This is a core functionality of Ultimate Member and cannot be deleted!');
93
- }
94
-
95
}
80
break;
81
82
}
83
}
core/um-actions-form.php CHANGED
@@ -163,6 +163,10 @@
163
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
164
}
165
166
if ( $key == 'role_select' || $key == 'role_radio' ) {
167
if ( isset( $array['required'] ) && $array['required'] == 1 && ( !isset( $args['role'] ) || empty( $args['role'] ) ) ) {
168
$ultimatemember->form->add_error('role', __('Please specify account type.','ultimatemember') );
@@ -171,198 +175,204 @@
171
172
if ( isset( $args[$key] ) ) {
173
174
- if ( isset( $array['required'] ) && $array['required'] == 1 ) {
175
- if ( !isset($args[$key]) || $args[$key] == '' ) {
176
- $ultimatemember->form->add_error($key, sprintf( __('%s is required','ultimatemember'), $array['label'] ) );
177
}
178
- }
179
-
180
- if ( isset( $array['max_words'] ) && $array['max_words'] > 0 ) {
181
- if ( str_word_count( $args[$key] ) > $array['max_words'] ) {
182
- $ultimatemember->form->add_error($key, sprintf(__('You are only allowed to enter a maximum of %s words','ultimatemember'), $array['max_words']) );
183
}
184
- }
185
-
186
- if ( isset( $array['min_chars'] ) && $array['min_chars'] > 0 ) {
187
- if ( $args[$key] && strlen( utf8_decode( $args[$key] ) ) < $array['min_chars'] ) {
188
- $ultimatemember->form->add_error($key, sprintf(__('Your %s must contain at least %s characters','ultimatemember'), $array['label'], $array['min_chars']) );
189
- }
190
- }
191
-
192
- if ( isset( $array['max_chars'] ) && $array['max_chars'] > 0 ) {
193
- if ( $args[$key] && strlen( utf8_decode( $args[$key] ) ) > $array['max_chars'] ) {
194
- $ultimatemember->form->add_error($key, sprintf(__('Your %s must contain less than %s characters','ultimatemember'), $array['label'], $array['max_chars']) );
195
}
196
- }
197
-
198
- if ( isset( $array['html'] ) && $array['html'] == 0 ) {
199
- if ( wp_strip_all_tags( $args[$key] ) != $args[$key] ) {
200
- $ultimatemember->form->add_error($key, __('You can not use HTML tags here','ultimatemember') );
201
}
202
- }
203
-
204
- if ( isset( $array['force_good_pass'] ) && $array['force_good_pass'] == 1 ) {
205
- if ( !$ultimatemember->validation->strong_pass( $args[$key] ) ) {
206
- $ultimatemember->form->add_error($key, __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimatemember') );
207
}
208
- }
209
-
210
- if ( isset( $array['force_confirm_pass'] ) && $array['force_confirm_pass'] == 1 ) {
211
- if ( $args[ 'confirm_' . $key] == '' && !$ultimatemember->form->has_error($key) ) {
212
- $ultimatemember->form->add_error( 'confirm_' . $key , __('Please confirm your password','ultimatemember') );
213
}
214
- if ( $args[ 'confirm_' . $key] != $args[$key] && !$ultimatemember->form->has_error($key) ) {
215
- $ultimatemember->form->add_error( 'confirm_' . $key , __('Your passwords do not match','ultimatemember') );
216
}
217
- }
218
-
219
- if ( isset( $array['min_selections'] ) && $array['min_selections'] > 0 ) {
220
- if ( ( !isset($args[$key]) ) || ( isset( $args[$key] ) && is_array($args[$key]) && count( $args[$key] ) < $array['min_selections'] ) ) {
221
- $ultimatemember->form->add_error($key, sprintf(__('Please select at least %s choices','ultimatemember'), $array['min_selections'] ) );
222
}
223
- }
224
-
225
- if ( isset( $array['max_selections'] ) && $array['max_selections'] > 0 ) {
226
- if ( isset( $args[$key] ) && is_array($args[$key]) && count( $args[$key] ) > $array['max_selections'] ) {
227
- $ultimatemember->form->add_error($key, sprintf(__('You can only select up to %s choices','ultimatemember'), $array['max_selections'] ) );
228
}
229
- }
230
-
231
- if ( isset( $array['validate'] ) && !empty( $array['validate'] ) ) {
232
-
233
- switch( $array['validate'] ) {
234
235
- case 'custom':
236
- $custom = $array['custom_validate'];
237
- do_action("um_custom_field_validation_{$custom}", $key, $array, $args );
238
- break;
239
-
240
- case 'numeric':
241
- if ( $args[$key] && !is_numeric( $args[$key] ) ) {
242
- $ultimatemember->form->add_error($key, __('Please enter numbers only in this field','ultimatemember') );
243
- }
244
- break;
245
-
246
- case 'phone_number':
247
- if ( !$ultimatemember->validation->is_phone_number( $args[$key] ) ) {
248
- $ultimatemember->form->add_error($key, __('Please enter a valid phone number','ultimatemember') );
249
- }
250
- break;
251
-
252
- case 'youtube_url':
253
- if ( !$ultimatemember->validation->is_url( $args[$key], 'youtube.com' ) ) {
254
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
255
- }
256
- break;
257
-
258
- case 'soundcloud_url':
259
- if ( !$ultimatemember->validation->is_url( $args[$key], 'soundcloud.com' ) ) {
260
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
261
- }
262
- break;
263
-
264
- case 'facebook_url':
265
- if ( !$ultimatemember->validation->is_url( $args[$key], 'facebook.com' ) ) {
266
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
267
- }
268
- break;
269
-
270
- case 'twitter_url':
271
- if ( !$ultimatemember->validation->is_url( $args[$key], 'twitter.com' ) ) {
272
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
273
- }
274
- break;
275
276
- case 'instagram_url':
277
- if ( !$ultimatemember->validation->is_url( $args[$key], 'instagram.com' ) ) {
278
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
279
- }
280
- break;
281
-
282
- case 'google_url':
283
- if ( !$ultimatemember->validation->is_url( $args[$key], 'plus.google.com' ) ) {
284
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
285
- }
286
- break;
287
-
288
- case 'linkedin_url':
289
- if ( !$ultimatemember->validation->is_url( $args[$key], 'linkedin.com' ) ) {
290
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
291
- }
292
- break;
293
-
294
- case 'skype':
295
- if ( !$ultimatemember->validation->is_url( $args[$key], 'skype.com' ) ) {
296
- $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
297
- }
298
- break;
299
-
300
- case 'unique_username':
301
-
302
- if ( $args[$key] == '' ) {
303
- $ultimatemember->form->add_error($key, __('You must provide a username','ultimatemember') );
304
- } else if ( $mode == 'register' && username_exists( sanitize_user( $args[$key] ) ) ) {
305
- $ultimatemember->form->add_error($key, __('Your username is already taken','ultimatemember') );
306
- } else if ( is_email( $args[$key] ) ) {
307
- $ultimatemember->form->add_error($key, __('Username cannot be an email','ultimatemember') );
308
- } else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
309
- $ultimatemember->form->add_error($key, __('Your username contains invalid characters','ultimatemember') );
310
- }
311
-
312
- break;
313
-
314
- case 'unique_username_or_email':
315
-
316
- if ( $args[$key] == '' ) {
317
- $ultimatemember->form->add_error($key, __('You must provide a username','ultimatemember') );
318
- } else if ( $mode == 'register' && username_exists( sanitize_user( $args[$key] ) ) ) {
319
- $ultimatemember->form->add_error($key, __('Your username is already taken','ultimatemember') );
320
- } else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
321
- $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
322
- } else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
323
- $ultimatemember->form->add_error($key, __('Your username contains invalid characters','ultimatemember') );
324
- }
325
-
326
- break;
327
-
328
- case 'unique_email':
329
-
330
- if ( in_array( $key, array('user_email') ) ) {
331
332
- if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
333
- $ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
334
} else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
335
- $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
336
- } else if ( !is_email( $args[$key] ) ) {
337
- $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
338
} else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
339
- $ultimatemember->form->add_error($key, __('Your email contains invalid characters','ultimatemember') );
340
}
341
-
342
- } else {
343
-
344
- if ( $args[$key] != '' && !is_email($args[$key]) ) {
345
- $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
346
- } else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
347
- $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
348
}
349
350
- }
351
-
352
- break;
353
-
354
}
355
-
356
- }
357
358
- }
359
360
- if ( isset( $args['description'] ) ) {
361
- $max_chars = um_get_option('profile_bio_maxchars');
362
- if ( strlen( utf8_decode( $args['description'] ) ) > $max_chars && $max_chars ) {
363
- $ultimatemember->form->add_error('description', sprintf(__('Your user description must contain less than %s characters','ultimatemember'), $max_chars ) );
364
}
365
- }
366
367
} // end if ( isset in args array )
368
163
$ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
164
}
165
166
+ if ( isset( $array['type'] ) && $array['type'] == 'multiselect' && isset( $array['required'] ) && $array['required'] == 1 && !isset( $args[$key] ) && !in_array($key, array('role_radio','role_select') ) ) {
167
+ $ultimatemember->form->add_error($key, sprintf(__('%s is required.','ultimatemember'), $array['title'] ) );
168
+ }
169
+
170
if ( $key == 'role_select' || $key == 'role_radio' ) {
171
if ( isset( $array['required'] ) && $array['required'] == 1 && ( !isset( $args['role'] ) || empty( $args['role'] ) ) ) {
172
$ultimatemember->form->add_error('role', __('Please specify account type.','ultimatemember') );
175
176
if ( isset( $args[$key] ) ) {
177
178
+ if ( isset( $array['required'] ) && $array['required'] == 1 ) {
179
+ if ( !isset($args[$key]) || $args[$key] == '' ) {
180
+ $ultimatemember->form->add_error($key, sprintf( __('%s is required','ultimatemember'), $array['label'] ) );
181
+ }
182
}
183
+
184
+ if ( isset( $array['max_words'] ) && $array['max_words'] > 0 ) {
185
+ if ( str_word_count( $args[$key] ) > $array['max_words'] ) {
186
+ $ultimatemember->form->add_error($key, sprintf(__('You are only allowed to enter a maximum of %s words','ultimatemember'), $array['max_words']) );
187
+ }
188
}
189
+
190
+ if ( isset( $array['min_chars'] ) && $array['min_chars'] > 0 ) {
191
+ if ( $args[$key] && strlen( utf8_decode( $args[$key] ) ) < $array['min_chars'] ) {
192
+ $ultimatemember->form->add_error($key, sprintf(__('Your %s must contain at least %s characters','ultimatemember'), $array['label'], $array['min_chars']) );
193
+ }
194
}
195
+
196
+ if ( isset( $array['max_chars'] ) && $array['max_chars'] > 0 ) {
197
+ if ( $args[$key] && strlen( utf8_decode( $args[$key] ) ) > $array['max_chars'] ) {
198
+ $ultimatemember->form->add_error($key, sprintf(__('Your %s must contain less than %s characters','ultimatemember'), $array['label'], $array['max_chars']) );
199
+ }
200
}
201
+
202
+ if ( isset( $array['html'] ) && $array['html'] == 0 ) {
203
+ if ( wp_strip_all_tags( $args[$key] ) != trim( $args[$key] ) ) {
204
+ $ultimatemember->form->add_error($key, __('You can not use HTML tags here','ultimatemember') );
205
+ }
206
}
207
+
208
+ if ( isset( $array['force_good_pass'] ) && $array['force_good_pass'] == 1 ) {
209
+ if ( !$ultimatemember->validation->strong_pass( $args[$key] ) ) {
210
+ $ultimatemember->form->add_error($key, __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimatemember') );
211
+ }
212
}
213
+
214
+ if ( isset( $array['force_confirm_pass'] ) && $array['force_confirm_pass'] == 1 ) {
215
+ if ( $args[ 'confirm_' . $key] == '' && !$ultimatemember->form->has_error($key) ) {
216
+ $ultimatemember->form->add_error( 'confirm_' . $key , __('Please confirm your password','ultimatemember') );
217
+ }
218
+ if ( $args[ 'confirm_' . $key] != $args[$key] && !$ultimatemember->form->has_error($key) ) {
219
+ $ultimatemember->form->add_error( 'confirm_' . $key , __('Your passwords do not match','ultimatemember') );
220
+ }
221
}
222
+
223
+ if ( isset( $array['min_selections'] ) && $array['min_selections'] > 0 ) {
224
+ if ( ( !isset($args[$key]) ) || ( isset( $args[$key] ) && is_array($args[$key]) && count( $args[$key] ) < $array['min_selections'] ) ) {
225
+ $ultimatemember->form->add_error($key, sprintf(__('Please select at least %s choices','ultimatemember'), $array['min_selections'] ) );
226
+ }
227
}
228
+
229
+ if ( isset( $array['max_selections'] ) && $array['max_selections'] > 0 ) {
230
+ if ( isset( $args[$key] ) && is_array($args[$key]) && count( $args[$key] ) > $array['max_selections'] ) {
231
+ $ultimatemember->form->add_error($key, sprintf(__('You can only select up to %s choices','ultimatemember'), $array['max_selections'] ) );
232
+ }
233
}
234
235
+ if ( isset( $array['validate'] ) && !empty( $array['validate'] ) ) {
236
+
237
+ switch( $array['validate'] ) {
238
+
239
+ case 'custom':
240
+ $custom = $array['custom_validate'];
241
+ do_action("um_custom_field_validation_{$custom}", $key, $array, $args );
242
+ break;
243
+
244
+ case 'numeric':
245
+ if ( $args[$key] && !is_numeric( $args[$key] ) ) {
246
+ $ultimatemember->form->add_error($key, __('Please enter numbers only in this field','ultimatemember') );
247
+ }
248
+ break;
249
+
250
+ case 'phone_number':
251
+ if ( !$ultimatemember->validation->is_phone_number( $args[$key] ) ) {
252
+ $ultimatemember->form->add_error($key, __('Please enter a valid phone number','ultimatemember') );
253
+ }
254
+ break;
255
+
256
+ case 'youtube_url':
257
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'youtube.com' ) ) {
258
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
259
+ }
260
+ break;
261
+
262
+ case 'soundcloud_url':
263
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'soundcloud.com' ) ) {
264
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
265
+ }
266
+ break;
267
+
268
+ case 'facebook_url':
269
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'facebook.com' ) ) {
270
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
271
+ }
272
+ break;
273
+
274
+ case 'twitter_url':
275
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'twitter.com' ) ) {
276
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
277
+ }
278
+ break;
279
280
+ case 'instagram_url':
281
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'instagram.com' ) ) {
282
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
283
+ }
284
+ break;
285
+
286
+ case 'google_url':
287
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'plus.google.com' ) ) {
288
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
289
+ }
290
+ break;
291
+
292
+ case 'linkedin_url':
293
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'linkedin.com' ) ) {
294
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
295
+ }
296
+ break;
297
+
298
+ case 'url':
299
+ if ( !$ultimatemember->validation->is_url( $args[$key] ) ) {
300
+ $ultimatemember->form->add_error($key, __('Please enter a valid URL','ultimatemember') );
301
+ }
302
+ break;
303
+
304
+ case 'skype':
305
+ if ( !$ultimatemember->validation->is_url( $args[$key], 'skype.com' ) ) {
306
+ $ultimatemember->form->add_error($key, sprintf(__('Please enter a valid %s username or profile URL','ultimatemember'), $array['label'] ) );
307
+ }
308
+ break;
309
+
310
+ case 'unique_username':
311
+
312
+ if ( $args[$key] == '' ) {
313
+ $ultimatemember->form->add_error($key, __('You must provide a username','ultimatemember') );
314
+ } else if ( $mode == 'register' && username_exists( sanitize_user( $args[$key] ) ) ) {
315
+ $ultimatemember->form->add_error($key, __('Your username is already taken','ultimatemember') );
316
+ } else if ( is_email( $args[$key] ) ) {
317
+ $ultimatemember->form->add_error($key, __('Username cannot be an email','ultimatemember') );
318
+ } else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
319
+ $ultimatemember->form->add_error($key, __('Your username contains invalid characters','ultimatemember') );
320
+ }
321
+
322
+ break;
323
+
324
+ case 'unique_username_or_email':
325
326
+ if ( $args[$key] == '' ) {
327
+ $ultimatemember->form->add_error($key, __('You must provide a username','ultimatemember') );
328
+ } else if ( $mode == 'register' && username_exists( sanitize_user( $args[$key] ) ) ) {
329
+ $ultimatemember->form->add_error($key, __('Your username is already taken','ultimatemember') );
330
} else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
331
+ $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
332
} else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
333
+ $ultimatemember->form->add_error($key, __('Your username contains invalid characters','ultimatemember') );
334
}
335
+
336
+ break;
337
+
338
+ case 'unique_email':
339
+
340
+ if ( in_array( $key, array('user_email') ) ) {
341
+
342
+ if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
343
+ $ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
344
+ } else if ( $mode == 'register' && email_exists( $args[$key] ) ) {
345
+ $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
346
+ } else if ( !is_email( $args[$key] ) ) {
347
+ $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
348
+ } else if ( !$ultimatemember->validation->safe_username( $args[$key] ) ) {
349
+ $ultimatemember->form->add_error($key, __('Your email contains invalid characters','ultimatemember') );
350
+ }
351
+
352
+ } else {
353
+
354
+ if ( $args[$key] != '' && !is_email($args[$key]) ) {
355
+ $ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
356
+ } else if ( $args[$key] != '' && email_exists( $args[$key] ) ) {
357
+ $ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
358
+ }
359
+
360
}
361
362
+ break;
363
+
364
+ }
365
+
366
}
367
368
+ }
369
370
+ if ( isset( $args['description'] ) ) {
371
+ $max_chars = um_get_option('profile_bio_maxchars');
372
+ if ( strlen( utf8_decode( $args['description'] ) ) > $max_chars && $max_chars ) {
373
+ $ultimatemember->form->add_error('description', sprintf(__('Your user description must contain less than %s characters','ultimatemember'), $max_chars ) );
374
+ }
375
}
376
377
} // end if ( isset in args array )
378
core/um-actions-login.php CHANGED
@@ -99,6 +99,23 @@
99
100
}
101
102
/***
103
*** @login user
104
***/
99
100
}
101
102
+ /***
103
+ *** @store last login timestamp
104
+ ***/
105
+ add_action('um_on_login_before_redirect', 'um_store_lastlogin_timestamp', 10);
106
+ function um_store_lastlogin_timestamp( $user_id ) {
107
+ delete_user_meta( $user_id, '_um_last_login' );
108
+ update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
109
+ }
110
+
111
+ add_action( 'wp_login', 'um_store_lastlogin_timestamp_' );
112
+ function um_store_lastlogin_timestamp_( $login ) {
113
+ $user = get_user_by('login',$login);
114
+ $user_id = $user->ID;
115
+ delete_user_meta( $user_id, '_um_last_login' );
116
+ update_user_meta( $user_id, '_um_last_login', current_time( 'timestamp' ) );
117
+ }
118
+
119
/***
120
*** @login user
121
***/
core/um-builtin.php CHANGED
@@ -595,6 +595,17 @@ class UM_Builtin {
595
'edit_forbidden' => 1,
596
),
597
598
'display_name' => array(
599
'title' => __('Display Name','ultimatemember'),
600
'metakey' => 'display_name',
595
'edit_forbidden' => 1,
596
),
597
598
+ 'last_login' => array(
599
+ 'title' => __('Last Login','ultimatemember'),
600
+ 'metakey' => 'last_login',
601
+ 'type' => 'text',
602
+ 'label' => __('Last Login','ultimatemember'),
603
+ 'required' => 0,
604
+ 'public' => 1,
605
+ 'editable' => 1,
606
+ 'edit_forbidden' => 1,
607
+ ),
608
+
609
'display_name' => array(
610
'title' => __('Display Name','ultimatemember'),
611
'metakey' => 'display_name',
core/um-datetime.php CHANGED
@@ -13,6 +13,68 @@ class UM_DateTime {
13
return current_time( $format );
14
}
15
16
/***
17
*** @Get age
18
***/
13
return current_time( $format );
14
}
15
16
+ /***
17
+ *** @Show a cool time difference between 2 timestamps
18
+ ***/
19
+ function time_diff( $from, $to = '' ) {
20
+ if ( empty( $to ) ) {
21
+ $to = time();
22
+ }
23
+ $diff = (int) abs( $to - $from );
24
+ if ( $diff < 60 ) {
25
+
26
+ $since = __('just now','ultimatemember');
27
+
28
+ } elseif ( $diff < HOUR_IN_SECONDS ) {
29
+
30
+ $mins = round( $diff / MINUTE_IN_SECONDS );
31
+ if ( $mins <= 1 )
32
+ $mins = 1;
33
+ if ( $mins == 1 ) {
34
+ $since = sprintf( __('%s min','ultimatemember'), $mins );
35
+ } else {
36
+ $since = sprintf( __('%s mins','ultimatemember'), $mins );
37
+ }
38
+
39
+ } elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
40
+
41
+ $hours = round( $diff / HOUR_IN_SECONDS );
42
+ if ( $hours <= 1 )
43
+ $hours = 1;
44
+ if ( $hours == 1 ) {
45
+ $since = sprintf( __('%s hr','ultimatemember'), $hours );
46
+ } else {
47
+ $since = sprintf( __('%s hrs','ultimatemember'), $hours );
48
+ }
49
+
50
+ } elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
51
+
52
+ $days = round( $diff / DAY_IN_SECONDS );
53
+ if ( $days <= 1 )
54
+ $days = 1;
55
+ if ( $days == 1 ) {
56
+ $since = sprintf( __('Yesterday at %s','ultimatemember'), date('g:ia', $from ) );
57
+ } else {
58
+ $since = sprintf(__('%s at %s','ultimatemember'), date('F d', $from ), date('g:ia', $from ) );
59
+ }
60
+
61
+ } elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
62
+
63
+ $since = sprintf(__('%s at %s','ultimatemember'), date('F d', $from ), date('g:ia', $from ) );
64
+
65
+ } elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) {
66
+
67
+ $since = sprintf(__('%s at %s','ultimatemember'), date('F d', $from ), date('g:ia', $from ) );
68
+
69
+ } elseif ( $diff >= YEAR_IN_SECONDS ) {
70
+
71
+ $since = sprintf(__('%s at %s','ultimatemember'), date( 'F d, Y', $from ), date('g:ia', $from ) );
72
+
73
+ }
74
+
75
+ return apply_filters( 'um_human_time_diff', $since, $diff, $from, $to );
76
+ }
77
+
78
/***
79
*** @Get age
80
***/
core/um-filters-fields.php CHANGED
@@ -80,7 +80,16 @@
80
add_filter('um_profile_field_filter_hook__user_registered', 'um_profile_field_filter_hook__user_registered', 99, 2);
81
function um_profile_field_filter_hook__user_registered( $value, $data ) {
82
$value = strtotime($value);
83
- $value = sprintf(__('Joined %s','ultimatemember'), date_i18n('d M Y', $value) );
84
return $value;
85
}
86
@@ -212,6 +221,7 @@
212
if ( strpos($value, 'http://') !== 0 ) {
213
$value = 'http://' . $value;
214
}
215
$value = '<a href="'. $value .'" title="'.$alt.'" target="'.$data['url_target'].'" ' . $url_rel . '>'.$alt.'</a>';
216
217
}
80
add_filter('um_profile_field_filter_hook__user_registered', 'um_profile_field_filter_hook__user_registered', 99, 2);
81
function um_profile_field_filter_hook__user_registered( $value, $data ) {
82
$value = strtotime($value);
83
+ $value = sprintf(__('Joined %s','ultimatemember'), date_i18n('F d, Y', $value) );
84
+ return $value;
85
+ }
86
+
87
+ /***
88
+ *** @last login date
89
+ ***/
90
+ add_filter('um_profile_field_filter_hook__last_login', 'um_profile_field_filter_hook__last_login', 99, 2);
91
+ function um_profile_field_filter_hook__last_login( $value, $data ) {
92
+ $value = sprintf( __('Last login: %s','ultimatemember'), um_user_last_login( um_user('ID') ) );
93
return $value;
94
}
95
221
if ( strpos($value, 'http://') !== 0 ) {
222
$value = 'http://' . $value;
223
}
224
+ $data['url_target'] = ( isset( $data['url_target'] ) ) ? $data['url_target'] : '_blank';
225
$value = '<a href="'. $value .'" title="'.$alt.'" target="'.$data['url_target'].'" ' . $url_rel . '>'.$alt.'</a>';
226
227
}
core/um-filters-members.php CHANGED
@@ -183,6 +183,19 @@
183
return $query_args;
184
}
185
186
/***
187
*** @hook in the member results array
188
***/
183
return $query_args;
184
}
185
186
+ /***
187
+ *** @sorting by last login date
188
+ ***/
189
+ add_filter('um_modify_sortby_parameter', 'um_sortby_last_login', 100, 2 );
190
+ function um_sortby_last_login( $query_args, $sortby ) {
191
+ if ( $sortby == 'last_login' ) {
192
+ $query_args['orderby'] = 'meta_value_num';
193
+ $query_args['order'] = 'desc';
194
+ $query_args['meta_key'] = '_um_last_login';
195
+ }
196
+ return $query_args;
197
+ }
198
+
199
/***
200
*** @hook in the member results array
201
***/
core/um-logout.php CHANGED
@@ -20,15 +20,13 @@ class UM_Logout {
20
if ( isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to'] !== '' ) {
21
$redirect_to = $_REQUEST['redirect_to'];
22
} else if ( um_user('after_logout') == 'redirect_home' ) {
23
- $redirect_to = home_url();
24
} else {
25
- $redirect_to = um_user('logout_redirect_url');
26
}
27
-
28
- wp_logout();
29
-
30
- exit( wp_redirect( $redirect_to ) );
31
-
32
} else {
33
um_redirect_home();
34
}
20
if ( isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to'] !== '' ) {
21
$redirect_to = $_REQUEST['redirect_to'];
22
} else if ( um_user('after_logout') == 'redirect_home' ) {
23
+ wp_logout();
24
+ um_redirect_home();
25
} else {
26
+ wp_logout();
27
+ exit( wp_redirect( um_user('logout_redirect_url') ) );
28
}
29
+
30
} else {
31
um_redirect_home();
32
}
core/um-members.php CHANGED
@@ -3,9 +3,7 @@
3
class UM_Members {
4
5
function __construct() {
6
-
7
- add_filter('pre_user_query', array(&$this, 'custom_order_query') );
8
-
9
add_filter('user_search_columns', array(&$this, 'user_search_columns'), 99 );
10
11
add_action('template_redirect', array(&$this, 'access_members'), 555);
@@ -41,17 +39,6 @@ class UM_Members {
41
42
}
43
44
- /***
45
- *** @custom user ordering
46
- ***/
47
- function custom_order_query( $query ) {
48
-
49
- if($query->query_vars["orderby"] == 'random') {
50
- $query->query_orderby = 'ORDER by RAND()';
51
- }
52
-
53
- }
54
-
55
/***
56
*** @tag conversion for member directory
57
***/
3
class UM_Members {
4
5
function __construct() {
6
+
7
add_filter('user_search_columns', array(&$this, 'user_search_columns'), 99 );
8
9
add_action('template_redirect', array(&$this, 'access_members'), 555);
39
40
}
41
42
/***
43
*** @tag conversion for member directory
44
***/
core/um-query.php CHANGED
@@ -8,6 +8,18 @@ class UM_Query {
8
9
}
10
11
/***
12
*** @get all forms
13
***/
@@ -89,7 +101,15 @@ class UM_Query {
89
***/
90
function count_users_by_status( $status ) {
91
$args = array( 'fields' => 'ID', 'number' => 0 );
92
- $args['meta_query'][] = array(array('key' => 'account_status','value' => $status,'compare' => '='));
93
$users = new WP_User_Query( $args );
94
return count($users->results);
95
}
@@ -312,7 +332,7 @@ class UM_Query {
312
}
313
314
/***
315
- *** @Is a core post/role
316
***/
317
function is_core( $post_id ){
318
$is_core = get_post_meta($post_id, '_um_core', true);
8
9
}
10
11
+ /***
12
+ *** @get wp pages
13
+ ***/
14
+ function wp_pages() {
15
+ $pages = get_pages();
16
+ $array = '';
17
+ foreach ($pages as $page_data) {
18
+ $array[ $page_data->ID ] = $page_data->post_title;
19
+ }
20
+ return $array;
21
+ }
22
+
23
/***
24
*** @get all forms
25
***/
101
***/
102
function count_users_by_status( $status ) {
103
$args = array( 'fields' => 'ID', 'number' => 0 );
104
+ if ( $status == 'unassigned' ) {
105
+ $args['meta_query'][] = array(array('key' => 'account_status','compare' => 'NOT EXISTS'));
106
+ $users = new WP_User_Query( $args );
107
+ foreach( $users->results as $user ) {
108
+ update_user_meta( $user, 'account_status', 'approved' );
109
+ }
110
+ } else {
111
+ $args['meta_query'][] = array(array('key' => 'account_status','value' => $status,'compare' => '='));
112
+ }
113
$users = new WP_User_Query( $args );
114
return count($users->results);
115
}
332
}
333
334
/***
335
+ *** @Checks if its a core page of UM
336
***/
337
function is_core( $post_id ){
338
$is_core = get_post_meta($post_id, '_um_core', true);
core/um-rewrite.php CHANGED
@@ -38,6 +38,7 @@ class UM_Rewrite {
38
$account_page_id = $ultimatemember->permalinks->core['account'];
39
40
$user = get_post($user_page_id);
41
$user_slug = $user->post_name;
42
43
$account = get_post($account_page_id);
@@ -61,6 +62,7 @@ class UM_Rewrite {
61
}
62
63
flush_rewrite_rules( true );
64
65
}
66
38
$account_page_id = $ultimatemember->permalinks->core['account'];
39
40
$user = get_post($user_page_id);
41
+ if ( isset( $user->post_name ) ) {
42
$user_slug = $user->post_name;
43
44
$account = get_post($account_page_id);
62
}
63
64
flush_rewrite_rules( true );
65
+ }
66
67
}
68
core/um-setup.php CHANGED
@@ -380,7 +380,16 @@ class UM_Setup {
380
/** DONE **/
381
382
}
383
- if ( isset( $core_pages ) ) update_option('um_core_pages', $core_pages);
384
385
}
386
380
/** DONE **/
381
382
}
383
+ if ( isset( $core_pages ) ) {
384
+ update_option('um_core_pages', $core_pages);
385
+ $options = get_option('um_options');
386
+ foreach( $core_pages as $o_slug => $page_id ) {
387
+ $options['core_' . $o_slug] = $page_id;
388
+ }
389
+ if ( isset( $options ) ) {
390
+ update_option('um_options', $options );
391
+ }
392
+ }
393
394
}
395
core/um-short-functions.php CHANGED
@@ -291,6 +291,47 @@ function um_profile_id() {
291
return $url;
292
}
293
294
/***
295
*** @Get core page url
296
***/
@@ -449,10 +490,12 @@ function um_profile_id() {
449
*** @get a user's display name
450
***/
451
function um_get_display_name( $user_id ) {
452
- $user = get_userdata( $user_id );
453
- return $user->display_name;
454
}
455
-
456
/***
457
*** @get members to show in directory
458
***/
291
return $url;
292
}
293
294
+ /***
295
+ *** @Get core page url
296
+ ***/
297
+ function um_time_diff( $time1, $time2 ) {
298
+ global $ultimatemember;
299
+ return $ultimatemember->datetime->time_diff( $time1, $time2 );
300
+ }
301
+
302
+ /***
303
+ *** @Get user's last login timestamp
304
+ ***/
305
+ function um_user_last_login_timestamp( $user_id ) {
306
+ $value = get_user_meta( $user_id, '_um_last_login', true );
307
+ if ( $value )
308
+ return $value;
309
+ return '';
310
+ }
311
+
312
+ /***
313
+ *** @Get user's last login time
314
+ ***/
315
+ function um_user_last_login_date( $user_id ) {
316
+ $value = get_user_meta( $user_id, '_um_last_login', true );
317
+ if ( $value )
318
+ return date_i18n('F d, Y', $value );
319
+ return '';
320
+ }
321
+
322
+ /***
323
+ *** @Get user's last login (time diff)
324
+ ***/
325
+ function um_user_last_login( $user_id ) {
326
+ $value = get_user_meta( $user_id, '_um_last_login', true );
327
+ if ( $value ) {
328
+ $value = um_time_diff( $value, current_time('timestamp') );
329
+ } else {
330
+ $value = '';
331
+ }
332
+ return $value;
333
+ }
334
+
335
/***
336
*** @Get core page url
337
***/
490
*** @get a user's display name
491
***/
492
function um_get_display_name( $user_id ) {
493
+ um_fetch_user( $user_id );
494
+ $name = um_user('display_name');
495
+ um_reset_user();
496
+ return $name;
497
}
498
+
499
/***
500
*** @get members to show in directory
501
***/
core/um-shortcodes.php CHANGED
@@ -261,10 +261,14 @@ class UM_Shortcodes {
261
extract($args);
262
263
$global = um_path . 'assets/dynamic_css/dynamic_global.php';
264
- $file = um_path . 'assets/dynamic_css/dynamic_'.$mode.'.php';
265
266
include $global;
267
- if ( file_exists( $file ) )
268
include $file;
269
270
if ( isset( $args['custom_css'] ) ) {
261
extract($args);
262
263
$global = um_path . 'assets/dynamic_css/dynamic_global.php';
264
+
265
+ if ( isset( $mode ) ) {
266
+ $file = um_path . 'assets/dynamic_css/dynamic_'.$mode.'.php';
267
+ }
268
269
include $global;
270
+
271
+ if ( isset( $file ) && file_exists( $file ) )
272
include $file;
273
274
if ( isset( $args['custom_css'] ) ) {
core/um-user.php CHANGED
@@ -177,23 +177,23 @@ class UM_User {
177
}
178
179
if ( $this->usermeta['account_status'][0] == 'approved' ) {
180
- $this->usermeta['account_status_name'][0] = 'Approved';
181
}
182
183
if ( $this->usermeta['account_status'][0] == 'awaiting_email_confirmation' ) {
184
- $this->usermeta['account_status_name'][0] = 'Awaiting E-mail Confirmation';
185
}
186
187
if ( $this->usermeta['account_status'][0] == 'awaiting_admin_review' ) {
188
- $this->usermeta['account_status_name'][0] = 'Pending Review';
189
}
190
191
if ( $this->usermeta['account_status'][0] == 'rejected' ) {
192
- $this->usermeta['account_status_name'][0] = 'Membership Rejected';
193
}
194
195
if ( $this->usermeta['account_status'][0] == 'inactive' ) {
196
- $this->usermeta['account_status_name'][0] = 'Membership Inactive';
197
}
198
199
// add user meta
177
}
178
179
if ( $this->usermeta['account_status'][0] == 'approved' ) {
180
+ $this->usermeta['account_status_name'][0] = __('Approved','ultimatemember');
181
}
182
183
if ( $this->usermeta['account_status'][0] == 'awaiting_email_confirmation' ) {
184
+ $this->usermeta['account_status_name'][0] = __('Awaiting E-mail Confirmation','ultimatemember');
185
}
186
187
if ( $this->usermeta['account_status'][0] == 'awaiting_admin_review' ) {
188
+ $this->usermeta['account_status_name'][0] = __('Pending Review','ultimatemember');
189
}
190
191
if ( $this->usermeta['account_status'][0] == 'rejected' ) {
192
+ $this->usermeta['account_status_name'][0] = __('Membership Rejected','ultimatemember');
193
}
194
195
if ( $this->usermeta['account_status'][0] == 'inactive' ) {
196
+ $this->usermeta['account_status_name'][0] = __('Membership Inactive','ultimatemember');
197
}
198
199
// add user meta
core/um-validation.php CHANGED
@@ -107,6 +107,9 @@ class UM_Validation {
107
}
108
109
} else {
110
111
}
112
107
}
108
109
} else {
110
+
111
+ if ( strstr( $url, 'http://') || strstr( $url, 'https://') )
112
+ return true;
113
114
}
115
index.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Ultimate Member
4
Plugin URI: http://ultimatemember.com/
5
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
- Version: 1.3.13
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
*/
3
Plugin Name: Ultimate Member
4
Plugin URI: http://ultimatemember.com/
5
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
+ Version: 1.3.14
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
*/
readme.txt CHANGED
@@ -5,9 +5,9 @@ Contributors: ultimatemember
5
Donate link:
6
Tags: access control, author, authors, author profile, comments, community, communities, conditional fields, conditional logic, conditional menus, content protection, custom fields, file uploads, form builder, front-end login, front-end registration, gravatar, hide wp-admin, login, login page, logged-in users, mandrill, member, members, membership, member directory, online users, profile, profiles, profile builder, registration, restriction, restrict content, role creation, role menus, search filters, sign in, sign up, social network, star ratings, toolbar, user, users, user fields, user profile, user-profile, user profiles, user roles
7
Requires at least: 4.1
8
- Tested up to: 4.2.2
9
10
- Stable Tag: 1.3.13
11
12
License: GNU Version 2 or Any Later Version
13
@@ -150,6 +150,17 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
150
151
== Changelog ==
152
153
= 1.3.13: July 22, 2015 =
154
155
* Fixed: Woocommerce manual order dropdown conflict
5
Donate link:
6
Tags: access control, author, authors, author profile, comments, community, communities, conditional fields, conditional logic, conditional menus, content protection, custom fields, file uploads, form builder, front-end login, front-end registration, gravatar, hide wp-admin, login, login page, logged-in users, mandrill, member, members, membership, member directory, online users, profile, profiles, profile builder, registration, restriction, restrict content, role creation, role menus, search filters, sign in, sign up, social network, star ratings, toolbar, user, users, user fields, user profile, user-profile, user profiles, user roles
7
Requires at least: 4.1
8
+ Tested up to: 4.2.3
9
10
+ Stable Tag: 1.3.14
11
12
License: GNU Version 2 or Any Later Version
13
150
151
== Changelog ==
152
153
+ = 1.3.14: August 4, 2015 =
154
+
155
+ * New: added last login date support
156
+ * New: show user's last login in profile
157
+ * New: added sorting members by last login date
158
+ * New: added option to re-assign core pages in plugin settings
159
+ * Fixed: issue with multi-select required field
160
+ * Fixed: URL validation for custom fields
161
+ * Fixed: backend user filtering by non-english role
162
+ * Fixed: RTL css bugs
163
+
164
= 1.3.13: July 22, 2015 =
165
166
* Fixed: Woocommerce manual order dropdown conflict
um-config.php CHANGED
@@ -3,6 +3,63 @@
3
global $ultimatemember;
4
5
6
/***
7
*** @
8
***/
3
global $ultimatemember;
4
5
6
+ /***
7
+ *** @
8
+ ***/
9
+
10
+ $core_pages = array(
11
+ 'user' => __('User page','ultimatemember'),
12
+ 'account' => __('Account page','ultimatemember'),
13
+ 'members' => __('Members page','ultimatemember'),
14
+ 'register' => __('Register page','ultimatemember'),
15
+ 'login' => __('Login page','ultimatemember'),
16
+ 'logout' => __('Logout page','ultimatemember'),
17
+ 'password-reset' => __('Password reset page','ultimatemember'),
18
+ );
19
+
20
+ foreach( $core_pages as $page_s => $page ) {
21
+ $page_setup[] = array(
22
+ 'id' => 'core_' . $page_s,
23
+ 'type' => 'select',
24
+ 'select2' => array( 'allowClear' => 0, 'minimumResultsForSearch' => -1 ),
25
+ 'title' => $page,
26
+ 'default' => ( isset( $ultimatemember->permalinks->core[ $page_s ] ) ) ? $ultimatemember->permalinks->core[ $page_s ] : '' ,
27
+ 'options' => $ultimatemember->query->wp_pages(),
28
+ 'placeholder' => __('Choose a page...','ultimatemember'),
29
+ 'compiler' => true,
30
+ );
31
+ }
32
+
33
+ $this->sections[] = array(
34
+
35
+ 'icon' => 'um-faicon-cog',
36
+ 'title' => __( 'Setup','ultimatemember'),
37
+ 'fields' => $page_setup
38
+
39
+ );
40
+
41
+ /***
42
+ *** @
43
+ ***/
44
+
45
+ add_filter('redux/options/um_options/compiler', 'um_core_page_setting_saved', 100, 3);
46
+ function um_core_page_setting_saved($options, $css, $changed_values) {
47
+ $core_pages = array(
48
+ 'user' => __('User page','ultimatemember'),
49
+ 'account' => __('Account page','ultimatemember'),
50
+ 'members' => __('Members page','ultimatemember'),
51
+ 'register' => __('Register page','ultimatemember'),
52
+ 'login' => __('Login page','ultimatemember'),
53
+ 'logout' => __('Logout page','ultimatemember'),
54
+ 'password-reset' => __('Password reset page','ultimatemember'),
55
+ );
56
+ $pages = get_option('um_core_pages');
57
+ foreach( $core_pages as $slug => $page ) {
58
+ $pages[ $slug ] = $options['core_' . $slug ];
59
+ }
60
+ update_option( 'um_core_pages', $pages );
61
+ }
62
+
63
/***
64
*** @
65
***/