This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're trying to register as a vendor on a Hebrew website using an English registration form and the Email Verification Code sent to you is aligned to the right instead of the left, this might be due to the language settings affecting the email styling.
Solution:
We recommend switching the language of your emails before sending them. You can use the
wpml_switch_language_for_email
hook to adjust the language settings for your emails. More details on this hook can be found here: https://wpml.org/wpml-hook/wpml_switch_language_for_email/
Additionally, you can modify the email template directly. Open the file at
.../wp-content/plugins/wc-multivendor-membership/views/emails/email-verification.php
. Replace the existing WooCommerce email header action with a new block that switches the language context based on the user's email. Here's the code you should use:
// Workaround for compsupp-7719 // Workaround for compsupp-7719 // Switch language context if( apply_filters( 'wcfm_allow_wpml_email_translation', true ) ) { do_action('wpml_switch_language_for_email', $user_email); } ?> <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?/>" /> <meta content="width=device-width, initial-scale=1.0" name="viewport"/> <title><?php echo get_bloginfo( 'name', 'display' ); ?></title> </head> <body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> <table width="100%" id="outer_wrapper"> <tr> <td><!-- Deliberately empty to support consistent sizing and layout across multiple email clients. --></td> <td width="600"> <div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>"> <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> <tr> <td align="center" valign="top"> <div id="template_header_image"> <?php $img = get_option( 'woocommerce_email_header_image' ); if ( $img ) { echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" /></p>'; } ?> </div> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_container"> <tr> <td align="center" valign="top"> <!-- Header --> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header"> <tr> <td id="header_wrapper"> <h1 style="text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>"><?php echo esc_html( $email_heading ); ?></h1> </td> </tr> </table> <!-- End Header --> </td> </tr> <tr> <td align="center" valign="top"> <!-- Body --> <table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_body"> <tr> <td valign="top" id="body_content"> <!-- Content --> <table border="0" cellpadding="20" cellspacing="0" width="100%"> <tr> </tr></table></td></tr></table></td></tr></table></td></tr></table></div></td></tr></table></body></html>
Ensure to set the text alignment in the HTML body of the email template to respect the left or right text direction based on the language context. At the end of the file, add the following code to switch the language back:
<?php // switch language back if( apply_filters( 'wcfm_allow_wpml_email_translation', true ) ) { do_action('wpml_restore_language_from_email'); } ?>
If this solution does not resolve your issue or seems irrelevant due to updates or differences in your case, we highly 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 needed, please open a new support ticket at WPML support forum for further assistance.
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 8 replies, has 3 voices.
Last updated by 2 weeks, 6 days ago.
Assisted by: Dražen.