Translate "This field is required." on "mb_user_profile_login" shortcode
Support › MB User Profile › Translate "This field is required." on "mb_user_profile_login" shortcodeResolved
- This topic has 5 replies, 2 voices, and was last updated 2 years, 9 months ago by
Matej Mohar.
-
AuthorPosts
-
October 26, 2022 at 8:40 PM #38830
Matej Mohar
ParticipantHello,
I would like to translate the message "This field is required" when using "mb_user_profile_login" shortcode. Is this possible? And I guess the same goes with register or update form.
If not, is there any workaround to create custom login/register/update form?Thank you,
MatejOctober 26, 2022 at 9:58 PM #38832Long Nguyen
ModeratorHi,
Please refer to this topic to know how to translate the validation text https://support.metabox.io/topic/translation-of-form-messages/
October 26, 2022 at 10:08 PM #38833Matej Mohar
ParticipantThank you, I saw this thread but I can't figure it out. If I use [mb_user_profile_login], how can I add "validation" part to the field group settings?
I can see that there is a "rwmb_profile_login_fields" filter, but this is only for changing fields, not adding to the field group settings?October 26, 2022 at 10:16 PM #38835Matej Mohar
ParticipantI use this shortcode: https://docs.metabox.io/extensions/mb-user-profile/#login-form
If you have any example it would be great rf if you can point me in the right direction.
Thanks.October 28, 2022 at 11:13 AM #38869Long Nguyen
ModeratorHi,
You can use filter hook
rwmb_profile_login_fieldsto add the custom HTML5 attributetitleto the field and change the required message. For example:add_filter( 'rwmb_profile_login_fields', function( $fields ) { $fields['username']['attributes'] = [ 'title' => 'Username required text' ]; $fields['password']['attributes'] = [ 'title' => 'Password required text' ]; return $fields; } );Read more on the documentation https://docs.metabox.io/custom-attributes/
https://www.w3schools.com/tags/att_global_title.aspFebruary 10, 2023 at 6:32 PM #40475Matej Mohar
ParticipantHi,
thanks for help. Although it's now a long time since I originally asked a question, I needed this again and I decided to write here my solution for anyone that would be in same dilemma. The answer was is almost correct and it pointed me in the right direction.I forgot to answer it last year, because I solved this some other way and I totally forgot about this question.
Because I was using
[mb_user_profile_info id="rwmb-user-info"]shortcode, I needed to create a filter like this:add_filter( 'rwmb_profile_info_fields', function( $fields ) { error_log(print_r($fields, true)); $fields['password']['attributes'] = [ 'title' => 'Username required text' ]; $fields['password2']['attributes'] = [ 'title' => 'Password required text' ]; return $fields; }); -
AuthorPosts
- You must be logged in to reply to this topic.