Solution:
Took me a while but this is how I solved it.
I have a field in my database for the language of each user.
I added this to the functions.php:
add_action( 'wp', 'analyze_form_submit' );
function analyze_form_submit() {
global $current_user;
if (is_page(86)) { // 86 is the welcome page after login in my case
$affil_id = $current_user->user_login;
$query="SELECT lang FROM affil WHERE affil_id=:affil_id";
$stmt = $conn->prepare($query);
$stmt->bindParam(':affil_id', $affil_id, PDO::PARAM_STR);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$redirect = "http://example.com/welcome?lang=";
switch($row['lang']) {
case "ENG" : $redirect .= "en"; break;
case "HEB": $redirect .= "he"; break;
case "ES" : $redirect .= "es"; break;
case "BR" : $redirect .= "pt-br"; break;
default : $redirect .= "pt-br";
};
wp_redirect( $redirect );
exit;
};
};
I hope it will help someone in the future.