andriiwork
Forum Replies Created
-
Thanks! @missveronicatv
You help me 🙂
This code work. (I have 4 language in my site).function um_custom_validate_english_language( $key, $array, $args ) { if ( preg_match('/[^A-ZĄĆĘŁŃÓŚŹŻa-ząćęłńóśźż0-9-]/', $args[$key] ) ) { if (is_page('2974') && get_the_id() == 2974){ UM()->form()->add_error( $key, __( 'Пожалуйста, используйте только Английские буквы', 'ultimate-member' ) ); } if (is_page('6412') && get_the_id() == 6412){ UM()->form()->add_error( $key, __( 'Будь ласка, використовуйте тільки Англійські літери', 'ultimate-member' ) ); } if (is_page('6424') && get_the_id() == 6424){ UM()->form()->add_error( $key, __( 'Please use only English letters', 'ultimate-member' ) ); } if (is_page('6432') && get_the_id() == 6432){ UM()->form()->add_error( $key, __( 'Proszę używać wyłącznie Angielskich liter', 'ultimate-member' ) ); } } } add_action( 'um_custom_field_validation_english_language', 'um_custom_validate_english_language', 30, 3 );- This reply was modified 2 years, 3 months ago by andriiwork.
@missveronicatv Thanks! You code work perfectly!
@missveronicatv I find solution for me 🙂 Thanks.
I edit date format in class-fields.php – line 2649.May be you can help me, how I can add this code in Snippet. I don’t want edit original UM Plugin files.
Thanks for help!// Normalise date format. $value = $this->field_value( $key, $default, $data ); if ( $value ) { // numeric (either unix or YYYYMMDD). ACF uses Ymd format of date inside the meta tables. if ( is_numeric( $value ) && strlen( $value ) !== 8 ) { $unixtimestamp = $value; } else { $unixtimestamp = strtotime( $value ); } // Ultimate Member date field stores the date in metatable in the format Y/m/d. Convert to it before echo. //$value = date( 'Y/m/d', $unixtimestamp ); $value = date( 'd.m.Y', $unixtimestamp ); }Hello @missveronicatv I have a small solution 🙂
Maybe you know how I can change format in “value” and “data-value”. (Add photo and use this snippets).In this input date format Y/m/d but in snippets I change format to
d.m.Y
add_action("um_registration_complete","um_change_date_format", 1, 2 ); function um_change_date_format( $user_id, $args ){ $date = get_user_meta( $user_id, "custom_date", true ); update_user_meta( $user_id, "custom_date", date_i18n("d.m.Y", strtotime( $date ) ) ); } add_action("um_after_user_updated","um_update_date_format", 1, 2 ); function um_update_date_format( $user_id, $args ){ $date = get_user_meta( $user_id, "custom_date", true ); update_user_meta( $user_id, "custom_date", date_i18n("d.m.Y", strtotime( $date ) ) ); } add_filter( "um_get_field_date", 'um_get_field_date_custom_format', 10, 1 ); function um_get_field_date_custom_format( $array ) { $array['js_format'] = 'dd.mm.yyyy'; $array['format_custom'] = 'd.m.Y'; $array['format'] = 'd.m.Y'; return $array; }@missveronicatv Hello. Its work, Thanks!
@missveronicatv Thanks for you help, I add you datepicker integration. But now I have wrong date format, I change date format in JS file “Y-m-d” to “d.m.Y” but its now work 🙁
Hello @missveronicatv
I use InputWP datepicker, but I can use you integrated cf7 datepicker:)
You have tutorial?
Hello @missveronicatv
Its work! Thanks!
add_action("um_registration_complete","um_change_date_format", 1, 2 ); function um_change_date_format( $user_id, $args ){ $date = get_user_meta( $user_id, "meta_key_!", true ); update_user_meta( $user_id, "meta_key_!", date_i18n("d.m.Y", strtotime( $date ) ) ); } add_action("um_after_user_updated","um_update_date_format", 1, 2 ); function um_update_date_format( $user_id, $args ){ $date = get_user_meta( $user_id, "meta_key_!", true ); update_user_meta( $user_id, "meta_key_!", date_i18n("d.m.Y", strtotime( $date ) ) ); } add_filter( "um_get_field_date", 'um_get_field_date_custom_format', 10, 1 ); function um_get_field_date_custom_format( $array ) { $array['js_format'] = 'dd.mm.yyyy'; $array['format_custom'] = 'd.m.Y'; $array['format'] = 'd.m.Y'; return $array; }- This reply was modified 2 years, 9 months ago by andriiwork.
Hi @gelieys
Not work 🙁
Hello. @andrewshu
This snippet work. Thanks.But I have small problem.
This snippet add my custom class to all fields =( (And add to <DIV> class not to <INPUT>)
add_filter( 'um_field_extra_atts', 'um_add_field_class', 10, 3 );
function um_add_field_class( $field_atts, $key, $data ) {
$field_atts['class']['test_meta_key9'] = 'wpdatepicker';
return $field_atts;
}- This reply was modified 2 years, 9 months ago by Yui.
- This reply was modified 2 years, 9 months ago by andriiwork.
- This reply was modified 2 years, 9 months ago by andriiwork.
- This reply was modified 2 years, 9 months ago by andriiwork.