[PATCH] qTranslate support for forms that are redirected after submission
-
Updating the profile by submitting the form leads the user to the profile page in the default language, regardless of what language they had chosen.
For fix, locate in modules/themed-profiles/themed-profiles.php the line 167:
$redirect = add_query_arg( array( 'updated' => 'true' ) );
and add these right after it:
// Support qTranslate's language-aware URLs if ( function_exists( 'qtrans_convertURL' ) ) { $redirect = qtrans_convertURL( $redirect ); // Needed to convert & to &, raises a 403 error without $redirect = htmlspecialchars_decode( $redirect ); }
Haven’t yet encountered the following need, but it might be that the same should be applied after line 28:
$redirect_to = $theme_my_login->get_login_page_link( array( 'action' => 'profile' ) );
The same should also be applied to at least registration, login and forgot password forms in order to let the user see the error messages in his/her chosen language.
For supporting other plugins like WPML, it’s possible to move these all behind an abstraction. Make an abstraction file with a function “tml_multilingual_url” and have it recognize whether it should call a different file with a function “tml_qtranslate_url” or “tml_wpml_url”, and call the functions in the abstraction file instead of the current straight-out patch.
That abstraction fixes the only drawback I can perceive in the patch submitted above, which is the maintainability of the code.
- The topic ‘[PATCH] qTranslate support for forms that are redirected after submission’ is closed to new replies.