- add tiktok

This commit is contained in:
ashubawork
2023-01-18 13:47:07 +02:00
parent 2218ff6ba7
commit 055f7984c8
3 changed files with 27 additions and 2 deletions
+17
View File
@@ -1057,6 +1057,22 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
'validate' => 'discord',
),
'tiktok' => array(
'title' => __('TikTok','ultimate-member'),
'metakey' => 'tiktok',
'type' => 'url',
'label' => __('TikTok','ultimate-member'),
'required' => 0,
'public' => 1,
'editable' => 1,
'url_target' => '_blank',
'url_rel' => 'nofollow',
'validate' => 'tiktok_url',
'url_text' => 'TikTok',
'advanced' => 'social',
'match' => 'https://tiktok.com/@',
),
'youtube' => array(
'title' => __( 'YouTube', 'ultimate-member' ),
'metakey' => 'youtube',
@@ -1487,6 +1503,7 @@ if ( ! class_exists( 'um\core\Builtin' ) ) {
$array['youtube_url'] = __('YouTube Profile','ultimate-member');
$array['telegram_url'] = __('Telegram URL','ultimate-member');
$array['discord'] = __('Discord ID','ultimate-member');
$array['tiktok_url'] = __('TikTok URL','ultimate-member');
$array['custom'] = __('Custom Validation','ultimate-member');
/**
+9 -2
View File
@@ -770,6 +770,13 @@ function um_submit_form_errors_hook_( $args ) {
}
break;
case 'tiktok_url':
if ( ! UM()->validation()->is_url( $args[ $key ], 'tiktok.com' ) ) {
UM()->form()->add_error( $key, sprintf( __( 'Please enter a valid %s profile URL', 'ultimate-member' ), $array['label'] ) );
}
break;
case 'url':
if ( ! UM()->validation()->is_url( $args[ $key ] ) ) {
UM()->form()->add_error( $key, __( 'Please enter a valid URL', 'ultimate-member' ) );
@@ -878,7 +885,7 @@ function um_submit_form_errors_hook_( $args ) {
}
}
break;
case 'alphabetic':
if ( $args[ $key ] != '' ) {
@@ -886,7 +893,7 @@ function um_submit_form_errors_hook_( $args ) {
if ( ! preg_match( '/^\p{L}+$/u', str_replace( ' ', '', $args[ $key ] ) ) ) {
UM()->form()->add_error( $key, __( 'You must provide alphabetic letters', 'ultimate-member' ) );
}
}
break;
+1
View File
@@ -434,6 +434,7 @@ function um_profile_field_filter_hook__( $value, $data, $type = '' ) {
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'] == 'vk_url' ) $value = 'https://vk.com/' . $value;
}