• Resolved 1jd123

    (@1jd123)


    Dear all,

    I am more than happy with your plugin but ran into a minor issue. For my website I need 2 different login forms. The first one does have a password field so the error message “Please enter your password” is fine but in the second form the field does have another name so I need to customise the error message only on the second form.I found something like this but I am not sure
    1. How to add it to a single form / page
    2. Make it work

    add_filter( 'um_submit_form_error', 'my_submit_form_error', 10, 2 );
    function my_submit_form_error( $error, $key ) {
        // 1. add a custom error string that says "Eingabe fehlerhaft. Bitte überprüfen Sie ihre Daten".
    return $error;
    }
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @1jd123

    Thanks for contacting our support!

    You can try the following code snippet( you need to change the form_id to match your login form and then change the metakey my_custom_field_metakey to your custom field’s meta key ):

    function um_061422_errors_hook_login( $args ) {
    	
    	$form_id = $args['form_id'];
    
            if( $form_id == 123 ){
                 if ( $args['my_custom_field_metakey'] == '' ) {
    		UM()->form()->add_error( 'my_custom_field_metakey', __( 'Please enter the code', 'ultimate-member' ) );
    	}
            }
    }
    add_action( 'um_submit_form_errors_hook_login', 'um_061422_errors_hook_login', 999 );
    

    You can add the code to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.

    Regards,

    Thread Starter 1jd123

    (@1jd123)

    Hello sir, thanks for your snippet.
    I tried to use it but when I go to https://www.der-steuerzahler.de/login/
    and enter wrong credentials I still get the old error Message

    Thread Starter 1jd123

    (@1jd123)

    function um_061422_errors_hook_login( $args ) {

    $form_id = $args[‘form_id’];

    if( $form_id == 5667 ){
    if ( $args[‘my_custom_field_metakey’] == ‘user_password’ ) {
    UM()->form()->add_error( ‘my_custom_field_metakey’, __( ‘Fehler: Kombination aus Mitgliedsnummer und Postleitzahl ist nicht gültig’, ‘ultimate-member’ ) );
    }
    }
    }`

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @1jd123

    Which field do you want to show or change the error text? I thought you have a custom field for the Login form that’s why i gave an example meta key “my_custom_field_metakey” that you can replace with your custom field’s meta key.

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @1jd123

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Password Error Message (Login)’ is closed to new replies.