Ultimate Member – User Profile & Membership Plugin - Version 1.3.61

Version Description

Download this release

Release Info

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

Code changes from version 1.3.60 to 1.3.61

core/um-access.php CHANGED
@@ -24,15 +24,14 @@ class UM_Access {
24
  do_action('um_access_category_settings');
25
 
26
  do_action('um_access_post_settings');
27
-
28
- if ( $this->redirect_handler && !$this->allow_access && ! um_is_core_page('login') ) {
29
 
30
  // login page add protected page automatically
31
 
32
  if ( strstr( $this->redirect_handler, um_get_core_page('login') ) ){
33
  $curr = $ultimatemember->permalinks->get_current_url();
34
- $this->redirect_handler = add_query_arg('redirect_to', urlencode_deep($curr), $this->redirect_handler);
35
- $this->redirect_handler = esc_url( $this->redirect_handler );
36
  }
37
 
38
  wp_redirect( $this->redirect_handler );
24
  do_action('um_access_category_settings');
25
 
26
  do_action('um_access_post_settings');
27
+
28
+ if ( $this->redirect_handler && $this->allow_access == false && ! um_is_core_page('login') ) {
29
 
30
  // login page add protected page automatically
31
 
32
  if ( strstr( $this->redirect_handler, um_get_core_page('login') ) ){
33
  $curr = $ultimatemember->permalinks->get_current_url();
34
+ $this->redirect_handler = esc_url( add_query_arg('redirect_to', urlencode_deep($curr), $this->redirect_handler) );
 
35
  }
36
 
37
  wp_redirect( $this->redirect_handler );
core/um-actions-access.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /***
4
- *** @
5
  ***/
6
  add_action('um_access_homepage_per_role','um_access_homepage_per_role');
7
  function um_access_homepage_per_role() {
@@ -18,7 +18,7 @@
18
  }
19
 
20
  /***
21
- *** @
22
  ***/
23
  add_action('um_access_global_settings','um_access_global_settings');
24
  function um_access_global_settings() {
@@ -29,8 +29,9 @@
29
  if ( $access == 2 && ! is_user_logged_in() ) {
30
 
31
  $redirect = um_get_option('access_redirect');
32
- if ( !$redirect )
33
  $redirect = um_get_core_page('login');
 
34
 
35
  $redirects[] = untrailingslashit( um_get_core_page('login') );
36
  $redirects[] = untrailingslashit( um_get_option('access_redirect') );
@@ -47,14 +48,9 @@
47
  $current_url = untrailingslashit( $current_url );
48
  $current_url_slash = trailingslashit( $current_url );
49
 
50
- if ( ( isset( $post->ID ) || is_home() ) && ( in_array( $current_url, $redirects ) || in_array( $current_url_slash, $redirects ) ) ) {
51
  // allow
52
- } else if( is_archive() ){
53
-
54
- $ultimatemember->access->allow_access = false;
55
- $ultimatemember->access->redirect_handler = $redirect;
56
-
57
- } else {
58
  $ultimatemember->access->redirect_handler = $redirect;
59
  }
60
 
@@ -68,31 +64,108 @@
68
  do_action("um_access_post_type",$current_page_type);
69
  do_action("um_access_post_type_{$current_page_type}");
70
 
71
-
72
-
73
  }
74
 
75
  /***
76
- *** @
77
  ***/
78
  add_action('um_access_category_settings','um_access_category_settings');
79
  function um_access_category_settings() {
80
  global $post, $wp_query, $ultimatemember;
81
 
82
- $access = um_get_option('accessible');
83
-
84
- if( $access == 2 ){
 
 
 
85
  return;
 
86
  }
87
 
88
- if ( is_front_page() || is_home() || is_feed() ) {
 
 
 
 
89
 
90
- return;
 
 
 
 
 
 
 
 
91
 
92
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
- if ( is_single() || get_post_taxonomies( $post ) ) {
 
 
95
 
 
 
 
 
 
 
 
96
 
97
  $taxonomies = get_post_taxonomies( $post );
98
  $categories_ids = array();
@@ -104,7 +177,6 @@
104
  }
105
  }
106
 
107
-
108
  foreach( $categories_ids as $term => $term_id ) {
109
 
110
  $opt = get_option("category_$term_id");
@@ -146,57 +218,54 @@
146
  }
147
  }
148
 
149
- if( is_archive() ){
150
- $ultimatemember->access->allow_access = true;
151
- $ultimatemember->access->redirect_handler = false; // open to everyone
152
- }
153
  }
154
  }
 
 
155
  }
156
 
157
  /***
158
- *** @
159
  ***/
160
  add_action('um_access_post_settings','um_access_post_settings');
161
  function um_access_post_settings() {
162
  global $post, $ultimatemember;
163
-
164
- $access = um_get_option('accessible');
165
- if( $access == 2 ){
166
- return;
167
- }
168
 
169
  // woo commerce shop ID
170
  if( function_exists('is_shop') && is_shop() ) {
171
 
172
- $post_id = get_option('woocommerce_shop_page_id');
173
-
174
- } else if ( is_category() || is_archive() || is_front_page() || is_home() || is_search() || in_the_loop() || is_feed() ) {
175
-
 
 
 
 
 
 
 
 
 
 
176
 
177
  return;
178
 
179
- } else {
180
-
181
- if ( !get_post_type() || !isset($post->ID) ) return;
182
 
 
 
183
  }
184
 
185
-
186
-
187
- if ( !isset( $post_id ) )
188
- $post_id = $post->ID;
189
-
190
- $args = $ultimatemember->access->get_meta( $post_id );
191
-
192
- extract($args);
193
 
194
  if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
195
 
196
- $post_id = apply_filters('um_access_control_for_parent_posts', $post_id );
197
 
198
- $args = $ultimatemember->access->get_meta( $post_id );
199
- extract($args);
200
 
201
  if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
202
  return;
@@ -218,11 +287,16 @@
218
 
219
  case 1:
220
 
221
- if ( is_user_logged_in() )
222
  $redirect_to = esc_url( $access_redirect2 );
 
223
 
224
- if ( !is_user_logged_in() )
 
 
 
225
  $ultimatemember->access->allow_access = true;
 
226
 
227
  break;
228
 
@@ -252,7 +326,9 @@
252
  $redirect_to = esc_url( $access_redirect );
253
  }
254
  }
255
-
 
 
256
  break;
257
 
258
  }
@@ -264,11 +340,4 @@
264
  exit;
265
  }
266
 
267
- if ( $redirect_to ) {
268
- if ( ! is_feed() ) {
269
- $ultimatemember->access->allow_access = false;
270
- $ultimatemember->access->redirect_handler = esc_url( $redirect_to );
271
- }
272
- }
273
-
274
  }
1
  <?php
2
 
3
  /***
4
+ *** @Home/Frontpage access settings
5
  ***/
6
  add_action('um_access_homepage_per_role','um_access_homepage_per_role');
7
  function um_access_homepage_per_role() {
18
  }
19
 
20
  /***
21
+ *** @Global Access Settings
22
  ***/
23
  add_action('um_access_global_settings','um_access_global_settings');
24
  function um_access_global_settings() {
29
  if ( $access == 2 && ! is_user_logged_in() ) {
30
 
31
  $redirect = um_get_option('access_redirect');
32
+ if ( !$redirect ){
33
  $redirect = um_get_core_page('login');
34
+ }
35
 
36
  $redirects[] = untrailingslashit( um_get_core_page('login') );
37
  $redirects[] = untrailingslashit( um_get_option('access_redirect') );
48
  $current_url = untrailingslashit( $current_url );
49
  $current_url_slash = trailingslashit( $current_url );
50
 
51
+ if ( ( isset( $post->ID ) || is_home() || is_front_page() ) && ( in_array( $current_url, $redirects ) || in_array( $current_url_slash, $redirects ) ) ) {
52
  // allow
53
+ }else {
 
 
 
 
 
54
  $ultimatemember->access->redirect_handler = $redirect;
55
  }
56
 
64
  do_action("um_access_post_type",$current_page_type);
65
  do_action("um_access_post_type_{$current_page_type}");
66
 
 
 
67
  }
68
 
69
  /***
70
+ *** @Archieves/Taxonomies/Categories access settings
71
  ***/
72
  add_action('um_access_category_settings','um_access_category_settings');
73
  function um_access_category_settings() {
74
  global $post, $wp_query, $ultimatemember;
75
 
76
+ if ( is_front_page() ||
77
+ is_home() ||
78
+ is_feed() ||
79
+ is_page()
80
+ ) {
81
+
82
  return;
83
+
84
  }
85
 
86
+ $access = um_get_option('accessible');
87
+ $current_page_type = um_get_current_page_type();
88
+
89
+
90
+ if( is_category() && ! in_array( $current_page_type , array( 'day','month','year','author','archive' ) ) ){
91
 
92
+ $um_category = get_the_category();
93
+ $um_category = current( $um_category );
94
+ $term_id = $um_category->term_id;
95
+
96
+ if( isset( $term_id ) ){
97
+
98
+ $opt = get_option("category_$term_id");
99
+
100
+ if ( isset( $opt['_um_accessible'] ) ) {
101
 
102
+ $redirect = false;
103
+
104
+ switch( $opt['_um_accessible'] ) {
105
+
106
+ case 0:
107
+
108
+ $ultimatemember->access->allow_access = true;
109
+ $ultimatemember->access->redirect_handler = ''; // open to everyone
110
+
111
+ break;
112
+
113
+ case 1:
114
+
115
+ if ( is_user_logged_in() ){
116
+
117
+ if( isset( $opt['_um_redirect'] ) ) {
118
+ $redirect = esc_url( $opt['_um_redirect'] );
119
+ }else{
120
+ $redirect = site_url();
121
+ }
122
+ }
123
+
124
+ $ultimatemember->access->redirect_handler = $redirect;
125
+
126
+ if ( !is_user_logged_in() ){
127
+ $ultimatemember->access->allow_access = true;
128
+ }
129
+
130
+ break;
131
+
132
+ case 2:
133
+
134
+ if ( ! is_user_logged_in() ){
135
+
136
+ if( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ){
137
+ $redirect = esc_url( $opt['_um_redirect'] );
138
+ }else{
139
+ $redirect = um_get_core_page('login');
140
+ }
141
+ $ultimatemember->access->allow_access = false;
142
+ $ultimatemember->access->redirect_handler = $redirect;
143
+ }
144
+
145
+ if ( is_user_logged_in() && isset( $opt['_um_roles'] ) && !empty( $opt['_um_roles'] ) ){
146
+ if ( ! in_array( um_user('role'), $opt['_um_roles'] ) ) {
147
+
148
+
149
+ if( isset( $opt['_um_redirect'] ) ){
150
+ $redirect = esc_url( $opt['_um_redirect'] );
151
+ }
152
+
153
+ $ultimatemember->access->redirect_handler = $redirect;
154
+
155
+ }
156
+ }
157
 
158
+ }
159
+ }
160
+ }
161
 
162
+ } else if ( $access == 2 && ! is_user_logged_in() && is_archive() ) {
163
+
164
+ $ultimatemember->access->allow_access = false;
165
+ $redirect = um_get_core_page('login');
166
+ $ultimatemember->access->redirect_handler = $redirect;
167
+
168
+ } else if ( is_tax() && get_post_taxonomies( $post ) ) {
169
 
170
  $taxonomies = get_post_taxonomies( $post );
171
  $categories_ids = array();
177
  }
178
  }
179
 
 
180
  foreach( $categories_ids as $term => $term_id ) {
181
 
182
  $opt = get_option("category_$term_id");
218
  }
219
  }
220
 
 
 
 
 
221
  }
222
  }
223
+
224
+
225
  }
226
 
227
  /***
228
+ *** @Posts/Page access settings
229
  ***/
230
  add_action('um_access_post_settings','um_access_post_settings');
231
  function um_access_post_settings() {
232
  global $post, $ultimatemember;
 
 
 
 
 
233
 
234
  // woo commerce shop ID
235
  if( function_exists('is_shop') && is_shop() ) {
236
 
237
+ $um_post_id = get_option('woocommerce_shop_page_id');
238
+
239
+ } else if (
240
+ is_category() ||
241
+ is_archive() ||
242
+ is_front_page() ||
243
+ is_home() ||
244
+ is_search() ||
245
+ in_the_loop() ||
246
+ is_feed() ||
247
+ is_tax() ||
248
+ ! get_post_type() ||
249
+ ! isset( $post->ID )
250
+ ) {
251
 
252
  return;
253
 
254
+ }
 
 
255
 
256
+ if ( !isset( $um_post_id ) ){
257
+ $um_post_id = $post->ID;
258
  }
259
 
260
+ $args = $ultimatemember->access->get_meta( $um_post_id );
261
+ extract( $args );
 
 
 
 
 
 
262
 
263
  if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
264
 
265
+ $um_post_id = apply_filters('um_access_control_for_parent_posts', $um_post_id );
266
 
267
+ $args = $ultimatemember->access->get_meta( $um_post_id );
268
+ extract( $args );
269
 
270
  if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
271
  return;
287
 
288
  case 1:
289
 
290
+ if ( is_user_logged_in() ){
291
  $redirect_to = esc_url( $access_redirect2 );
292
+ }
293
 
294
+ $ultimatemember->access->redirect_handler = esc_url( $redirect_to );
295
+
296
+
297
+ if ( !is_user_logged_in() ){
298
  $ultimatemember->access->allow_access = true;
299
+ }
300
 
301
  break;
302
 
326
  $redirect_to = esc_url( $access_redirect );
327
  }
328
  }
329
+
330
+ $ultimatemember->access->redirect_handler = esc_url( $redirect_to );
331
+
332
  break;
333
 
334
  }
340
  exit;
341
  }
342
 
 
 
 
 
 
 
 
343
  }
core/um-permalinks.php CHANGED
@@ -70,7 +70,6 @@ class UM_Permalinks {
70
 
71
  $blog_id = get_current_blog_id();
72
  $siteurl = get_site_url( $blog_id );
73
-
74
  if ( is_front_page() ) {
75
  $page_url = $siteurl;
76
 
@@ -78,7 +77,21 @@ class UM_Permalinks {
78
  $page_url .= '?' . $_SERVER['QUERY_STRING'];
79
  }
80
  }else {
81
- $page_url = $siteurl;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
84
  $page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
@@ -89,6 +102,7 @@ class UM_Permalinks {
89
 
90
  }
91
 
 
92
  }else{
93
  if ( !isset( $_SERVER['SERVER_NAME'] ) )
94
  return '';
70
 
71
  $blog_id = get_current_blog_id();
72
  $siteurl = get_site_url( $blog_id );
 
73
  if ( is_front_page() ) {
74
  $page_url = $siteurl;
75
 
77
  $page_url .= '?' . $_SERVER['QUERY_STRING'];
78
  }
79
  }else {
80
+
81
+ if( $_SERVER[ $server_name_method ] == "localhost" ){
82
+
83
+ $page_url = 'http';
84
+
85
+ if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
86
+ $page_url .= "s";
87
+ }
88
+
89
+ $page_url .= "://";
90
+
91
+ $page_url .= $_SERVER[ $server_name_method ];
92
+ }else{
93
+ $page_url .= $siteurl;
94
+ }
95
 
96
  if ( $um_port_forwarding_url == 1 && isset( $_SERVER["SERVER_PORT"] ) ) {
97
  $page_url .= ":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
102
 
103
  }
104
 
105
+
106
  }else{
107
  if ( !isset( $_SERVER['SERVER_NAME'] ) )
108
  return '';
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.60
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.61
7
  Author: Ultimate Member
8
  Author URI: http://ultimatemember.com/
9
  Text Domain: ultimatemember
readme.txt CHANGED
@@ -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.5.3
9
 
10
- Stable Tag: 1.3.60
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
@@ -149,6 +149,10 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
149
 
150
  == Changelog ==
151
 
 
 
 
 
152
  = 1.3.60: June 23, 2016 =
153
  * Fixed: change password
154
  * Fixed: menu settings and roles
7
  Requires at least: 4.1
8
  Tested up to: 4.5.3
9
 
10
+ Stable Tag: 1.3.61
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
149
 
150
  == Changelog ==
151
 
152
+ = 1.3.61: June 24, 2016 =
153
+ * Fixed: edit profile url in multi-site setup
154
+ * Fixed: global access settings
155
+
156
  = 1.3.60: June 23, 2016 =
157
  * Fixed: change password
158
  * Fixed: menu settings and roles