Contents of string are echoed out to screen when it’s not supposed to?

I’ve created a booking-plugin that is using textdomain bookitall-wp. The snippets below are showing what are done when send the confirmation mail (I’ve left out a whole lot including checks to db etc that is not relevant here).

When using the original language (Swedish) this works as expected. (User enter information and the user gets information of his/her reservation/booking through mail)

When not using the original language it works ALMOST as expected. The issue is that the contents $html is echoed out to screen when using german or english. I don’t have a clue what’s going on!?

//Snippet 1
$title_hello = __(‘Hej’,’bookitall-wp’);
$title_yourinfo = __(‘Dina uppgifter’,’bookitall-wp’);
$title_namebooking = __(‘Namn’,’bookitall-wp’);
$placeholder_namebooking = __(‘Ange ditt namn’, ‘bookitall-wp’);
$title_phonebooking = __(‘Telefon’,’bookitall-wp’);
$placeholder_phonebooking = __(‘Ange ditt telefonnummer’, ‘bookitall-wp’);

//Snippet 2
$html = ‘<html><body>’;
$html .= $title_hello . ‘!<br /><br />’;
$html .= __(‘Detta är en’, ‘bookitall-wp’);
$html .= ‘<strong> ‘;
$html .= __(‘bokningsbekräftelse’, ‘bookitall-wp’);
$html .= ‘</strong> ‘;
$html .= __(‘för er vistelse på Brännebrona Vandrarhem.’,’bookitall-wp’);
$html .= ‘<br />’;
$html .= __(‘Är något felaktigt eller har ni några frågor eller funderingar så hör av er så återkommer vi så fort som möjligt!’, ‘bookitall-wp’);
$html .= ‘<br /><br />’;
$html .= ‘<hr /><strong>’ . $title_yourinfo . ‘:</strong><br />’;
$html .= $title_namebooking . ‘: ‘ . $form_data[‘customer’][‘namebooking’] . ‘<br />’;
$html .= $title_phonebooking . ‘: ‘ . $form_data[‘customer’][‘phonebooking’] . ‘<br />’;
$html .= $title_welcometo . ‘ <strong>’ . $title_brannebrona . ‘</strong>!<br />’;
$html .= ‘<a href=””>’ . $title_brannebrona . ‘</a><br />’;
$html .= ‘</body></html>’;

//Snippet 3
add_filter( ‘wp_mail_content_type’,array($this, ‘create_htmlmail’ ) );

$headers = array();
$headers[] = ‘Reply-To: ‘ . $form_data[‘customer’][’emailbooking’] . ‘ <‘ . $form_data[‘customer’][’emailbooking’] . ‘>’;
wp_mail(‘’, __(‘Brännebrona vandrarhem bokningsbekräftelse’, ‘bookitall-wp’), $html, $headers);
wp_mail(‘’, __(‘Brännebrona vandrarhem bokningsbekräftelse’,’bookitall-wp’), $html, $headers);

wp_mail($form_data[‘customer’][’emailbooking’], __(‘Brännebrona vandrarhem bokningsbekräftelse’, ‘bookitall-wp’), $html);
$error_messages[] = __(‘TACK för din bokning!!!’, ‘bookitall-wp’);

Someone that have this issue? The snippet(s) above are part of a shortcode if that is relevant. I’m using WPML also. Could it be WPML?

Read more here:: Contents of string are echoed out to screen when it’s not supposed to?

Leave a Reply

Your email address will not be published. Required fields are marked *