Ultimate Member – User Profile & Membership Plugin - Version 1.0.44

Version Description

Download this release

Release Info

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

Code changes from version 1.0.43 to 1.0.44

admin/assets/css/um-admin-dashboard.css CHANGED
@@ -81,55 +81,6 @@
81
  padding-left: 4px;
82
  }
83
 
84
- /*
85
- - Nav
86
- */
87
-
88
- .um-admin-dash-nav {
89
- float: left;
90
- width: 202px;
91
- min-height: 300px;
92
- display: none !important;
93
- }
94
-
95
- .um-admin-dash-nav a {
96
- font-family: Open Sans;
97
- font-size: 14px;
98
- position: relative;
99
- display: block;
100
- padding: 10px 4px 10px 14px;
101
- border-width: 1px 0px;
102
- border-style: solid;
103
- border-bottom: 1px solid #E7E7E7;
104
- border-top: 0px none;
105
- font-weight: 700;
106
- text-decoration: none;
107
- transition: none 0s ease 0s;
108
- background: transparent !important;
109
- color: #555 !important;
110
- }
111
-
112
- .um-admin-dash-nav-title {
113
- padding-left: 30px;
114
- }
115
-
116
- .um-admin-dash-nav a:hover {
117
- background: #ddd !important;
118
- }
119
-
120
- .um-admin-dash-nav a.active,
121
- .um-admin-dash-nav a.active:hover {
122
- color: #3ba1da !important;
123
- background: transparent !important;
124
- }
125
-
126
- .um-admin-dash-nav a i {
127
- vertical-align: middle;
128
- font-size: 1.35em;
129
- position: absolute;
130
- top: 8px;
131
- }
132
-
133
  /*
134
  - Main
135
  */
@@ -139,8 +90,6 @@
139
  border-left: 1px solid #D8D8D8;
140
  padding: 0 30px 30px 30px;
141
  box-shadow: 0px 1px 0px #FFF inset;
142
- min-height: 300px;
143
-
144
  border-left: none;
145
  margin-left: 0;
146
  }
@@ -151,9 +100,10 @@
151
  margin: 0 !important;
152
  }
153
 
154
- .um-admin-dash-content {
155
- display: none;
156
- display: block;
 
157
  }
158
 
159
  .um-admin-dash-review {
@@ -187,6 +137,20 @@
187
  - Dashboard styles
188
  */
189
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  .um-admin-dash-two-col .um-admin-dash-col {
191
  display: inline-block;
192
  width: 46%;
@@ -197,6 +161,13 @@
197
  .um-admin-dash-col a:hover {text-decoration: underline}
198
  .um-admin-dash-col a {text-decoration: none}
199
 
 
 
 
 
 
 
 
200
  .um-admin-dash-item {
201
  padding: 5px 0;
202
  vertical-align: middle;
81
  padding-left: 4px;
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  /*
85
  - Main
86
  */
90
  border-left: 1px solid #D8D8D8;
91
  padding: 0 30px 30px 30px;
92
  box-shadow: 0px 1px 0px #FFF inset;
 
 
93
  border-left: none;
94
  margin-left: 0;
95
  }
100
  margin: 0 !important;
101
  }
102
 
103
+ .um-admin-dash-main h4{
104
+ font-weight: 500;
105
+ padding: 30px 0 10px 0;
106
+ margin: 0 !important;
107
  }
108
 
109
  .um-admin-dash-review {
137
  - Dashboard styles
138
  */
139
 
140
+ .um-admin-dash-four-col .um-admin-dash-col {
141
+ float: left;
142
+ width: 25%;
143
+ text-align: center;
144
+ }
145
+
146
+ .um-admin-dash-three-col {border-bottom: 1px solid #ddd;padding-bottom: 25px}
147
+
148
+ .um-admin-dash-three-col .um-admin-dash-col {
149
+ float: left;
150
+ width: 33%;
151
+ text-align: center;
152
+ }
153
+
154
  .um-admin-dash-two-col .um-admin-dash-col {
155
  display: inline-block;
156
  width: 46%;
161
  .um-admin-dash-col a:hover {text-decoration: underline}
162
  .um-admin-dash-col a {text-decoration: none}
163
 
164
+ .um-admin-dash-num {
165
+ display: inline-block;
166
+ margin: 8px 0 0 0;
167
+ font-size: 28px;
168
+ font-weight: 300;
169
+ }
170
+
171
  .um-admin-dash-item {
172
  padding: 5px 0;
173
  vertical-align: middle;
admin/assets/css/um-admin-misc.css CHANGED
@@ -95,13 +95,13 @@ body.um-admin-modal-open {
95
 
96
  .um-admin a.button-primary,
97
  .um-admin input.button-primary {
98
- background: #3ba1da !important;
99
  box-shadow: none !important;
100
  border-radius: 2px;
101
  color: #fff;
102
  }
103
  .um-admin a.button-primary:hover,
104
- .um-admin input.button-primary:hover {background: #44b0ec !important;}
105
 
106
  /*
107
  - Form Inputs
95
 
96
  .um-admin a.button-primary,
97
  .um-admin input.button-primary {
98
+ background: #3ba1da;
99
  box-shadow: none !important;
100
  border-radius: 2px;
101
  color: #fff;
102
  }
103
  .um-admin a.button-primary:hover,
104
+ .um-admin input.button-primary:hover {background: #44b0ec;}
105
 
106
  /*
107
  - Form Inputs
admin/core/um-admin-enqueue.php CHANGED
@@ -232,9 +232,7 @@ class UM_Admin_Enqueue {
232
  if ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') )return true;
233
 
234
  if ( $screen_id == 'nav-menus' ) return true;
235
-
236
- if ( isset( $post->post_type ) ) return true;
237
-
238
  return false;
239
 
240
  }
@@ -252,36 +250,33 @@ class UM_Admin_Enqueue {
252
  *** @Enqueue scripts and styles
253
  ***/
254
  function admin_enqueue_scripts(){
255
- global $ultimatemember;
256
 
257
  if ( $this->is_UM_admin() ) {
258
 
259
- $ultimatemember->styles->wp_enqueue_scripts();
260
-
261
- $this->load_global_css();
262
-
263
- $this->load_form();
264
-
265
- $this->load_modal();
266
-
267
- $this->load_dashboard();
268
-
269
- $this->load_field();
270
-
271
- $this->load_users_js();
272
-
273
- $this->load_builder();
274
-
275
- $this->load_redux_css();
276
-
277
- $this->load_css();
278
-
279
- $this->load_core_wp();
280
-
281
- $this->load_ajax_js();
282
-
283
- $this->load_custom_scripts();
284
-
285
  }
286
 
287
  }
232
  if ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') )return true;
233
 
234
  if ( $screen_id == 'nav-menus' ) return true;
235
+
 
 
236
  return false;
237
 
238
  }
250
  *** @Enqueue scripts and styles
251
  ***/
252
  function admin_enqueue_scripts(){
253
+ global $ultimatemember, $post;
254
 
255
  if ( $this->is_UM_admin() ) {
256
 
257
+ $ultimatemember->styles->wp_enqueue_scripts();
258
+
259
+ $this->load_global_css();
260
+ $this->load_form();
261
+ $this->load_modal();
262
+ $this->load_dashboard();
263
+ $this->load_field();
264
+ $this->load_users_js();
265
+ $this->load_builder();
266
+ $this->load_redux_css();
267
+ $this->load_css();
268
+ $this->load_core_wp();
269
+ $this->load_ajax_js();
270
+ $this->load_custom_scripts();
271
+
272
+ } else if ( isset( $post->post_type ) ) {
273
+
274
+ $ultimatemember->styles->wp_enqueue_scripts();
275
+
276
+ $this->load_global_css();
277
+ $this->load_css();
278
+ $this->load_custom_scripts();
279
+
 
 
 
280
  }
281
 
282
  }
admin/templates/dashboard.php CHANGED
@@ -7,35 +7,21 @@
7
  <div class="um-admin-dash-head-logo">
8
  <h2>Dashboard</h2>
9
  <span><?php echo ultimatemember_version; ?></span>
10
- </div>
11
-
12
- <div class="um-admin-clear"></div>
13
-
14
  </div>
15
 
16
  <div class="um-admin-dash-body">
17
-
18
- <div class="um-admin-dash-nav">
19
-
20
- <a href="#" class="active" data-rel="overview"><span class="um-admin-dash-nav-title">Dashboard Overview</span></a>
21
-
22
- </div>
23
-
24
  <div class="um-admin-dash-main">
25
 
26
- <?php $tabs = array('overview'); ?>
27
-
28
- <?php foreach( $tabs as $tab ) { ?>
29
- <div class="um-admin-dash-content" id="<?php echo $tab; ?>">
30
 
31
- <?php include_once um_path . 'admin/templates/dashboard/'. $tab . '.php'; ?>
32
-
33
  </div>
34
- <?php } ?>
35
 
36
- </div>
37
-
38
- <div class="um-admin-clear"></div>
39
 
40
  </div>
41
 
7
  <div class="um-admin-dash-head-logo">
8
  <h2>Dashboard</h2>
9
  <span><?php echo ultimatemember_version; ?></span>
10
+ </div><div class="um-admin-clear"></div>
11
+
 
 
12
  </div>
13
 
14
  <div class="um-admin-dash-body">
15
+
 
 
 
 
 
 
16
  <div class="um-admin-dash-main">
17
 
18
+ <div class="um-admin-dash-content">
 
 
 
19
 
20
+ <?php include_once um_path . 'admin/templates/dashboard/overview.php'; ?>
21
+
22
  </div>
 
23
 
24
+ </div><div class="um-admin-clear"></div>
 
 
25
 
26
  </div>
27
 
core/um-actions-user.php CHANGED
@@ -1,8 +1,26 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  /***
4
  *** @listen to a new user creation in backend
5
  ***/
 
6
  function um_new_user_via_wpadmin( $user_id ) {
7
 
8
  if ( is_admin() ) {
@@ -21,5 +39,4 @@
21
 
22
  }
23
 
24
- }
25
- add_action( 'user_register', 'um_new_user_via_wpadmin', 10, 1 );
1
  <?php
2
 
3
+ /***
4
+ *** @after user uploads, clean up uploads dir
5
+ ***/
6
+ add_action('um_after_user_upload','um_remove_unused_uploads', 10);
7
+ function um_remove_unused_uploads( $user_id ) {
8
+ global $ultimatemember;
9
+ um_fetch_user( $user_id );
10
+ $array = $ultimatemember->user->profile;
11
+ $files = glob( um_user_uploads_dir() . '*', GLOB_BRACE);
12
+ foreach($files as $file) {
13
+ $str = basename($file);
14
+ if ( !strstr( $str, 'profile_photo') && !strstr( $str, 'cover_photo') && !preg_grep('/' . $str . '/', $array ) )
15
+ unlink( $file );
16
+ }
17
+ um_reset_user();
18
+ }
19
+
20
  /***
21
  *** @listen to a new user creation in backend
22
  ***/
23
+ add_action( 'user_register', 'um_new_user_via_wpadmin', 10, 1 );
24
  function um_new_user_via_wpadmin( $user_id ) {
25
 
26
  if ( is_admin() ) {
39
 
40
  }
41
 
42
+ }
 
core/um-files.php CHANGED
@@ -502,15 +502,10 @@ class UM_Files {
502
  rmdir( $dir );
503
 
504
  // update user's meta
505
- $existing = get_user_meta( $user_id, $key, true );
506
- if ( $existing ) {
507
- $file = basename( $existing );
508
- if ( $file != $filename ) {
509
- $delete_src = $this->upload_basedir . $user_id . '/' . basename( $existing );
510
- unlink( $delete_src );
511
- }
512
- }
513
  update_user_meta( $user_id, $key, $filename );
 
 
 
514
 
515
  // the url of upload
516
  return $this->upload_baseurl . $user_id . '/' . $filename;
502
  rmdir( $dir );
503
 
504
  // update user's meta
 
 
 
 
 
 
 
 
505
  update_user_meta( $user_id, $key, $filename );
506
+
507
+ // this action is executed after upload
508
+ do_action('um_after_user_upload', $user_id );
509
 
510
  // the url of upload
511
  return $this->upload_baseurl . $user_id . '/' . $filename;
core/um-short-functions.php CHANGED
@@ -1,17 +1,34 @@
1
  <?php
2
 
3
- /***
4
- *** @Get user IP
5
- ***/
6
- function um_user_ip() {
7
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
8
- return $_SERVER['HTTP_CLIENT_IP'];
 
 
 
 
9
 
10
- } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
11
- return $_SERVER['HTTP_X_FORWARDED_FOR'];
12
- }
13
- return $_SERVER['REMOTE_ADDR'];
 
 
 
 
 
 
 
 
 
 
 
14
  }
 
 
15
 
16
  /***
17
  *** @If conditions are met return true;
@@ -144,19 +161,40 @@
144
  return $value;
145
  }
146
 
147
- /***
148
- *** @profile user ID
149
- ***/
150
- function um_profile_id() {
 
 
 
 
 
 
 
 
 
151
 
152
- if ( um_get_requested_user() ) {
153
- return um_get_requested_user();
154
- } else if ( is_user_logged_in() && get_current_user_id() ) {
155
- return get_current_user_id();
156
  }
157
 
158
- return 0;
 
 
 
 
 
 
 
 
 
 
159
  }
 
 
 
160
 
161
  /***
162
  *** @Check that temp upload is valid
@@ -346,21 +384,49 @@
346
  return $ultimatemember->members->results[ $argument ];
347
  }
348
 
349
- /***
350
- *** @reset user clean
351
- ***/
352
- function um_reset_user_clean() {
353
- global $ultimatemember;
354
- $ultimatemember->user->reset( true );
355
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
356
 
357
- /***
358
- *** @reset user
359
- ***/
360
- function um_reset_user() {
361
- global $ultimatemember;
362
- $ultimatemember->user->reset();
363
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
 
365
  /***
366
  *** @gets the queried user
@@ -479,7 +545,10 @@
479
  ***/
480
  function um_can_edit_field( $data ) {
481
  global $ultimatemember;
482
- if ( $ultimatemember->fields->editing == true && $ultimatemember->fields->set_mode == 'profile' ) {
 
 
 
483
  if ( is_user_logged_in() && isset( $data['editable'] ) && $data['editable'] == 0 ) {
484
 
485
  if ( um_is_user_himself() && !um_user('can_edit_everyone') )
@@ -489,8 +558,11 @@
489
  return false;
490
 
491
  }
 
492
  }
 
493
  return true;
 
494
  }
495
 
496
  /***
@@ -567,29 +639,49 @@
567
  return um_get_option('admin_email');
568
  }
569
 
570
- /***
571
- *** @Gets an option from DB
572
- ***/
573
- function um_get_option($option_id) {
574
- global $ultimatemember;
575
- $um_options = $ultimatemember->options;
576
- if ( isset($um_options[$option_id]) && !empty( $um_options[$option_id] ) ) {
577
- return $um_options[$option_id];
578
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
 
580
- switch($option_id){
581
 
582
- case 'site_name':
583
- return get_bloginfo('name');
584
- break;
585
 
586
- case 'admin_email':
587
- return get_bloginfo('admin_email');
588
- break;
589
 
590
- }
591
-
592
  }
 
 
593
 
594
  /***
595
  *** @Display a link to profile page
@@ -607,13 +699,42 @@
607
  return $ultimatemember->query->get_roles();
608
  }
609
 
610
- /***
611
- *** @Sets up a user profile by ID
612
- ***/
613
- function um_fetch_user( $user_id ) {
614
- global $ultimatemember;
615
- $ultimatemember->user->set( $user_id );
616
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
617
 
618
  /***
619
  *** @Load profile key
@@ -724,164 +845,192 @@
724
  return '';
725
  }
726
 
727
- /***
728
- *** @get user data
729
- ***/
730
- function um_user( $data, $attrs = null ) {
731
- global $ultimatemember;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
 
733
- switch($data){
734
 
735
- default:
736
 
737
- $value = um_profile($data);
738
 
739
- if ( $ultimatemember->validation->is_serialized( $value ) ) {
740
- $value = unserialize( $value );
741
- }
742
-
743
- return $value;
744
 
745
- break;
 
746
 
747
- case 'full_name':
748
- if ( !um_profile( $data ) ) {
 
749
 
750
- if ( um_user('first_name') && um_user('last_name') ) {
751
- $full_name = um_user('first_name') . '.' . um_user('last_name');
752
- } else {
753
- $full_name = um_user('display_name');
754
- }
755
 
756
- $full_name = $ultimatemember->validation->safe_name_in_url( $full_name );
757
- update_user_meta( um_user('ID'), 'full_name', $full_name );
758
 
759
- return $full_name;
760
 
761
- } else {
762
 
763
- return um_profile( $data );
764
 
765
- }
766
- break;
767
 
768
- case 'display_name':
769
 
770
- $op = um_get_option('display_name');
771
-
772
- if ( $op == 'full_name' ) {
773
- if ( um_user('first_name') && um_user('last_name') ) {
774
- return um_user('first_name') . ' ' . um_user('last_name');
775
- } else {
776
- return um_profile( $data );
777
- }
778
- }
779
 
780
- if ( $op == 'sur_name' ) {
781
- if ( um_user('first_name') && um_user('last_name') ) {
782
- return um_user('last_name') . ', ' . um_user('first_name');
783
- } else {
784
- return um_profile( $data );
785
- }
786
  }
 
787
 
788
- if ( $op == 'first_name' ) {
789
- if ( um_user('first_name') ) {
790
- return um_user('first_name');
791
- } else {
792
- return um_profile( $data );
793
- }
794
  }
 
795
 
796
- if ( $op == 'username' ) {
797
- return um_user('user_login');
 
 
 
798
  }
 
799
 
800
- if ( $op == 'initial_name' ) {
801
- if ( um_user('first_name') && um_user('last_name') ) {
802
- $initial = um_user('last_name');
803
- return um_user('first_name') . ' ' . $initial[0];
804
- } else {
805
- return um_profile( $data );
806
- }
807
- }
808
 
809
- if ( $op == 'initial_name_f' ) {
810
- if ( um_user('first_name') && um_user('last_name') ) {
811
- $initial = um_user('first_name');
812
- return $initial[0] . ' ' . um_user('last_name');
813
- } else {
814
- return um_profile( $data );
815
- }
816
  }
 
817
 
818
- if ( $op == 'public_name' ) {
 
 
 
 
819
  return um_profile( $data );
820
  }
 
821
 
822
- if ( $op == 'field' && um_get_option('display_name_field') != '' ) {
823
- $fields = array_filter(preg_split('/[,\s]+/', um_get_option('display_name_field') ));
824
- $output = '';
825
- foreach( $fields as $field ) {
826
- $output .= um_profile( $field ) . ' ';
827
- }
828
- return $output;
 
 
829
  }
 
 
830
 
831
- return um_profile( $data );
832
 
833
- break;
834
 
835
- case 'role_select':
836
- case 'role_radio':
837
- return um_user('role_name');
838
- break;
839
 
840
- case 'submitted':
841
- $array = um_profile($data);
842
- if ( empty( $array ) ) return '';
843
- $array = unserialize( $array );
844
- return $array;
845
- break;
846
 
847
- case 'password_reset_link':
848
- return $ultimatemember->password->reset_url();
849
- break;
850
 
851
- case 'account_activation_link':
852
- return $ultimatemember->permalinks->activate_url();
853
- break;
854
 
855
- case 'profile_photo':
856
 
857
- if ( um_profile('profile_photo') ) {
858
- $avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
859
- } else {
860
- $avatar_uri = um_get_default_avatar_uri();
861
- }
862
 
863
- if ( $avatar_uri )
864
- return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
865
 
866
- if ( !$avatar_uri )
867
- return '';
868
 
869
- break;
870
 
871
- case 'cover_photo':
872
- if ( um_profile('cover_photo') ) {
873
- $cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
874
- } else {
875
- $cover_uri = um_get_default_cover_uri();
876
- }
877
-
878
- if ( $cover_uri )
879
- return '<img src="'. $cover_uri .'" alt="" />';
880
 
881
- if ( !$cover_uri )
882
- return '';
883
 
884
- break;
 
885
 
886
- }
887
- }
 
 
 
1
  <?php
2
 
3
+ /**
4
+ * @function um_user_ip()
5
+ *
6
+ * @description This function returns the IP address of user.
7
+ *
8
+ * @usage <?php $user_ip = um_user_ip(); ?>
9
+ *
10
+ * @returns Returns the user's IP address.
11
+ *
12
+ * @example The example below can retrieve the user's IP address
13
 
14
+ <?php
15
+
16
+ $user_ip = um_user_ip();
17
+ echo 'User IP address is: ' . $user_ip; // prints the user IP address e.g. 127.0.0.1
18
+
19
+ ?>
20
+
21
+ *
22
+ *
23
+ */
24
+ function um_user_ip() {
25
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
26
+ return $_SERVER['HTTP_CLIENT_IP'];
27
+ } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
28
+ return $_SERVER['HTTP_X_FORWARDED_FOR'];
29
  }
30
+ return $_SERVER['REMOTE_ADDR'];
31
+ }
32
 
33
  /***
34
  *** @If conditions are met return true;
161
  return $value;
162
  }
163
 
164
+ /**
165
+ * @function um_profile_id()
166
+ *
167
+ * @description This function returns the user ID for current profile.
168
+ *
169
+ * @usage <?php $user_id = um_profile_id(); ?>
170
+ *
171
+ * @returns Returns the user ID of profile if found, or current user ID if user is logged in. Also returns blank
172
+ if no user ID is set.
173
+ *
174
+ * @example The example below will retrieve the user ID when viewing someone profile.
175
+
176
+ <?php
177
 
178
+ $user_id = um_profile_id();
179
+ if ( $user_id == 1 ) {
180
+ echo 'This is administrator profile.';
 
181
  }
182
 
183
+ ?>
184
+
185
+ *
186
+ *
187
+ */
188
+ function um_profile_id() {
189
+
190
+ if ( um_get_requested_user() ) {
191
+ return um_get_requested_user();
192
+ } else if ( is_user_logged_in() && get_current_user_id() ) {
193
+ return get_current_user_id();
194
  }
195
+
196
+ return 0;
197
+ }
198
 
199
  /***
200
  *** @Check that temp upload is valid
384
  return $ultimatemember->members->results[ $argument ];
385
  }
386
 
387
+ /**
388
+ * @function um_reset_user_clean()
389
+ *
390
+ * @description This function is similar to um_reset_user() with a difference that it will not use the logged-in user
391
+ data after resetting. It is a hard-reset function for all user data.
392
+ *
393
+ * @usage <?php um_reset_user_clean(); ?>
394
+ *
395
+ * @returns Clears the user data. You need to fetch a user manually after using this function.
396
+ *
397
+ * @example You can reset user data by using the following line in your code
398
+
399
+ <?php um_reset_user_clean(); ?>
400
+
401
+ *
402
+ *
403
+ */
404
+ function um_reset_user_clean() {
405
+ global $ultimatemember;
406
+ $ultimatemember->user->reset( true );
407
+ }
408
 
409
+ /**
410
+ * @function um_reset_user()
411
+ *
412
+ * @description This function resets the current user. You can use it to reset user data after
413
+ retrieving the details of a specific user.
414
+ *
415
+ * @usage <?php um_reset_user(); ?>
416
+ *
417
+ * @returns Clears the user data. If a user is logged in, the user data will be reset to that user's data
418
+ *
419
+ * @example You can reset user data by using the following line in your code
420
+
421
+ <?php um_reset_user(); ?>
422
+
423
+ *
424
+ *
425
+ */
426
+ function um_reset_user() {
427
+ global $ultimatemember;
428
+ $ultimatemember->user->reset();
429
+ }
430
 
431
  /***
432
  *** @gets the queried user
545
  ***/
546
  function um_can_edit_field( $data ) {
547
  global $ultimatemember;
548
+
549
+ if ( isset( $ultimatemember->fields->editing ) && $ultimatemember->fields->editing == true &&
550
+ isset( $ultimatemember->fields->set_mode ) && $ultimatemember->fields->set_mode == 'profile' ) {
551
+
552
  if ( is_user_logged_in() && isset( $data['editable'] ) && $data['editable'] == 0 ) {
553
 
554
  if ( um_is_user_himself() && !um_user('can_edit_everyone') )
558
  return false;
559
 
560
  }
561
+
562
  }
563
+
564
  return true;
565
+
566
  }
567
 
568
  /***
639
  return um_get_option('admin_email');
640
  }
641
 
642
+ /**
643
+ * @function um_get_option()
644
+ *
645
+ * @description This function returns the value of an option or setting.
646
+ *
647
+ * @usage <?php $value = um_get_option( $setting ); ?>
648
+ *
649
+ * @param $option_id (string) (required) The option or setting that you want to retrieve
650
+ *
651
+ * @returns Returns the value of the setting you requested, or a blank value if the setting
652
+ does not exist.
653
+ *
654
+ * @example Get default user role set in global options
655
+
656
+ <?php $default_role = um_get_option('default_role'); ?>
657
+
658
+ *
659
+ * @example Get blocked IP addresses set in backend
660
+
661
+ <?php $blocked_ips = um_get_option('blocked_ips'); ?>
662
+
663
+ *
664
+ */
665
+ function um_get_option($option_id) {
666
+ global $ultimatemember;
667
+ $um_options = $ultimatemember->options;
668
+ if ( isset($um_options[$option_id]) && !empty( $um_options[$option_id] ) ) {
669
+ return $um_options[$option_id];
670
+ }
671
 
672
+ switch($option_id){
673
 
674
+ case 'site_name':
675
+ return get_bloginfo('name');
676
+ break;
677
 
678
+ case 'admin_email':
679
+ return get_bloginfo('admin_email');
680
+ break;
681
 
 
 
682
  }
683
+
684
+ }
685
 
686
  /***
687
  *** @Display a link to profile page
699
  return $ultimatemember->query->get_roles();
700
  }
701
 
702
+ /**
703
+ * @function um_fetch_user()
704
+ *
705
+ * @description This function sets a user and allow you to retrieve any information for the retrieved user
706
+ *
707
+ * @usage <?php um_fetch_user( $user_id ); ?>
708
+ *
709
+ * @param $user_id (numeric) (required) A user ID is required. This is the user's ID that you wish to set/retrieve
710
+ *
711
+ * @returns Sets a specific user and prepares profile data and user permissions and makes them accessible.
712
+ *
713
+ * @example The example below will set user ID 5 prior to retrieving his profile information.
714
+
715
+ <?php
716
+
717
+ um_fetch_user(5);
718
+ echo um_user('display_name'); // returns the display name of user ID 5
719
+
720
+ ?>
721
+
722
+ *
723
+ * @example In the following example you can fetch the profile of a logged-in user dynamically.
724
+
725
+ <?php
726
+
727
+ um_fetch_user( get_current_user_id() );
728
+ echo um_user('display_name'); // returns the display name of logged-in user
729
+
730
+ ?>
731
+
732
+ *
733
+ */
734
+ function um_fetch_user( $user_id ) {
735
+ global $ultimatemember;
736
+ $ultimatemember->user->set( $user_id );
737
+ }
738
 
739
  /***
740
  *** @Load profile key
845
  return '';
846
  }
847
 
848
+ /**
849
+ * @function um_user()
850
+ *
851
+ * @description This function can be used to get user's data. This can be user profile data or user permissions.
852
+ *
853
+ * @usage <?php echo um_user( $data ); ?>
854
+ *
855
+ * @param $data (string) (required) The field or data you want to retrieve for user.
856
+ * @param $attrs (string) (optional) Additional attribute for profile data that may need extra configuration.
857
+ *
858
+ * @returns Returns the user data requested If found. A user must be previously set using um_fetch_user() to
859
+ properly retrieve user data.
860
+ *
861
+ * @example The example below can retrieve the user's display name
862
+
863
+ <?php
864
+
865
+ $display_name = um_user('display_name');
866
+ echo $display_name; // prints the user's display name
867
+
868
+ ?>
869
+
870
+ *
871
+ * @example The example below can retrieve user's community role
872
+
873
+ <?php echo um_user('role_name'); // example: Member or Admin ?>
874
+
875
+ *
876
+ */
877
+ function um_user( $data, $attrs = null ) {
878
+
879
+ global $ultimatemember;
880
 
881
+ switch($data){
882
 
883
+ default:
884
 
885
+ $value = um_profile($data);
886
 
887
+ if ( $ultimatemember->validation->is_serialized( $value ) ) {
888
+ $value = unserialize( $value );
889
+ }
 
 
890
 
891
+ return $value;
892
+ break;
893
 
894
+ case 'full_name':
895
+
896
+ if ( !um_profile( $data ) ) {
897
 
898
+ if ( um_user('first_name') && um_user('last_name') ) {
899
+ $full_name = um_user('first_name') . '.' . um_user('last_name');
900
+ } else {
901
+ $full_name = um_user('display_name');
902
+ }
903
 
904
+ $full_name = $ultimatemember->validation->safe_name_in_url( $full_name );
905
+ update_user_meta( um_user('ID'), 'full_name', $full_name );
906
 
907
+ return $full_name;
908
 
909
+ } else {
910
 
911
+ return um_profile( $data );
912
 
913
+ }
914
+ break;
915
 
916
+ case 'display_name':
917
 
918
+ $op = um_get_option('display_name');
 
 
 
 
 
 
 
 
919
 
920
+ if ( $op == 'full_name' ) {
921
+ if ( um_user('first_name') && um_user('last_name') ) {
922
+ return um_user('first_name') . ' ' . um_user('last_name');
923
+ } else {
924
+ return um_profile( $data );
 
925
  }
926
+ }
927
 
928
+ if ( $op == 'sur_name' ) {
929
+ if ( um_user('first_name') && um_user('last_name') ) {
930
+ return um_user('last_name') . ', ' . um_user('first_name');
931
+ } else {
932
+ return um_profile( $data );
 
933
  }
934
+ }
935
 
936
+ if ( $op == 'first_name' ) {
937
+ if ( um_user('first_name') ) {
938
+ return um_user('first_name');
939
+ } else {
940
+ return um_profile( $data );
941
  }
942
+ }
943
 
944
+ if ( $op == 'username' ) {
945
+ return um_user('user_login');
946
+ }
 
 
 
 
 
947
 
948
+ if ( $op == 'initial_name' ) {
949
+ if ( um_user('first_name') && um_user('last_name') ) {
950
+ $initial = um_user('last_name');
951
+ return um_user('first_name') . ' ' . $initial[0];
952
+ } else {
953
+ return um_profile( $data );
 
954
  }
955
+ }
956
 
957
+ if ( $op == 'initial_name_f' ) {
958
+ if ( um_user('first_name') && um_user('last_name') ) {
959
+ $initial = um_user('first_name');
960
+ return $initial[0] . ' ' . um_user('last_name');
961
+ } else {
962
  return um_profile( $data );
963
  }
964
+ }
965
 
966
+ if ( $op == 'public_name' ) {
967
+ return um_profile( $data );
968
+ }
969
+
970
+ if ( $op == 'field' && um_get_option('display_name_field') != '' ) {
971
+ $fields = array_filter(preg_split('/[,\s]+/', um_get_option('display_name_field') ));
972
+ $output = '';
973
+ foreach( $fields as $field ) {
974
+ $output .= um_profile( $field ) . ' ';
975
  }
976
+ return $output;
977
+ }
978
 
979
+ return um_profile( $data );
980
 
981
+ break;
982
 
983
+ case 'role_select':
984
+ case 'role_radio':
985
+ return um_user('role_name');
986
+ break;
987
 
988
+ case 'submitted':
989
+ $array = um_profile($data);
990
+ if ( empty( $array ) ) return '';
991
+ $array = unserialize( $array );
992
+ return $array;
993
+ break;
994
 
995
+ case 'password_reset_link':
996
+ return $ultimatemember->password->reset_url();
997
+ break;
998
 
999
+ case 'account_activation_link':
1000
+ return $ultimatemember->permalinks->activate_url();
1001
+ break;
1002
 
1003
+ case 'profile_photo':
1004
 
1005
+ if ( um_profile('profile_photo') ) {
1006
+ $avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
1007
+ } else {
1008
+ $avatar_uri = um_get_default_avatar_uri();
1009
+ }
1010
 
1011
+ if ( $avatar_uri )
1012
+ return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
1013
 
1014
+ if ( !$avatar_uri )
1015
+ return '';
1016
 
1017
+ break;
1018
 
1019
+ case 'cover_photo':
1020
+ if ( um_profile('cover_photo') ) {
1021
+ $cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
1022
+ } else {
1023
+ $cover_uri = um_get_default_cover_uri();
1024
+ }
 
 
 
1025
 
1026
+ if ( $cover_uri )
1027
+ return '<img src="'. $cover_uri .'" alt="" />';
1028
 
1029
+ if ( !$cover_uri )
1030
+ return '';
1031
 
1032
+ break;
1033
+
1034
+ }
1035
+
1036
+ }
core/um-user.php CHANGED
@@ -26,10 +26,11 @@ class UM_User {
26
  'user_email',
27
  'user_pass',
28
  'user_password',
 
29
  );
30
 
31
  $this->target_id = null;
32
-
33
  }
34
 
35
  /***
@@ -127,7 +128,7 @@ class UM_User {
127
  foreach($this->usermeta as $k=>$v){
128
  $this->profile[$k] = $v[0];
129
  }
130
-
131
  // add user stuff
132
  $this->profile['post_count'] = $ultimatemember->query->count_posts($this->id);
133
  $this->profile['comment_count'] = $ultimatemember->query->count_comments($this->id);
26
  'user_email',
27
  'user_pass',
28
  'user_password',
29
+ 'display_name',
30
  );
31
 
32
  $this->target_id = null;
33
+
34
  }
35
 
36
  /***
128
  foreach($this->usermeta as $k=>$v){
129
  $this->profile[$k] = $v[0];
130
  }
131
+
132
  // add user stuff
133
  $this->profile['post_count'] = $ultimatemember->query->count_posts($this->id);
134
  $this->profile['comment_count'] = $ultimatemember->query->count_comments($this->id);
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.43
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.44
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.43
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
@@ -185,6 +185,14 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
 
 
 
188
  = 1.0.43: February 7, 2015 =
189
 
190
  * New: added German (Deutsch) language support
7
  Requires at least: 4.1
8
  Tested up to: 4.1
9
 
10
+ Stable Tag: 1.0.44
11
 
12
  License: GNU Version 2 or Any Later Version
13
 
185
 
186
  == Changelog ==
187
 
188
+ = 1.0.44: February 8, 2015 =
189
+
190
+ * Tweak: improved performance: unused user photos are deleted when user upload
191
+ * Tweak: cleaned up dashboard code
192
+ * Tweak: updated current translations
193
+ * Fixed: display name field should be updated with wp_update_user and not in usermeta
194
+ * Fixed: admin js and css should are loaded in UM backend only
195
+
196
  = 1.0.43: February 7, 2015 =
197
 
198
  * New: added German (Deutsch) language support