Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Change Email Content

Hey guys,

Another question :P

I want to change the content of the welcome email (and maybe the others too). Where is that file located? I can't seem to find it anywhere.

Specifically I want to change this line in the welcome email "You can access the site at http://example.com/vanilla/index.php?p=/." because my forum is embedded in wordpress so I want to direct them to the embeded version instead.

Thanks,
Ben

Best Answer

  • peregrineperegrine MVP
    edited November 2012 Answer ✓

    The concept of the definitions is

    the left side of equation is coded into vanilla and the right side is what you want to change it to.

    to find definitions of things you can search the code with grep -ri for the translation you want or you can use the localedeveloper plugin or you can download some sample localizations from other languages to see examples of the definitions - Last I looked the chinese translation was pretty complete with definitions. If you only want to translate a few definitions - you can put them in a file in conf/locale.php. Otherwise, creating a locale with what you want is a good idea.

    also look in applications/dashboard/locale/en-Ca/definitions.php

    e.g. it is currently:

    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    You can access the site at {/,exurl,domain}.';
    

    =======

    in you locale which you defined Emebed-Locale

    applications/dashboard/locale/Emebed-Locale/definitions.php

    -- to change it you could do something like this

    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    
    Thanks for joining the site.  You can access the site at myforum.com';
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    thecashbag
«134

Answers

  • anyone?

  • You can create a new locale and only change the translations of the emails you want to change.

  • Hmm not sure how to do that. I tried looking at the documentation (http://vanillaforums.org/docs/localization) but not sure how to implement it. Should I create a new local called something like "embeded-locale" and then somehow tell it to change the email content? How do I tell it to change the email content?

  • Ok so I've succesfuly created a new local called "Emebed-Locale" I think... and the docs give these examples of 'translations'.

    $Definition['Translation from T()'] = 'Translation goes here.';
    $Definition['Hello World!'] = 'Bonjour tout le monde';
    $Definition['Changes saved.'] = 'Vos modifications ont été enregistrées avec succès';

    So how would create one for that welcome email? Would this be it?

    $Definition['You can access the site at http://example.com/vanilla/index.php?p=/'] = 'You can access the site at http://newurl.com/';

    I think that the http://example.com/vanilla/index.php?p=/ part get created dynamically so I dont think that would work... or would it?

  • peregrineperegrine MVP
    edited November 2012 Answer ✓

    The concept of the definitions is

    the left side of equation is coded into vanilla and the right side is what you want to change it to.

    to find definitions of things you can search the code with grep -ri for the translation you want or you can use the localedeveloper plugin or you can download some sample localizations from other languages to see examples of the definitions - Last I looked the chinese translation was pretty complete with definitions. If you only want to translate a few definitions - you can put them in a file in conf/locale.php. Otherwise, creating a locale with what you want is a good idea.

    also look in applications/dashboard/locale/en-Ca/definitions.php

    e.g. it is currently:

    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    You can access the site at {/,exurl,domain}.';
    

    =======

    in you locale which you defined Emebed-Locale

    applications/dashboard/locale/Emebed-Locale/definitions.php

    -- to change it you could do something like this

    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    
    Thanks for joining the site.  You can access the site at myforum.com';
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    thecashbag
  • @peregrine thanks!! Will try that now.

  • @peregrine

    Just a few more questions, almost got this I think.

    In the admin of Vanilla under the Locales menu link its says "Locales allow you to support other languages on your site. Once a locale has been added to your /home/thecashl/public_html/vanilla/locales folder, you can enable or disable it here."

    So originally I went to that directory and made a duplicate of the Skeleton locale, and renamed it "Embed-Locale". That is where my Embed-Locale is currently sitting.

    But you said I should change files in a different directory "applications/dashboard/locale/Embed-Locale/definitions.php". This directory is different from where Vanilla told me to create the new locale.

    So where is the correct place to create the locale to be used should I create that directory and change the files there? Or does it not matter where I do it?

    ..................................................

    This question may be a little trickier:

    I have just noticed that after someone clicks the confirmation link in the welcome email it does not take them to the embedded forum. So to change this I wanted to edit the confirmation link.

    In the code it has this:
    "Please confirm your email address by clicking on the following link: {/entry/emailconfirm,exurl,domain}/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}"

    Is there a way I can alter that confirmation link so that it sends them to the embedded version of the confirmation page?

    .....................................................

    Also I'm thinking there must be some sort of definition I can change that sets the base URL, so instead f it calling www.thecashlab.com/vanilla/the-rest-of-the-url it will always call www.thecashlab.com/forum/#/the-rest-of-the-url instead.

    Is that possible? It would make things easier if I could just change that one part and it would affect all emails that get sent out (because I'm sure there are a few more instances that I haven't thought of where it does not link to the embedded version of the forum).

    Judging from the example above maybe I need to change the "exurl,domain" somehow? Any idea if that could work or how I do it?

    Thanks,
    Ben

  • HalfCatHalfCat ✭✭
    edited November 2012
    1. vanilla/locales is correct.

    2. Yes: example.com/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}

    3. You could put vanilla in a directory called /forum instead of /vanilla if I understand you correctly.

    thecashbag
  • I have just made the changes to my new Embed-Locale and enabled it in the admin area but it's not working. The emails stay the same.

    This is the code have in the directory "/vanilla/locales/Embed-Locale/definitions.php". What have I done wrong?

    $LocaleInfo['Embed-Locale'] = array( // make sure the key of this array is the same as its folder name.
       'Locale'       => 'Embed-Locale',
       'Name'         => 'Embed-Locale',
       'Description'  => 'This is a skeleton of an emebeded forum.',
       'Version'      => '2.0.1',
       'Author'       => "ThecashLab.com",
       'AuthorEmail'  => '[email protected]',
       'AuthorUrl'    => 'http://thecashlab.com',
       'License'      => 'Your choice of license'
    );
    
    $Definition['Some Code'] = 'Translation goes here.';
    $Definition['Iñtërnâtiônàlizætiøn'] = 'Iñtërnâtiônàlizætiøn Translation!!!';
    
    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    Thanks for joining.  You can access the forum at thecashlab.com/forum/.';
    
    $Definition['EmailWelcomeConnect'] = 'You have successfully connected to {Title}. Here is your information:
    
      Username: {User.Name}
      Connected With: {ProviderName}
    
    You can access the forum at thecashlab.com/forum/.';
    
    $Definition['EmailConfirmEmail'] = 'You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: www.thecashlab.com/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
    

    Also unfortunately I cannot put the directory in /forum instead of /vanilla because last time I tried that a lot of the admin section was broken. I think it was in conflict with wordpress since I have a page that is located at /forum.

  • I also just tried putting this chunk of the code in the "vanilla/locales/Embed-Locale/other_definitions.php" file. But no luck.

    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    
      Username: {User.Name}
      Email: {User.Email}
    
    Thanks for joining.  You can access the forum at thecashlab.com/forum/.';
    
    $Definition['EmailWelcomeConnect'] = 'You have successfully connected to {Title}. Here is your information:
    
      Username: {User.Name}
      Connected With: {ProviderName}
    
    You can access the forum at thecashlab.com/forum/.';
    
    $Definition['EmailConfirmEmail'] = 'You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: www.thecashlab.com/forum/#/entry/emailconfirm/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
    
  • Do you want to change just a few definitions?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited November 2012

    the easiest way is to modify or create conf/locale.php if you are doing a few definitions, and forget about the Embed-Locale (in other words remove it)

    and then
    create this file called conf/locale.php

    <?php if (!defined('APPLICATION')) exit();
    
    
    $Definition['EmailWelcomeRegister'] = 'You have successfully registered for an account at {Title}. Here is your information:
    Username: {User.Name}
    Email: {User.Email}
    Thanks for joining. You can access the forum at thecashlab.com/forum/.';
    $Definition['EmailWelcomeConnect'] = 'You have successfully connected to {Title}. Here is your information:
    Username: {User.Name}
    Connected With: {ProviderName}
    You can access the forum at thecashlab.com/forum/.';
    $Definition['EmailConfirmEmail'] = 'You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: www.thecashlab.com/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';
    
    
    
    ----
    
    proof of concept.  this is the mail I got after changing conf/locale.php
    X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
    MIME-Version: 1.0
    Content-Transfer-Encoding: 8bit
    Content-Type: text/plain; charset="utf-8"
    
    Hello test4!
    
    You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: www.thecashlab.com/111/8GDP35F6
    
    Have a great day!
    
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    thecashbag
  • peregrineperegrine MVP
    edited November 2012

    also delete

    cache/locale_map.ini

    when modifying locales. And you can change definitions in about 5 places. All will work - including what I said originally and what halfcat said.

    e.g. - all of these get read and if the definition is duplicated the last one is used.
    so you can see the order here....

    0 = "/var/www/vanilla/applications/dashboard/locale/en-CA/definitions.php"
    1 = "/var/www/vanilla/applications/vanilla/locale/en-CA/definitions.php"
    2 = "/var/www/vanilla/applications/conversations/locale/en-CA/definitions.php"
    3 = "/var/www/vanilla/plugins/MembersListEnh/locale/en-CA/definitions.php"
    4 = "/var/www/vanilla/conf/locale.php"
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    thecashbag
  • Ok after a lot of trail and error I figured out what to do. If anyone else is having the same problem this will fix it:

    1) Make a copy of the skeleton locale in vanilla/locales and rename it to whatever you want.
    2) Update all the info inside the definitions.php file.
    3) Go to your admin area and enable your new locale
    4) Make is a default by using the drop down box on the same page
    5) Go to vanilla/locales/your-new-locale/other_definitions.php and past in what ever definitons you want to change. You can use the code above if you want to change the welcome emails.

    .......................

    One thing I can't figure out is this:

    $Definition['EmailConfirmEmail'] = 'You need to confirm your email address before you can continue. Please confirm your email address by clicking on the following link: www.thecashlab.com/forum/#/entry/emailconfirm/{User.UserID,rawurlencode}/{EmailKey,rawurlencode}';

    No matter how much I tweak it I cannot get that part of the email to change.

  • edited November 2012

    Thanks again for the help peregrine.

    I tried it your way to see if I could get the $Definition['EmailConfirmEmail'] working.... but still no change. Strange that it worked for you and not me?

    When I deleted my Emeded-Locale and tried to restore the default back to ea-CA it kept coming back with an error saying "Your default locale won't display properly until it is enabled below. Please enable the following: ."

    But it no matter what I did the warning would not go away until I restored the Embeded-Locale. So I just restored the Embed-Locale.

    So now my Embeded-Locale is working... expect for the $Definition['EmailConfirmEmail']

  • peregrineperegrine MVP
    edited November 2012

    ea-CA???

    in conf - this should put you back
    $Configuration['Garden']['Locale'] = 'en-CA';

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    thecashbag
  • Sorry. Will try to be faster.

  • is it working?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Ok locale error is gone.

    I'm using your config method...

    but still confirm link wrong.

  • so you have conf/locale.php exactly as I posted.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.