- removed Google+, VKonakte but leaves these custom fields as just URL type with Website URL validation;

- added 2.6.0 version upgrade script for changing 'vk_url', 'google_url', 'googleplus_url' just to 'url' validate value;
- close #1145;
This commit is contained in:
Nikita Sinelnikov
2023-03-27 16:56:58 +03:00
parent 74e1ea260d
commit 4af87d9834
9 changed files with 107 additions and 57 deletions
-38
View File
@@ -949,24 +949,6 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'match' => 'https://linkedin.com/',
),
'googleplus' => array(
'title' => __('Google+','ultimate-member'),
'metakey' => 'googleplus',
'type' => 'url',
'label' => __('Google+','ultimate-member'),
'required' => 0,
'public' => 1,
'editable' => 1,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-google-plus',
'validate' => 'google_url',
'url_text' => 'Google+',
'advanced' => 'social',
'color' => '#dd4b39',
'match' => 'https://google.com/+',
),
'instagram' => array(
'title' => __('Instagram','ultimate-member'),
'metakey' => 'instagram',
@@ -1150,24 +1132,6 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'match' => 'https://soundcloud.com/',
),
'vkontakte' => array(
'title' => __('VKontakte','ultimate-member'),
'metakey' => 'vkontakte',
'type' => 'url',
'label' => __('VKontakte','ultimate-member'),
'required' => 0,
'public' => 1,
'editable' => 1,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'icon' => 'um-faicon-vk',
'validate' => 'vk_url',
'url_text' => 'VKontakte',
'advanced' => 'social',
'color' => '#2B587A',
'match' => 'https://vk.com/',
),
'role_select' => array(
'title' => __('Roles (Dropdown)','ultimate-member'),
'metakey' => 'role_select',
@@ -1522,10 +1486,8 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
$array['alpha_numeric'] = __('Alpha-numeric value','ultimate-member');
$array['english'] = __('English letters only','ultimate-member');
$array['facebook_url'] = __('Facebook URL','ultimate-member');
$array['google_url'] = __('Google+ URL','ultimate-member');
$array['instagram_url'] = __('Instagram URL','ultimate-member');
$array['linkedin_url'] = __('LinkedIn URL','ultimate-member');
$array['vk_url'] = __('VKontakte URL','ultimate-member');
$array['lowercase'] = __('Lowercase only','ultimate-member');
$array['numeric'] = __('Numeric value only','ultimate-member');
$array['phone_number'] = __('Phone Number','ultimate-member');
-12
View File
@@ -746,24 +746,12 @@ function um_submit_form_errors_hook_( $args ) {
}
break;
case 'google_url':
if ( ! UM()->validation()->is_url( $args[ $key ], 'plus.google.com' ) ) {
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) );
}
break;
case 'linkedin_url':
if ( ! UM()->validation()->is_url( $args[ $key ], 'linkedin.com' ) ) {
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) );
}
break;
case 'vk_url':
if ( ! UM()->validation()->is_url( $args[ $key ], 'vk.com' ) ) {
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s username or profile URL', 'ultimate-member' ), $array['label'] ) );
}
break;
case 'discord':
if ( ! UM()->validation()->is_discord_id( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'Please enter a valid Discord ID', 'ultimate-member' ) );
-2
View File
@@ -432,12 +432,10 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
if ( $data['validate'] == 'facebook_url' ) $value = 'https://facebook.com/' . $value;
if ( $data['validate'] == 'twitter_url' ) $value = 'https://twitter.com/' . $value;
if ( $data['validate'] == 'linkedin_url' ) $value = 'https://linkedin.com/' . $value;
if ( $data['validate'] == 'googleplus_url' ) $value = 'https://plus.google.com/' . $value;
if ( $data['validate'] == 'instagram_url' ) $value = 'https://instagram.com/' . $value;
if ( $data['validate'] == 'tiktok_url' ) $value = 'https://tiktok.com/' . $value;
if ( $data['validate'] == 'twitch_url' ) $value = 'https://twitch.tv/' . $value;
if ( $data['validate'] == 'reddit_url' ) $value = 'https://www.reddit.com/user/' . $value;
if ( $data['validate'] == 'vk_url' ) $value = 'https://vk.com/' . $value;
}
if ( strpos( $value, 'http://' ) !== 0 ) {