• Resolved renatoconeglian

    (@renatoconeglian)


    Hi, in the 1st step I’m doing an user/password validation based on a database table (not wordpress user table, its a custom db table we created), for that, we added a new table to database with information from another system that we want visitors to use “user” and their “password”.

    At the provided “Link to the page you need help with:” use this to test: Usuario: 00010102 Senha: 5566 to simulate the validation. (usuario stands for user and senha stands for password)

    We managed to only proceed to next step by being successfull on an “add_filter” validate. The code is as follows

    add_filter( 'wpcf7_validate_text*', 'validar_usuario_e_senha_formPgto', 20, 2 );
    function validar_usuario_e_senha_formPgto( $result, $tag ) {
    
    $tag = new WPCF7_FormTag( $tag );
    global $wpdb;
    $input_name = $tag['name'];
    	if ($input_name == 'user'){
    		$user = isset( $_POST['user'] ) ? trim( $_POST['user'] ) : '';
    		$pass = isset( $_POST['pass'] ) ? trim( $_POST['pass'] ) : '';
    		$query = $wpdb->prepare("SELECT * FROM USER_TABLE WHERE login = %s AND pass = %s",$user,$pass);
    		$searchTerm = $wpdb->get_results($query);	
    			
    		if(!$searchTerm){
        		$result->invalidate( $tag, "Error message." );
    		}
    	}
    
    return $result;
    }

    In this USER_TABLE, we also have other information of the user, that we would like to show on second step and also to add to submission e-mail…

    For now we were able to “validate” the user based on our USER_TABLE… how to show at next step other fields captured by the database at this validation, and add to the submission e-mail?

    PS: We are using the free version, but we will buy the PRO if needed to solve this challenge.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Bruce

    (@ninjateamwp)

    Hi @renatoconeglian ,

    Thanks for using CF7 Database and we are sorry for the late response, we missed this thread.

    So in this case, could you please try to deactivate Database plugin and use default contact form 7 to test this case?

    Kind regards,
    -Bruce-

    Plugin Author Ninja Team

    (@ninjateam)

    Hi there,

    We have not heard back from you, let me mark this as resolved.
    If you still would like to get support, kindly open a new thread.

    Best regards,
    Kelly

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fill step fields with “before step” validation database results’ is closed to new replies.