@@ -275,6 +277,11 @@
do_action('um_user_before_updating_profile', $userinfo );
foreach( $fields as $key => $array ) {
+
+ if ( $fields[$key]['type'] == 'multiselect' || $fields[$key]['type'] == 'checkbox' && !isset($args['submitted'][$key]) ) {
+ delete_user_meta( um_user('ID'), $key );
+ }
+
if ( isset( $args['submitted'][ $key ] ) ) {
if ( isset( $userinfo[$key]) && $args['submitted'][$key] != $userinfo[$key] ) {
@@ -285,7 +292,7 @@
}
}
-
+
if ( is_array( $to_update ) ) {
$ultimatemember->user->update_profile( $to_update );
}
diff --git a/core/um-builtin.php b/core/um-builtin.php
index 007f2566..ba8e9bfa 100644
--- a/core/um-builtin.php
+++ b/core/um-builtin.php
@@ -29,8 +29,25 @@ class UM_Builtin {
***/
function get_specific_fields( $fields ) {
$fields = explode(',', $fields);
+ $array=array();
foreach ($fields as $field ) {
- $array[$field] = $this->predefined_fields[$field];
+ if ( isset( $this->predefined_fields[$field] ) ) {
+ $array[$field] = $this->predefined_fields[$field];
+ }
+ }
+ return $array;
+ }
+
+ /***
+ *** @get specific field
+ ***/
+ function get_specific_field( $fields ) {
+ $fields = explode(',', $fields);
+ $array=array();
+ foreach ($fields as $field ) {
+ if ( isset( $this->predefined_fields[$field] ) ) {
+ $array = $this->predefined_fields[$field];
+ }
}
return $array;
}
@@ -594,6 +611,7 @@ class UM_Builtin {
'url_rel' => 'nofollow',
'icon' => 'um-icon-facebook-alt',
'validate' => 'facebook_url',
+ 'url_text' => 'Facebook',
),
'twitter' => array(
@@ -608,6 +626,7 @@ class UM_Builtin {
'url_rel' => 'nofollow',
'icon' => 'um-icon-twitter',
'validate' => 'twitter_url',
+ 'url_text' => 'Twitter',
),
'linkedin' => array(
@@ -622,6 +641,7 @@ class UM_Builtin {
'url_rel' => 'nofollow',
'icon' => 'um-icon-linkedin-alt-1',
'validate' => 'linkedin_url',
+ 'url_text' => 'LinkedIn',
),
'googleplus' => array(
@@ -636,6 +656,7 @@ class UM_Builtin {
'url_rel' => 'nofollow',
'icon' => 'um-icon-google-plus',
'validate' => 'google_url',
+ 'url_text' => 'Google+',
),
'instagram' => array(
@@ -650,6 +671,7 @@ class UM_Builtin {
'url_rel' => 'nofollow',
'icon' => 'um-icon-instagrem',
'validate' => 'instagram_url',
+ 'url_text' => 'Instagram',
),
'skype' => array(
@@ -664,6 +686,7 @@ class UM_Builtin {
'url_rel' => 'nofollow',
'icon' => 'um-icon-skype',
'validate' => 'skype',
+ 'url_text' => 'Skype',
),
'role_select' => array(
@@ -836,7 +859,7 @@ class UM_Builtin {
/***
*** @predefined + custom fields ( Global, not form wide )
***/
- function all_user_fields() {
+ function all_user_fields( $exclude_types = array() ) {
global $ultimatemember;
@@ -852,7 +875,13 @@ class UM_Builtin {
}
foreach( $all as $k => $arr ) {
- if ( isset( $arr['account_only'] ) ) {
+ if ( $exclude_types && in_array( $arr['type'], $exclude_types ) ) {
+ unset( $all[$k] );
+ }
+ if ( isset( $arr['account_only'] ) || isset( $arr['private_use'] ) ) {
+ unset( $all[$k] );
+ }
+ if ( isset( $arr['type'] ) && in_array( $arr['type'], array('image','file','password') ) ) {
unset( $all[$k] );
}
}
diff --git a/core/um-fields.php b/core/um-fields.php
index 5d1dcfb1..93e18b2b 100644
--- a/core/um-fields.php
+++ b/core/um-fields.php
@@ -334,36 +334,10 @@ class UM_Fields {
} else if ( um_user( $key ) && $this->viewing == true ) {
$value = um_user( $key );
+ $value = apply_filters("um_profile_field_filter_hook__", $value, $data );
+ $value = apply_filters("um_profile_field_filter_hook__{$key}", $value, $data );
- if ( isset( $data['validate'] ) && $data['validate'] != '' && strstr( $data['validate'], 'url' ) ) {
- $alt = ( isset( $data['url_text'] ) ) ? $data['url_text'] : $value;
- $url_rel = ( isset( $data['url_rel'] ) ) ? 'rel="nofollow"' : '';
-
- if ( !strstr( $value, 'http' )
- && !strstr( $value, '://' )
- && !strstr( $value, 'www.' )
- && !strstr( $value, '.com' )
- && !strstr( $value, '.net' )
- && !strstr( $value, '.org' )
- ) {
-
- if ( $data['validate'] == 'facebook_url' ) $value = 'http://facebook.com/' . $value;
- if ( $data['validate'] == 'twitter_url' ) $value = 'http://twitter.com/' . $value;
- if ( $data['validate'] == 'linkedin_url' ) $value = 'http://linkedin.com/' . $value;
- if ( $data['validate'] == 'skype' ) $value = 'http://skype.com/' . $value;
- if ( $data['validate'] == 'googleplus_url' ) $value = 'http://plus.google.com/' . $value;
- if ( $data['validate'] == 'instagram_url' ) $value = 'http://instagram.com/' . $value;
-
- }
-
- $value = '
'.$alt.'';
- }
-
- if ( is_array( $value ) ) {
- return implode(', ', $value );
- }
-
- return apply_filters("um_profile_field_filter_hook__{$key}", $value );
+ return $value;
} else if ($default) {
return $default;
@@ -1418,7 +1392,7 @@ class UM_Fields {
// Custom filter for field output
if ( isset( $this->set_mode ) ) {
- $output = apply_filters("um_{$key}_form_edit_field", $output, $this->set_mode);
+ $output = apply_filters("um_{$key}_form_edit_field", $output, $this->set_mode);
}
return $output;
@@ -1733,7 +1707,9 @@ class UM_Fields {
}
// Custom filter for field output
- $output = apply_filters("um_{$key}_form_show_field", $output, $this->set_mode);
+ if ( isset( $this->set_mode ) ) {
+ $output = apply_filters("um_{$key}_form_show_field", $output, $this->set_mode);
+ }
return $output;
}
diff --git a/core/um-filters-fields.php b/core/um-filters-fields.php
index 41cd1db5..64f54181 100644
--- a/core/um-filters-fields.php
+++ b/core/um-filters-fields.php
@@ -1,5 +1,53 @@
'.$alt.'';
+ }
+
+ if ( !is_array( $value ) ) {
+
+ if ( is_email( $value ) )
+ $value = '
'.$value.'';
+
+ } else {
+
+ $value = implode(', ', $value);
+
+ }
+
+ return $value;
+ }
+
/***
*** @get form fields
***/
diff --git a/core/um-profile.php b/core/um-profile.php
index fc3586cf..6b5958b5 100644
--- a/core/um-profile.php
+++ b/core/um-profile.php
@@ -7,12 +7,20 @@ class UM_Profile {
}
function show_meta( $array ) {
+ global $ultimatemember;
$output = '';
foreach( $array as $k ) {
- if ( $k ) {
- $items[] = '
' . um_user( $k ) . '';
+ $data = '';
+ if ( $k && um_user( $k ) ) {
+
+ $value = um_user( $k );
+ $data = $ultimatemember->builtin->get_specific_field( $k );
+ $value = apply_filters("um_profile_field_filter_hook__", $value, $data );
+
+ $items[] = '
' . $value . '';
$items[] = '
•';
+
}
}
diff --git a/core/um-setup.php b/core/um-setup.php
index 3730773f..cf196549 100644
--- a/core/um-setup.php
+++ b/core/um-setup.php
@@ -84,6 +84,7 @@ class UM_Setup {
'_um_secondary_btn_color' => '#eee',
'_um_secondary_btn_hover' => '#e5e5e5',
'_um_secondary_btn_text' => '#666',
+ '_um_profile_show_name' => 1,
'_um_profile_show_bio' => 1,
'_um_profile_role' => '0',
'_um_profile_template' => 'profile',
diff --git a/core/um-short-functions.php b/core/um-short-functions.php
index b786095b..e5680e8a 100644
--- a/core/um-short-functions.php
+++ b/core/um-short-functions.php
@@ -440,6 +440,14 @@
return $uri;
}
+ function um_closest_num($array, $number) {
+ sort($array);
+ foreach ($array as $a) {
+ if ($a >= $number) return $a;
+ }
+ return end($array);
+ }
+
/***
*** @get cover uri
***/
@@ -461,11 +469,20 @@
function um_get_avatar_uri( $image, $attrs ) {
global $ultimatemember;
$uri = false;
- if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo.jpg' ) ) {
- $uri = um_user_uploads_uri() . 'profile_photo.jpg?' . time();
- }
- if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $attrs. '.jpg' ) ){
+
+ if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $attrs. '.jpg' ) ) {
$uri = um_user_uploads_uri() . 'profile_photo-'.$attrs.'.jpg?' . time();
+ } else {
+
+ $sizes = um_get_option('photo_thumb_sizes');
+ $find = um_closest_num( $sizes, $attrs );
+
+ if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo-' . $find. '.jpg' ) ) {
+ $uri = um_user_uploads_uri() . 'profile_photo-'.$find.'.jpg?' . time();
+ } else if ( file_exists( $ultimatemember->files->upload_basedir . um_user('ID') . '/profile_photo.jpg' ) ) {
+ $uri = um_user_uploads_uri() . 'profile_photo.jpg?' . time();
+ }
+
}
return $uri;
}
@@ -494,11 +511,11 @@
$value = um_profile($data);
if ( $ultimatemember->validation->is_serialized( $value ) ) {
- return unserialize( $value );
- } else {
- return $value;
+ $value = unserialize( $value );
}
+ return $value;
+
break;
case 'full_name':
diff --git a/core/um-shortcodes.php b/core/um-shortcodes.php
index 2d2133df..d29419b9 100644
--- a/core/um-shortcodes.php
+++ b/core/um-shortcodes.php
@@ -73,6 +73,9 @@ class UM_Shortcodes {
}
$args = apply_filters('um_shortcode_args_filter', $args );
+
+ if ( um_profile_id() && $args['role'] && $args['role'] != $ultimatemember->query->get_role_by_userid( um_profile_id() ) )
+ return;
extract( $args, EXTR_SKIP );
diff --git a/core/um-validation.php b/core/um-validation.php
index c6229a0c..9dc89089 100644
--- a/core/um-validation.php
+++ b/core/um-validation.php
@@ -80,7 +80,7 @@ class UM_Validation {
if ( $social ) {
- if ( substr( $url, 0, strlen($social) ) == $social ) { // starts with social requested
+ if ( !filter_var($url, FILTER_VALIDATE_URL) && strstr( $url, $social ) ) { // starts with social requested
return true;
} else {
diff --git a/um-config.php b/um-config.php
index 30a4815a..3b0ec5fd 100644
--- a/um-config.php
+++ b/um-config.php
@@ -747,7 +747,7 @@ $this->sections[] = array(
'type' => 'multi_text',
'title' => __( 'Profile Photo Thumbnail Sizes' ),
'desc' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.' ),
- 'default' => array( 40, 80, str_replace('px','',um_get_option('profile_photosize') ) ),
+ 'default' => array( 40, 80, 190 ),
'validate' => 'numeric',
'add_text' => __('Add New Size'),
),
@@ -1192,6 +1192,14 @@ $this->sections[] = array(
'transparent' => false,
),
+ array(
+ 'id' => 'profile_show_name',
+ 'type' => 'switch',
+ 'title' => __( 'Show display name in profile header' ),
+ 'default' => um_get_metadefault('profile_show_name'),
+ 'desc' => 'Switch on/off the user name on profile header',
+ ),
+
array(
'id' => 'profile_show_bio',
'type' => 'switch',