This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is using WPML to translate Gravity Forms on their website and has resolved the initial issue of enabling translation. However, they now need to send admin notifications to different email addresses based on the language of the form.
Solution:
We recommend using the gform_notification hook to customize the email notifications based on the form's language. Here is an example of how you can implement this:
add_filter( 'gform_notification', 'language_based_notification_email', 10, 3 );
function language_based_notification_email( $notification, $form, $entry ) {
if ( $notification['name'] == 'Admin Notification' ) {
$language = apply_filters( 'wpml_current_language', null );
$emails = array(
'en' => 'admin-en@example.com',
'de' => 'admin-de@example.com',
'fr' => 'admin-fr@example.com',
);
if ( isset( $emails[ $language ] ) ) {
$notification['toType'] = 'email';
$notification['to'] = $emails[ $language ];
}
}
return $notification;
}Please note that this solution might be outdated or not applicable to your specific 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 this does not resolve your issue, 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 2 replies, has 1 voice.
Last updated by 3 months, 3 weeks ago.
Assisted by: Andreas W..