Ultimate Member – User Profile & Membership Plugin - Version 1.3.77

Version Description

Download this release

Release Info

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

Code changes from version 1.3.73 to 1.3.77

admin/core/lib/ReduxFramework/{readme.txt → README.txt} RENAMED
File without changes
admin/core/um-admin-actions.php CHANGED
@@ -254,15 +254,12 @@
254
***/
255
add_action('um_admin_do_action__user_cache', 'um_admin_do_action__user_cache');
256
function um_admin_do_action__user_cache( $action ){
257
- global $ultimatemember;
258
if ( !is_admin() || !current_user_can('manage_options') ) die();
259
260
- $all_options = wp_load_alloptions();
261
- foreach( $all_options as $k => $v ) {
262
- if ( strstr( $k, 'um_cache_userdata_' ) ) {
263
- delete_option( $k );
264
- }
265
- }
266
267
$url = admin_url('admin.php?page=ultimatemember');
268
$url = add_query_arg('update','cleared_cache',$url);
254
***/
255
add_action('um_admin_do_action__user_cache', 'um_admin_do_action__user_cache');
256
function um_admin_do_action__user_cache( $action ){
257
+ global $ultimatemember, $wpdb;
258
if ( !is_admin() || !current_user_can('manage_options') ) die();
259
260
+
261
+ $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'um_cache_userdata_%'" );
262
+
263
264
$url = admin_url('admin.php?page=ultimatemember');
265
$url = add_query_arg('update','cleared_cache',$url);
core/um-actions-access.php CHANGED
@@ -571,88 +571,90 @@
571
572
}
573
574
- $post_type = get_post_type( $post->ID );
575
-
576
- // post's category restriction
577
- if ( $post_type != 'page' && isset( $args['custom_access_settings'] ) && $args['custom_access_settings'] == 0 ) {
578
-
579
- $categories = get_the_category( $post->ID );
580
- foreach( $categories as $cat ){
581
-
582
- $opt = get_option("category_{$cat->term_id}");
583
-
584
- if ( isset( $opt['_um_accessible'] ) ) {
585
- switch( $opt['_um_accessible'] ) {
586
-
587
- case 0: // Open to everyone
588
- $ultimatemember->access->allow_access = true;
589
- $ultimatemember->access->redirect_handler = false; // open to everyone
590
- break;
591
592
- case 1: // Logged out users only
593
-
594
- if ( is_user_logged_in() ){
595
- $redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
596
- $redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_1a_t{$cat->term_id}_pt{$post_type}" );
597
- $ultimatemember->access->redirect_handler = $redirect;
598
- $ultimatemember->access->allow_access = false;
599
- }
600
601
- if ( !is_user_logged_in() ){
602
- $ultimatemember->access->allow_access = true;
603
- }
604
605
- break;
606
607
- case 2: // Logged in users only
608
609
- if ( ! is_user_logged_in() ){
610
611
- $redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : um_get_core_page('login');
612
613
- $redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_2a_t{$cat->term_id}_pt{$post_type}" );
614
- $ultimatemember->access->redirect_handler = $redirect;
615
-
616
- $ultimatemember->access->allow_access = false;
617
- }
618
619
- if ( is_user_logged_in() ){
620
-
621
- if( isset( $opt['_um_roles'] ) && !empty( $opt['_um_roles'] ) ){
622
623
- if ( in_array( um_user('role'), $opt['_um_roles'] ) ) {
624
625
- $ultimatemember->access->allow_access = true;
626
-
627
- }else{
628
629
- $redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
630
- $redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_2b_t{$cat->term_id}_pt{$post_type}" );
631
- $ultimatemember->access->redirect_handler = $redirect;
632
-
633
- $ultimatemember->access->allow_access = false;
634
-
635
}
636
637
- }else{ // if allowed all roles
638
- $ultimatemember->access->allow_access = true;
639
}
640
-
641
- }
642
-
643
- }
644
645
646
- } // end if isset( $opt['_um_accessible'] )
647
648
- // if one of the categories has enabled restriction, apply its settings to the current post
649
- if( $ultimatemember->access->allow_access == false ){
650
- return;
651
- }
652
-
653
- } // end foreach
654
- }
655
656
// post restriction
657
if ( isset( $args['custom_access_settings'] ) && $args['custom_access_settings'] == 1 ) {
658
571
572
}
573
574
+ if( isset( $post->ID ) ){
575
+ $post_type = get_post_type( $post->ID );
576
+
577
+ // post's category restriction
578
+ if ( $post_type != 'page' && isset( $args['custom_access_settings'] ) && $args['custom_access_settings'] == 0 ) {
579
+
580
+ $categories = get_the_category( $post->ID );
581
+ foreach( $categories as $cat ){
582
+
583
+ $opt = get_option("category_{$cat->term_id}");
584
+
585
+ if ( isset( $opt['_um_accessible'] ) ) {
586
+ switch( $opt['_um_accessible'] ) {
587
+
588
+ case 0: // Open to everyone
589
+ $ultimatemember->access->allow_access = true;
590
+ $ultimatemember->access->redirect_handler = false; // open to everyone
591
+ break;
592
593
+ case 1: // Logged out users only
594
+
595
+ if ( is_user_logged_in() ){
596
+ $redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
597
+ $redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_1a_t{$cat->term_id}_pt{$post_type}" );
598
+ $ultimatemember->access->redirect_handler = $redirect;
599
+ $ultimatemember->access->allow_access = false;
600
+ }
601
602
+ if ( !is_user_logged_in() ){
603
+ $ultimatemember->access->allow_access = true;
604
+ }
605
606
+ break;
607
608
+ case 2: // Logged in users only
609
610
+ if ( ! is_user_logged_in() ){
611
612
+ $redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : um_get_core_page('login');
613
614
+ $redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_2a_t{$cat->term_id}_pt{$post_type}" );
615
+ $ultimatemember->access->redirect_handler = $redirect;
616
+
617
+ $ultimatemember->access->allow_access = false;
618
+ }
619
620
+ if ( is_user_logged_in() ){
621
+
622
+ if( isset( $opt['_um_roles'] ) && !empty( $opt['_um_roles'] ) ){
623
624
+ if ( in_array( um_user('role'), $opt['_um_roles'] ) ) {
625
626
+ $ultimatemember->access->allow_access = true;
627
+
628
+ }else{
629
630
+ $redirect = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
631
+ $redirect = $ultimatemember->access->set_referer( $redirect, "page_cat_2b_t{$cat->term_id}_pt{$post_type}" );
632
+ $ultimatemember->access->redirect_handler = $redirect;
633
+
634
+ $ultimatemember->access->allow_access = false;
635
+
636
+ }
637
+
638
+ }else{ // if allowed all roles
639
+ $ultimatemember->access->allow_access = true;
640
}
641
642
}
643
+
644
+ }
645
646
647
+ } // end if isset( $opt['_um_accessible'] )
648
649
+ // if one of the categories has enabled restriction, apply its settings to the current post
650
+ if( $ultimatemember->access->allow_access == false ){
651
+ return;
652
+ }
653
654
+ } // end foreach
655
+ }
656
+ }
657
+
658
// post restriction
659
if ( isset( $args['custom_access_settings'] ) && $args['custom_access_settings'] == 1 ) {
660
core/um-actions-form.php CHANGED
@@ -389,11 +389,13 @@
389
$args['user_id'] = um_get_requested_user();
390
}
391
392
if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
393
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
394
- } else if ( in_array( $mode, array('register') ) && email_exists( $args[$key] ) ) {
395
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
396
- } else if ( in_array( $mode, array('profile') ) && email_exists( $args[$key] ) != $args['user_id'] ) {
397
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
398
} else if ( !is_email( $args[$key] ) ) {
399
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
389
$args['user_id'] = um_get_requested_user();
390
}
391
392
+ $email_exists = email_exists( $args[$key] );
393
+
394
if ( $args[$key] == '' && in_array( $key, array('user_email') ) ) {
395
$ultimatemember->form->add_error($key, __('You must provide your email','ultimatemember') );
396
+ } else if ( in_array( $mode, array('register') ) && $email_exists ) {
397
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
398
+ } else if ( in_array( $mode, array('profile') ) && $email_exists && $email_exists != $args['user_id'] ) {
399
$ultimatemember->form->add_error($key, __('This email is already linked to an existing account','ultimatemember') );
400
} else if ( !is_email( $args[$key] ) ) {
401
$ultimatemember->form->add_error($key, __('This is not a valid email','ultimatemember') );
core/um-actions-password.php CHANGED
@@ -156,8 +156,9 @@
156
function um_change_password_errors_hook( $args ) {
157
global $ultimatemember;
158
159
- if ( $_POST[ $ultimatemember->honeypot ] != '' )
160
wp_die('Hello, spam bot!');
161
162
$form_timestamp = trim($_POST['timestamp']);
163
$live_timestamp = current_time( 'timestamp' );
@@ -168,7 +169,20 @@
168
if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 ){
169
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
170
}
171
-
172
173
if ( isset( $args['user_password'] ) && empty( $args['user_password'] ) ) {
174
$ultimatemember->form->add_error('user_password', __('You must enter a new password','ultimatemember') );
156
function um_change_password_errors_hook( $args ) {
157
global $ultimatemember;
158
159
+ if ( isset( $_POST[ $ultimatemember->honeypot ] ) && $_POST[ $ultimatemember->honeypot ] != '' ){
160
wp_die('Hello, spam bot!');
161
+ }
162
163
$form_timestamp = trim($_POST['timestamp']);
164
$live_timestamp = current_time( 'timestamp' );
169
if ( $live_timestamp - $form_timestamp < 3 && um_get_option('enable_timebot') == 1 ){
170
wp_die( __('Whoa, slow down! You\'re seeing this message because you tried to submit a form too fast and we think you might be a spam bot. If you are a real human being please wait a few seconds before submitting the form. Thanks!') );
171
}
172
+
173
+ $reset_pass_hash = '';
174
+
175
+ if( isset( $_REQUEST['act'] ) && $_REQUEST['act'] == 'reset_password' && um_is_core_page('password-reset') ){
176
+ $reset_pass_hash = get_user_meta( $args['user_id'], 'reset_pass_hash', true );
177
+
178
+ }
179
+
180
+ if( !is_user_logged_in() && isset( $args ) && ! um_is_core_page('password-reset') ||
181
+ is_user_logged_in() && isset( $args['user_id'] ) && $args['user_id'] != get_current_user_id() ||
182
+ !is_user_logged_in() && isset( $_REQUEST['hash'] ) && $reset_pass_hash != $_REQUEST['hash'] && um_is_core_page('password-reset')
183
+ ){
184
+ wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
185
+ }
186
187
if ( isset( $args['user_password'] ) && empty( $args['user_password'] ) ) {
188
$ultimatemember->form->add_error('user_password', __('You must enter a new password','ultimatemember') );
core/um-actions-register.php CHANGED
@@ -231,10 +231,12 @@
231
}
232
233
if ( um_user( $status . '_action' ) == 'show_message' && um_user( $status . '_message' ) != '' ) {
234
- $url = $ultimatemember->permalinks->get_current_url();
235
- $url = add_query_arg( 'message', esc_attr( $status ), $url );
236
- $url = add_query_arg( 'uid', esc_attr( um_user('ID') ), $url );
237
- $url = add_query_arg( 'um_form_id', esc_attr( $form_id ), $url );
238
239
exit( wp_redirect( $url ) );
240
}
231
}
232
233
if ( um_user( $status . '_action' ) == 'show_message' && um_user( $status . '_message' ) != '' ) {
234
+
235
+ $role_id = $ultimatemember->user->get_role_name( um_user('role'), true );
236
+ $url = $ultimatemember->permalinks->get_current_url();
237
+ $url = add_query_arg( 'message', esc_attr( $status ), $url );
238
+ $url = add_query_arg( 'um_role', esc_attr( $role_id ), $url );
239
+ $url = add_query_arg( 'um_form_id', esc_attr( $form_id ), $url );
240
241
exit( wp_redirect( $url ) );
242
}
core/um-actions-save-profile.php CHANGED
@@ -10,7 +10,15 @@
10
11
// Sync display name changes
12
$option = um_get_option('display_name');
13
$user_id = $ultimatemember->user->id;
14
switch ( $option ) {
15
default:
16
break;
@@ -39,10 +47,11 @@
39
40
if ( isset( $update_name ) ) {
41
42
- $return = wp_update_user( array( 'ID' => $user_id, 'display_name' => $update_name ) );
43
44
if( is_wp_error( $return ) ) {
45
- wp_die( $return->get_error_message() );
46
}
47
48
10
11
// Sync display name changes
12
$option = um_get_option('display_name');
13
+
14
$user_id = $ultimatemember->user->id;
15
+
16
+ if( ! isset( $user_id ) || empty( $user_id ) ){
17
+ $user = get_user_by( 'email', $changes['user_email'] );
18
+ um_fetch_user( $user->ID );
19
+ $user_id = $user->ID;
20
+ }
21
+
22
switch ( $option ) {
23
default:
24
break;
47
48
if ( isset( $update_name ) ) {
49
50
+ $arr_user = array( 'ID' => $user_id, 'display_name' => $update_name );
51
+ $return = wp_update_user( $arr_user );
52
53
if( is_wp_error( $return ) ) {
54
+ wp_die( '<pre>' . var_export( array( 'message' => $return->get_error_message(), 'dump' => $arr_user, 'changes' => $changes ), true ) . '</pre>' );
55
}
56
57
core/um-filters-arguments.php CHANGED
@@ -29,12 +29,15 @@
29
global $ultimatemember;
30
31
if ($ultimatemember->shortcodes->message_mode == true) {
32
$args['template'] = 'message';
33
- um_fetch_user( $_REQUEST['uid'] );
34
-
35
- $ultimatemember->shortcodes->custom_message = um_user( um_user('status') . '_message' );
36
37
- um_reset_user();
38
}
39
40
foreach( $args as $k => $v ) {
29
global $ultimatemember;
30
31
if ($ultimatemember->shortcodes->message_mode == true) {
32
+
33
$args['template'] = 'message';
34
+ $role = esc_attr( $_REQUEST['um_role'] );
35
+ $role_slug = $ultimatemember->user->get_role_slug_by_id( $role );
36
+ $role = $ultimatemember->query->role_data( $role_slug );
37
+ $status = $role["status"];
38
+ $message = $role["{$status}_message"];
39
+ $ultimatemember->shortcodes->custom_message = $message;
40
41
}
42
43
foreach( $args as $k => $v ) {
core/um-form.php CHANGED
@@ -114,18 +114,22 @@ class UM_Form {
114
115
$custom_field_roles = $this->custom_field_roles( $this->form_data['custom_fields'] );
116
117
- $role = $_POST['role'];
118
119
- if( is_array( $_POST['role'] ) ){
120
- $role = current( $_POST['role'] );
121
- }
122
123
- if ( isset( $custom_field_roles ) && is_array( $custom_field_roles ) && ! in_array( $role , $custom_field_roles ) ) {
124
- wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
125
- }
126
127
- $this->post_form['role'] = $role;
128
- $this->post_form['submitted']['role'] = $role;
129
130
}else if( isset( $this->post_form['mode'] ) && $this->post_form['mode'] == 'register' ) {
131
$role = $this->assigned_role( $this->form_id );
114
115
$custom_field_roles = $this->custom_field_roles( $this->form_data['custom_fields'] );
116
117
+ if( isset( $_POST['role'] ) ){
118
+ $role = $_POST['role'];
119
120
+ if( is_array( $_POST['role'] ) ){
121
+ $role = current( $_POST['role'] );
122
+ }
123
124
+ if ( isset( $custom_field_roles ) && is_array( $custom_field_roles ) && ! in_array( $role , $custom_field_roles ) ) {
125
+ wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
126
+ }
127
128
+ $this->post_form['role'] = $role;
129
+ $this->post_form['submitted']['role'] = $role;
130
+ }
131
+
132
+
133
134
}else if( isset( $this->post_form['mode'] ) && $this->post_form['mode'] == 'register' ) {
135
$role = $this->assigned_role( $this->form_id );
core/um-user.php CHANGED
@@ -704,6 +704,34 @@ class UM_User {
704
return $role_title;
705
}
706
707
/***
708
*** @Update one key in user meta
709
***/
704
return $role_title;
705
}
706
707
+ /**
708
+ * Get role slug by ID
709
+ * @param integer $id
710
+ * @return string
711
+ */
712
+ function get_role_slug_by_id( $id ) {
713
+ global $wpdb, $ultimatemember;
714
+
715
+
716
+ $args = array(
717
+ 'posts_per_page' => 1,
718
+ 'post_type' => 'um_role',
719
+ 'page_id' => $id,
720
+ 'post_status' => array('publish'),
721
+ );
722
+
723
+ $roles = new WP_Query( $args );
724
+ $role_slug = '';
725
+
726
+ if ( $roles->have_posts() ) {
727
+ $role_slug = $roles->post->post_name;
728
+ }
729
+
730
+ wp_reset_query();
731
+
732
+ return $role_slug;
733
+ }
734
+
735
/***
736
*** @Update one key in user meta
737
***/
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.73
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
Text Domain: ultimatemember
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.77
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
Text Domain: ultimatemember
readme.txt CHANGED
@@ -1,4 +1,4 @@
1
- === Ultimate Member ===
2
Author URI: https://ultimatemember.com/
3
Plugin URI: https://ultimatemember.com/
4
Contributors: ultimatemember, champsupertramp
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
7
Requires at least: 4.1
8
Tested up to: 4.6.1
9
10
- Stable Tag: 1.3.73
11
12
License: GNU Version 2 or Any Later Version
13
@@ -59,6 +59,7 @@ Ultimate Member has a range of extensions that allow you to extend the power of
59
* [myCRED](https://ultimatemember.com/extensions/mycred/) - With the myCRED extension you can integrate Ultimate Member with the popular myCRED points management plugin
60
* [Notices](https://ultimatemember.com/extensions/notices/) - Alert users to important information using conditional notices
61
* [Profile Completeness](https://ultimatemember.com/extensions/profile-completeness/) - Encourage or force users to complete their profiles with the profile completeness extension
62
63
= Free Extensions =
64
@@ -149,6 +150,35 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
149
150
== Changelog ==
151
152
= 1.3.73: November 17, 2016 =
153
154
* Enhancements:
1
+ === Ultimate Member ===
2
Author URI: https://ultimatemember.com/
3
Plugin URI: https://ultimatemember.com/
4
Contributors: ultimatemember, champsupertramp
7
Requires at least: 4.1
8
Tested up to: 4.6.1
9
10
+ Stable Tag: 1.3.76
11
12
License: GNU Version 2 or Any Later Version
13
59
* [myCRED](https://ultimatemember.com/extensions/mycred/) - With the myCRED extension you can integrate Ultimate Member with the popular myCRED points management plugin
60
* [Notices](https://ultimatemember.com/extensions/notices/) - Alert users to important information using conditional notices
61
* [Profile Completeness](https://ultimatemember.com/extensions/profile-completeness/) - Encourage or force users to complete their profiles with the profile completeness extension
62
+ * [Friends](https://ultimatemember.com/extensions/friends/) - Allows users to become friends by sending & accepting/rejecting friend requests
63
64
= Free Extensions =
65
150
151
== Changelog ==
152
153
+ = 1.3.77: November 30, 2016 =
154
+
155
+ * Bugfixes:
156
+ * Fix set and reset password validation.
157
+ * Remove notices.
158
+
159
+ = 1.3.76: November 30, 2016 =
160
+
161
+ * Bugfixes:
162
+ * Fix invalid security notice in set password.
163
+
164
+ = 1.3.75: November 29, 2016 =
165
+
166
+ * Bugfixes:
167
+ * Fix 'Invalid user ID' on profile update
168
+
169
+ = 1.3.74: November 29, 2016 =
170
+
171
+ * Enhancements:
172
+ * Improves clear users cache.
173
+ * Removes user id from redirect URL on registration process for pending review and email activation statuses.
174
+
175
+ * Bugfixes:
176
+ * Fix assigning of role on registration process
177
+ * Fix change email address in edit mode.
178
+ * Fix change password validation.
179
+ * Removes notices when role field is present in the profile form.
180
+
181
+
182
= 1.3.73: November 17, 2016 =
183
184
* Enhancements: