Ultimate Member – User Profile & Membership Plugin - Version 1.0.34

Version Description

Download this release

Release Info

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

Code changes from version 1.0.33 to 1.0.34

admin/core/um-admin-metabox.php CHANGED
@@ -348,7 +348,7 @@ class UM_Admin_Metabox {
348
349
$where = array( 'ID' => $post_id );
350
if (empty($_POST['post_title'])) $_POST['post_title'] = 'Role #'.$post_id;
351
- $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'] ), $where );
352
353
// save
354
delete_post_meta( $post_id, '_um_can_view_roles' );
348
349
$where = array( 'ID' => $post_id );
350
if (empty($_POST['post_title'])) $_POST['post_title'] = 'Role #'.$post_id;
351
+ $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'], 'post_name' => wp_unique_post_slug( sanitize_title( $_POST['post_title'] ) ) ), $where );
352
353
// save
354
delete_post_meta( $post_id, '_um_can_view_roles' );
core/um-actions-access.php CHANGED
@@ -61,7 +61,7 @@
61
62
$post_id = get_option('woocommerce_shop_page_id');
63
64
- } else if ( is_archive() ) {
65
66
return;
67
61
62
$post_id = get_option('woocommerce_shop_page_id');
63
64
+ } else if ( is_archive() || is_front_page() || is_search() || in_the_loop() ) {
65
66
return;
67
core/um-actions-posts.php ADDED
@@ -0,0 +1,53 @@
1
+ <?php
2
+
3
+ /***
4
+ *** @Search results
5
+ ***/
6
+ add_action('pre_get_posts','um_pre_get_posts');
7
+ function um_pre_get_posts($query) {
8
+
9
+ if ( !is_admin() && $query->is_main_query() ) {
10
+
11
+ if ( $query->is_search || $query->is_archive() || $query->is_home ) {
12
+
13
+ if ( $query->is_home && !um_get_option('exclude_from_main_loop' ) ) return;
14
+ if ( $query->is_archive && !um_get_option('exclude_from_archive_loop' ) ) return;
15
+ if ( $query->is_search && !um_get_option('exclude_from_search_loop' ) ) return;
16
+
17
+ if ( is_user_logged_in() ) {
18
+
19
+ $meta_query['relation'] = 'OR';
20
+ $meta_query[] = array(
21
+ 'key'=>'_um_accessible',
22
+ 'value'=>'1',
23
+ 'compare'=>'!=',
24
+ );
25
+ $meta_query[] = array(
26
+ 'key'=>'_um_accessible',
27
+ 'compare'=>'NOT EXISTS',
28
+ );
29
+ $query->set('meta_query',$meta_query);
30
+
31
+ }
32
+
33
+ if ( !is_user_logged_in() ) {
34
+
35
+ $meta_query['relation'] = 'OR';
36
+ $meta_query[] = array(
37
+ 'key'=>'_um_accessible',
38
+ 'value'=>'2',
39
+ 'compare'=>'!=',
40
+ );
41
+ $meta_query[] = array(
42
+ 'key'=>'_um_accessible',
43
+ 'compare'=>'NOT EXISTS',
44
+ );
45
+ $query->set('meta_query',$meta_query);
46
+
47
+ }
48
+
49
+ }
50
+
51
+ }
52
+
53
+ }
core/um-actions-profile.php CHANGED
@@ -141,9 +141,11 @@
141
add_action('um_profile_header_cover_area', 'um_profile_header_cover_area' );
142
function um_profile_header_cover_area( $args ) {
143
global $ultimatemember;
144
-
145
- if ( $args['cover_enabled'] == 1 ) {
146
147
$overlay = '<span class="um-cover-overlay">
148
<span class="um-cover-overlay-s">
149
<ins>
@@ -155,7 +157,7 @@
155
156
?>
157
158
- <div class="um-cover <?php if ( um_profile('cover_photo') ) echo 'has-cover'; ?>" data-user_id="<?php echo um_profile_id(); ?>" data-ratio="<?php echo $args['cover_ratio']; ?>">
159
160
<?php
161
@@ -170,7 +172,6 @@
170
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-cover', 'click', $items );
171
172
}
173
-
174
?>
175
176
<?php $ultimatemember->fields->add_hidden_field( 'cover_photo' ); ?>
@@ -195,13 +196,21 @@
195
196
?>
197
198
- <?php } else { ?>
199
200
- <?php if ( !isset( $ultimatemember->user->cannot_edit ) ) { ?>
201
- <a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="<?php _e('Upload a cover photo','ultimatemember'); ?>"></i></span></a>
202
- <?php } ?>
203
204
- <?php } ?>
205
206
</div>
207
@@ -507,7 +516,11 @@
507
508
$tabs = $ultimatemember->profile->tabs_active();
509
510
- if ( count( $tabs ) == 1 ) return;
511
512
$active_tab = $ultimatemember->profile->active_tab();
513
@@ -528,7 +541,7 @@
528
$nav_link = add_query_arg('profiletab', $id, $nav_link )
529
?>
530
531
- <div class="um-profile-nav-item <?php if ( !um_get_option('profile_menu_counts') ) { echo 'without-icon'; } ?> <?php if ( $id == $active_tab ) { echo 'active'; } ?>">
532
<a href="<?php echo $nav_link; ?>" title="<?php echo $tab['name']; ?>">
533
534
<i class="<?php echo $tab['icon']; ?>"></i>
@@ -551,7 +564,7 @@
551
552
if ( isset( $tab['subnav'] ) && $active_tab == $id ) {
553
554
- $active_subnav = (isset($ultimatemember->profile->active_subnav)) ? $ultimatemember->profile->active_subnav : $tab['subnav_default'];
555
556
echo '<div class="um-profile-subnav">';
557
foreach( $tab['subnav'] as $id => $subtab ) {
141
add_action('um_profile_header_cover_area', 'um_profile_header_cover_area' );
142
function um_profile_header_cover_area( $args ) {
143
global $ultimatemember;
144
145
+ if ( $args['cover_enabled'] == 1 ) {
146
+
147
+ $default_cover = um_get_option('default_cover');
148
+
149
$overlay = '<span class="um-cover-overlay">
150
<span class="um-cover-overlay-s">
151
<ins>
157
158
?>
159
160
+ <div class="um-cover <?php if ( um_profile('cover_photo') || ( $default_cover && $default_cover['url'] ) ) echo 'has-cover'; ?>" data-user_id="<?php echo um_profile_id(); ?>" data-ratio="<?php echo $args['cover_ratio']; ?>">
161
162
<?php
163
172
echo $ultimatemember->menu->new_ui( 'bc', 'div.um-cover', 'click', $items );
173
174
}
175
?>
176
177
<?php $ultimatemember->fields->add_hidden_field( 'cover_photo' ); ?>
196
197
?>
198
199
+ <?php } elseif ( $default_cover && $default_cover['url'] ) {
200
+
201
+ $default_cover = $default_cover['url'];
202
+
203
+ echo '<img src="'. $default_cover . '" alt="" />';
204
+
205
+ } else {
206
207
+ if ( !isset( $ultimatemember->user->cannot_edit ) ) { ?>
208
209
+ <a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="<?php _e('Upload a cover photo','ultimatemember'); ?>"></i></span></a>
210
+
211
+ <?php }
212
+
213
+ } ?>
214
215
</div>
216
516
517
$tabs = $ultimatemember->profile->tabs_active();
518
519
+ $tabs = apply_filters('um_user_profile_tabs', $tabs );
520
+
521
+ $ultimatemember->user->tabs = $tabs;
522
+
523
+ if ( count( $tabs ) <= 1 ) return;
524
525
$active_tab = $ultimatemember->profile->active_tab();
526
541
$nav_link = add_query_arg('profiletab', $id, $nav_link )
542
?>
543
544
+ <div class="um-profile-nav-item <?php if ( !um_get_option('profile_menu_icons') ) { echo 'without-icon'; } ?> <?php if ( $id == $active_tab ) { echo 'active'; } ?>">
545
<a href="<?php echo $nav_link; ?>" title="<?php echo $tab['name']; ?>">
546
547
<i class="<?php echo $tab['icon']; ?>"></i>
564
565
if ( isset( $tab['subnav'] ) && $active_tab == $id ) {
566
567
+ $active_subnav = ( $ultimatemember->profile->active_subnav() ) ? $ultimatemember->profile->active_subnav() : $tab['subnav_default'];
568
569
echo '<div class="um-profile-subnav">';
570
foreach( $tab['subnav'] as $id => $subtab ) {
core/um-fields.php CHANGED
@@ -48,7 +48,6 @@ class UM_Fields {
48
echo $output;
49
50
echo '</div>';
51
-
52
}
53
54
/***
@@ -448,28 +447,6 @@ class UM_Fields {
448
449
return false;
450
}
451
-
452
- /***
453
- *** @Fix for children custom fields
454
- ***/
455
- function find_custom_field_data($key, $fields) {
456
- foreach ($fields as $k => $v) {
457
-
458
- if ( $k == $key ){
459
- return $fields[$key];
460
- }
461
-
462
- if (isset($fields[$k]['fields'])) {
463
- foreach( $fields[$k]['fields'] as $k1 => $v1 ){
464
- if ($k1 == $key){
465
- return $fields[$k]['fields'][$k1];
466
- }
467
- }
468
- }
469
-
470
- }
471
- return array('');
472
- }
473
474
/***
475
*** @Get Field Icon
@@ -509,9 +486,9 @@ class UM_Fields {
509
global $ultimatemember;
510
511
$fields = $this->get_fields();
512
-
513
- if ( isset( $fields ) && is_array( $fields ) ) {
514
- $array = $this->find_custom_field_data($key, $fields);
515
} else {
516
$array = $ultimatemember->builtin->predefined_fields[$key];
517
}
@@ -1358,7 +1335,7 @@ class UM_Fields {
1358
1359
$v = rtrim($v);
1360
1361
- if ( !is_numeric( $k ) ) {
1362
$option_value = $k;
1363
} else {
1364
$option_value = $v;
@@ -1456,7 +1433,7 @@ class UM_Fields {
1456
1457
$v = rtrim($v);
1458
1459
- if ( !is_numeric( $k ) ) {
1460
$option_value = $k;
1461
} else {
1462
$option_value = $v;
48
echo $output;
49
50
echo '</div>';
51
}
52
53
/***
447
448
return false;
449
}
450
451
/***
452
*** @Get Field Icon
486
global $ultimatemember;
487
488
$fields = $this->get_fields();
489
+
490
+ if ( isset( $fields ) && is_array( $fields ) && isset( $fields[$key] ) ) {
491
+ $array = $fields[$key];
492
} else {
493
$array = $ultimatemember->builtin->predefined_fields[$key];
494
}
1335
1336
$v = rtrim($v);
1337
1338
+ if ( !is_numeric( $k ) && in_array($form_key, array('role') ) ) {
1339
$option_value = $k;
1340
} else {
1341
$option_value = $v;
1433
1434
$v = rtrim($v);
1435
1436
+ if ( !is_numeric( $k ) && in_array($form_key, array('role') ) ) {
1437
$option_value = $k;
1438
} else {
1439
$option_value = $v;
core/um-filters-profile.php CHANGED
@@ -18,7 +18,7 @@
18
*** @dynamic profile page title
19
***/
20
add_filter('wp_title', 'um_dynamic_user_profile_pagetitle', 100000, 2 );
21
- function um_dynamic_user_profile_pagetitle( $title, $sep ) {
22
global $paged, $page, $ultimatemember;
23
24
$profile_title = um_get_option('profile_title');
18
*** @dynamic profile page title
19
***/
20
add_filter('wp_title', 'um_dynamic_user_profile_pagetitle', 100000, 2 );
21
+ function um_dynamic_user_profile_pagetitle( $title, $sep = '' ) {
22
global $paged, $page, $ultimatemember;
23
24
$profile_title = um_get_option('profile_title');
core/um-profile.php CHANGED
@@ -5,7 +5,8 @@ class UM_Profile {
5
function __construct() {
6
7
add_action('template_redirect', array(&$this, 'active_tab'), 10002);
8
-
9
}
10
11
/***
@@ -39,7 +40,7 @@ class UM_Profile {
39
}
40
41
/***
42
- *** @Get active tab
43
***/
44
function active_tab() {
45
@@ -48,12 +49,22 @@ class UM_Profile {
48
if ( get_query_var('profiletab') ) {
49
$this->active_tab = get_query_var('profiletab');
50
}
51
52
if ( get_query_var('subnav') ) {
53
$this->active_subnav = get_query_var('subnav');
54
}
55
56
- return $this->active_tab;
57
}
58
59
/***
5
function __construct() {
6
7
add_action('template_redirect', array(&$this, 'active_tab'), 10002);
8
+ add_action('template_redirect', array(&$this, 'active_subnav'), 10002);
9
+
10
}
11
12
/***
40
}
41
42
/***
43
+ *** @Get active_tab
44
***/
45
function active_tab() {
46
49
if ( get_query_var('profiletab') ) {
50
$this->active_tab = get_query_var('profiletab');
51
}
52
+
53
+ return $this->active_tab;
54
+ }
55
+
56
+ /***
57
+ *** @Get active active_subnav
58
+ ***/
59
+ function active_subnav() {
60
+
61
+ $this->active_subnav = null;
62
63
if ( get_query_var('subnav') ) {
64
$this->active_subnav = get_query_var('subnav');
65
}
66
67
+ return $this->active_subnav;
68
}
69
70
/***
core/um-short-functions.php CHANGED
@@ -710,6 +710,17 @@
710
return $uri;
711
}
712
713
/***
714
*** @get user data
715
***/
@@ -846,15 +857,27 @@
846
$avatar_uri = um_get_default_avatar_uri();
847
}
848
849
- return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
850
-
851
break;
852
853
case 'cover_photo':
854
if ( um_profile('cover_photo') ) {
855
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
856
- return '<img src="'. $cover_uri .'" alt="" />';
857
}
858
break;
859
860
}
710
return $uri;
711
}
712
713
+ /***
714
+ *** @default cover
715
+ ***/
716
+ function um_get_default_cover_uri() {
717
+ $uri = um_get_option('default_cover');
718
+ $uri = $uri['url'];
719
+ if ( $uri )
720
+ return $uri;
721
+ return '';
722
+ }
723
+
724
/***
725
*** @get user data
726
***/
857
$avatar_uri = um_get_default_avatar_uri();
858
}
859
860
+ if ( $avatar_uri )
861
+ return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
862
+
863
+ if ( !$avatar_uri )
864
+ return '';
865
+
866
break;
867
868
case 'cover_photo':
869
if ( um_profile('cover_photo') ) {
870
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
871
+ } else {
872
+ $cover_uri = um_get_default_cover_uri();
873
}
874
+
875
+ if ( $cover_uri )
876
+ return '<img src="'. $cover_uri .'" alt="" />';
877
+
878
+ if ( !$cover_uri )
879
+ return '';
880
+
881
break;
882
883
}
index.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Ultimate Member
4
Plugin URI: http://ultimatemember.com/
5
Description: Ultimate Member is a powerful community and membership plugin that allows you to create beautiful community and membership sites with WordPress
6
- Version: 1.0.33
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
*/
3
Plugin Name: Ultimate Member
4
Plugin URI: http://ultimatemember.com/
5
Description: Ultimate Member is a powerful community and membership plugin that allows you to create beautiful community and membership sites with WordPress
6
+ Version: 1.0.34
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
*/
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.1
9
10
- Stable Tag: 1.0.33
11
12
License: GNU Version 2 or Any Later Version
13
@@ -175,6 +175,16 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
175
176
== Changelog ==
177
178
= 1.0.33: January 30, 2015 =
179
180
* New: Introducing profile menu / tab system (optional)
7
Requires at least: 4.1
8
Tested up to: 4.1
9
10
+ Stable Tag: 1.0.34
11
12
License: GNU Version 2 or Any Later Version
13
175
176
== Changelog ==
177
178
+ = 1.0.34: January 31, 2015 =
179
+
180
+ * New: added option to set a default cover photo
181
+ * New: added option to hide restricted content from search and archive
182
+ * Fixed: php error in title tab with ElegantThemes
183
+ * Fixed: theme conflict with photo/cover upload
184
+ * Fixed: issue with country field showing country code in profile
185
+ * Fixed: issue with setting default tab
186
+ * Fixed: issue with 2-name user roles
187
+
188
= 1.0.33: January 30, 2015 =
189
190
* New: Introducing profile menu / tab system (optional)
um-config.php CHANGED
@@ -167,6 +167,15 @@ $this->sections[] = array(
167
'title' => __( 'Access'),
168
'fields' => array(
169
170
array(
171
'id' => 'accessible',
172
'type' => 'select',
@@ -199,12 +208,33 @@ $this->sections[] = array(
199
),
200
201
array(
202
- 'id' => 'panic_key',
203
- 'type' => 'text',
204
- 'title' => __( 'Panic Key' ),
205
- 'desc' => 'Panic Key is a random generated key that allow you to access the WordPress backend always regardless of backend settings.',
206
- 'default' => $ultimatemember->validation->randomize(),
207
- 'desc' => trailingslashit( get_bloginfo('url') ).'wp-admin/?um_panic_key=<strong>YOUR_PANIC_KEY_VALUE</strong>'
208
),
209
210
array(
@@ -1128,8 +1158,6 @@ $this->sections[] = array(
1128
array(
1129
'id' => 'default_avatar',
1130
'type' => 'media',
1131
- 'width' => '150',
1132
- 'height' => '150',
1133
'title' => __('Default Profile Photo', 'ultimatemember'),
1134
'desc' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimatemember'),
1135
'default' => array(
@@ -1137,6 +1165,15 @@ $this->sections[] = array(
1137
),
1138
),
1139
1140
array(
1141
'id' => 'profile_photosize',
1142
'type' => 'text',
167
'title' => __( 'Access'),
168
'fields' => array(
169
170
+ array(
171
+ 'id' => 'panic_key',
172
+ 'type' => 'text',
173
+ 'title' => __( 'Panic Key' ),
174
+ 'desc' => 'Panic Key is a random generated key that allow you to access the WordPress backend always regardless of backend settings.',
175
+ 'default' => $ultimatemember->validation->randomize(),
176
+ 'desc' => trailingslashit( get_bloginfo('url') ).'wp-admin/?um_panic_key=<strong>your_panic_key</strong>'
177
+ ),
178
+
179
array(
180
'id' => 'accessible',
181
'type' => 'select',
208
),
209
210
array(
211
+ 'id' => 'exclude_from_main_loop',
212
+ 'type' => 'switch',
213
+ 'title' => __( 'Exclude restricted pages from main loop' ),
214
+ 'default' => 1,
215
+ 'desc' => 'Whether to exclude restricted pages from main loop',
216
+ 'on' => __('Yes','ultimatemember'),
217
+ 'off' => __('No','ultimatemember'),
218
+ ),
219
+
220
+ array(
221
+ 'id' => 'exclude_from_search_loop',
222
+ 'type' => 'switch',
223
+ 'title' => __( 'Exclude restricted pages from search loop' ),
224
+ 'default' => 1,
225
+ 'desc' => 'Whether to exclude restricted pages from search results',
226
+ 'on' => __('Yes','ultimatemember'),
227
+ 'off' => __('No','ultimatemember'),
228
+ ),
229
+
230
+ array(
231
+ 'id' => 'exclude_from_archive_loop',
232
+ 'type' => 'switch',
233
+ 'title' => __( 'Exclude restricted pages from archive loop' ),
234
+ 'default' => 1,
235
+ 'desc' => 'Whether to exclude restricted pages from archives',
236
+ 'on' => __('Yes','ultimatemember'),
237
+ 'off' => __('No','ultimatemember'),
238
),
239
240
array(
1158
array(
1159
'id' => 'default_avatar',
1160
'type' => 'media',
1161
'title' => __('Default Profile Photo', 'ultimatemember'),
1162
'desc' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimatemember'),
1163
'default' => array(
1165
),
1166
),
1167
1168
+ array(
1169
+ 'id' => 'default_cover',
1170
+ 'type' => 'media',
1171
+ 'url' => true,
1172
+ 'preview' => false,
1173
+ 'title' => __('Default Cover Photo', 'ultimatemember'),
1174
+ 'desc' => __('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.', 'ultimatemember'),
1175
+ ),
1176
+
1177
array(
1178
'id' => 'profile_photosize',
1179
'type' => 'text',
um-init.php CHANGED
@@ -75,6 +75,7 @@ class UM_API {
75
require_once um_path . 'core/um-actions-save-profile.php';
76
require_once um_path . 'core/um-actions-modal.php';
77
require_once um_path . 'core/um-actions-misc.php';
78
79
require_once um_path . 'core/um-filters-login.php';
80
require_once um_path . 'core/um-filters-register.php';
75
require_once um_path . 'core/um-actions-save-profile.php';
76
require_once um_path . 'core/um-actions-modal.php';
77
require_once um_path . 'core/um-actions-misc.php';
78
+ require_once um_path . 'core/um-actions-posts.php';
79
80
require_once um_path . 'core/um-filters-login.php';
81
require_once um_path . 'core/um-filters-register.php';