Jump to content

variable $marketingEmailOptInMessage ...


Remitur

Recommended Posts

The variable $marketingEmailOptInMessage is used in clientregister.tpl (and, I guess, also in some other .tpl), is the one defining the mailing list "policy", and its value is:

Quote

We would like to send you occasional news, information and special offers by email. To join our mailing list, simply tick the box below. You can unsubscribe at any time.

But in the .tpl it's used a simple variable, not a language one:

       {if $showMarketingEmailOptIn}
            <div class="marketing-email-optin">
                <h4 class="bolder">{lang key='emailMarketing.joinOurMailingList'}</h4>
                <p>{$marketingEmailOptInMessage}</p>
                <input type="checkbox" name="marketingoptin" value="1"{if $marketingEmailOptIn} checked{/if} class="no-icheck toggle-switch-success" data-size="small" data-on-text="{lang key='yes'}" data-off-text="{lang key='no'}">
            </div>
        {/if}

And it may be changed (but only for main language!!!) in General Settings => Other

So it's impossible to translate it in different languages...

Question: Does exist any real reason for this?

If I change the .tpl files using a custom language variable I guess that everything will work fine, but before doing it it's better to ask ... 😉

Link to comment
Share on other sites

6 hours ago, Remitur said:

The variable $marketingEmailOptInMessage is used in clientregister.tpl (and, I guess, also in some other .tpl)

in terms of Six & SC, I think it's three templates - checkout, clientareadetails and clientregister.

6 hours ago, Remitur said:

So it's impossible to translate it in different languages...

impossible, sir ? impossible ?? 😉

6 hours ago, Remitur said:

Question: Does exist any real reason for this?

their logic must be so that it's simpler for a user to change the string from the admin area as opposed to using Language Overrides (as they do everywhere else) - it's a little inconsistent as the more logical way in my eyes would have been to just make it a language string and tell user to use overrides to change it... but multilingual is seemingly not the first thought of those writing WHMCS. 🙄

6 hours ago, Remitur said:

If I change the .tpl files using a custom language variable I guess that everything will work fine, but before doing it it's better to ask ... 😉

I can't see why not, but wouldn't it be easier to use an action hook... 🙂

<?php

# Translate Email Marketing Opt-In String Hook
# Written by brian!

function translate_marketing_optin_string_hook($vars) {
	
	$marketing_message = $vars['marketingEmailOptInMessage'];
	if (!in_array(Lang::trans('marketingEmailOptInMessage'),array($marketing_message,'marketingEmailOptInMessage'))) {
		$marketing_string = Lang::trans('marketingEmailOptInMessage');
		return array("marketingEmailOptInMessage" => $marketing_string);
	}
}
add_hook("ClientAreaPageCart", 1, "translate_marketing_optin_string_hook");
add_hook("ClientAreaPageProfile", 1, "translate_marketing_optin_string_hook");
add_hook("ClientAreaPageRegister", 1, "translate_marketing_optin_string_hook");

and you'll also need to define the override string for each language that you want to modify...

$_LANG['marketingEmailOptInMessage'] = "to be or not to be, that is the question.";

so, if I modified the English language overrides file with the above string, English users would then see...

TAY1yLF.png

if I did the same in the Italian overrides file (translation from Google - don't blame me!)...

$_LANG['marketingEmailOptInMessage'] = "Vorremmo inviarti notizie, informazioni e offerte speciali occasionali via e-mail. Per iscriverti alla nostra mailing list, seleziona la casella qui sotto È possibile disdire in qualsiasi momento.";

... Italian users would see...

DcdI3BW.png

if the user chooses an unmodified language, e.g one that you haven't translated this marketing string to their language, they will be shown the default string from general settings. 🙂

J4YHprA.png

I did give the v7.8 beta a quick look, and I think this feature still works the same as with v7.7 - in that the string is modifiable only via general settings.

Edited by brian!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated