This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues with Gravity Forms where the confirmation translation only includes the URL field and ignores the URL parameter field, particularly when switching languages (e.g., from German to English), resulting in missing URL parameters in the redirection.
Solution:
We found that the issue is related to custom coding and the wp-force-login plugin. Specifically, the problem occurs in the
/wp-content/plugins/FHWPLoginRedirect/FHWPLoginRedirect.php
file within the
my_login_page
function, which incorrectly handles URL parameters during redirections for different languages. To resolve this, replace the existing function with the following code:
add_filter('login_url', 'my_login_page', 10, 3);<br />function my_login_page($login_url, $redirect, $force_reauth) {<br /> $request_redirect = '';<br /> if (isset($_GET['redirect_to']) && $_GET['redirect_to'] !== '') {<br /> $request_redirect = wp_unslash($_GET['redirect_to']);<br /> }<br /> $existing_redirect = '';<br /> $login_parts = wp_parse_url($login_url);<br /> if (!empty($login_parts['query'])) {<br /> parse_str($login_parts['query'], $q);<br /> if (!empty($q['redirect_to'])) {<br /> $existing_redirect = $q['redirect_to'];<br /> }<br /> }<br /> $target = $request_redirect ?: ($redirect ?: $existing_redirect);<br /> $target_path = '';<br /> if (!empty($target)) {<br /> $tp = wp_parse_url($target);<br /> $target_path = $tp['path'] ?? '';<br /> } else {<br /> $target_path = wp_parse_url($_SERVER['REQUEST_URI'] ?? '')['path'] ?? '';<br /> }<br /> $is_en = (strpos($target_path, '/en/') === 0)<br /> || (strpos($_SERVER['REQUEST_URI'] ?? '', '/en/') === 0);<br /> $base = $is_en ? home_url('/en/login-registration/') : home_url('/login/');<br /> if (empty($request_redirect) && !empty($target_path)) {<br /> if ($is_en && strpos($target_path, '/en/login-registration/') === 0) {<br /> return $base;<br /> }<br /> if (!$is_en && strpos($target_path, '/login/') === 0) {<br /> return $base;<br /> }<br /> }<br /> if (!empty($target)) {<br /> $base = add_query_arg('redirect_to', $target, $base);<br /> }<br /> if ($force_reauth) {<br /> $base = add_query_arg('reauth', '1', $base);<br /> }<br /> return $base;<br />}Please implement this solution and verify if it resolves your issue. If this solution does not apply to your case or seems outdated, we recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket at WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 31 replies, has 1 voice.
Last updated by 1 month, 1 week ago.
Assisted by: Osama Mersal.