Advertisement:

Author Topic: Email Template Editor  (Read 66203 times)

Offline fairchilde

  • Newbie
  • *
  • Posts: 4
Re: Email Template Editor
« Reply #100 on: October 30, 2012, 08:12:54 PM »
That makes perfect sense, and should be easy to manipulate. Is there a location or file that I should be looking for the existing str_replace and add this one to? I searched through the files on my host and couldn't find any instances where it was used. Any follow up recommendations?

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #101 on: October 31, 2012, 10:23:13 AM »
Well, if you parse the mod on the mod site, or look in the package, you'll be able to find all of Email Template Editors code, which would also have the str_replace(); be it in an edit, or in a file, it'd be there. Most likely, when I wrote this...I put it in a direct modification, and not it's own file. Which would make it easier to track for you, actually. But not as good of a practice overall.

Let's go ahead and parse it...Email Template Editor, select 2.0 RC5 from the compatibility list on the right, and then click Parse. Hmm, I don't see any str_replace();'s. So that must mean it's in an Email Template Editor file. So, we'll download the .zip, extract the archive, and open "EmailTemplateEditor.php".

Lines 73-81:
Code: (Global Preset Variables) [Select]
// Global Pre-Set Variables...
$context['email_templates']['preset_variables']['global'] = array(
'forumname' => '{FORUMNAME}',
'scripturl' => '{SCRIPTURL}',
'themeurl' => '{THEMEURL}',
'imagesurl' => '{IMAGESURL}',
'default_themeurl' => '{DEFAULT_THEMEURL}',
'regards' => '{REGARDS}'
);
Actually, it's quite surprising how well I wrote this for how long ago it was.

Hope this helps!
Have a fantastic day!

Offline fairchilde

  • Newbie
  • *
  • Posts: 4
Re: Email Template Editor
« Reply #102 on: November 01, 2012, 07:09:27 PM »
you sir. you are a super hero! ;) have a great day!

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #103 on: November 01, 2012, 07:22:25 PM »
Haha thank you, and you as well!

Offline littlenicki

  • Jr. Member
  • **
  • Posts: 195
Re: Email Template Editor
« Reply #104 on: November 05, 2012, 02:44:22 PM »
Hello could this mod be backported to SMF 1.1 please? Thank you
Fomer SMF user. Switched to Invision Power Board and VBulletin

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #105 on: November 05, 2012, 03:54:21 PM »
Nope, this modification will not be ported back to SMF 1.1.x. Unless someone were wanting it badly enough to make a reasonable donation, then I'd consider it.

Offline FireDitto

  • Full Member
  • ***
  • Posts: 617
  • Gender: Female
  • Shadow In The Flame
    • @SPWeyr on Twitter
    • Second Pass Weyr RPG
Re: Email Template Editor
« Reply #106 on: January 16, 2013, 06:08:08 AM »
Hey guys; Installed and works great, but I do have a question.

The email it brought up when I first asked it to let me edit came in with a lot of {DESCRIPTION's} that didn't phase through into links and so such, such as: {USERNAME}, {FORGOTPASSWORDLINK}, {ACTIVATIONLINK}, {ACTIVATIONLINKWITHOUTCODE} and {ACTIVATION CODE}

I'm happy to manually add them, or whatever, but... I have no idea how to go about it. I mean, I see your code quote above, pointing out where the ones that worked are, but how do I know which bit is relevant for the information I don't have?

Thank you :)
Second Pass Weyr
An AU Pernse RPG

SMF 2.0.6 with SP 2.3.5

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #107 on: January 16, 2013, 06:21:23 AM »
Those "quick variables" will only work in certain email templates that already parse them.

Offline FireDitto

  • Full Member
  • ***
  • Posts: 617
  • Gender: Female
  • Shadow In The Flame
    • @SPWeyr on Twitter
    • Second Pass Weyr RPG
Re: Email Template Editor
« Reply #108 on: January 16, 2013, 07:06:25 AM »
Oh.

How would I go about making them work now? Can I make them 'global'?
Second Pass Weyr
An AU Pernse RPG

SMF 2.0.6 with SP 2.3.5

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #109 on: January 16, 2013, 07:11:36 AM »
To make a "global preset variable" or whatever I call them in this modification, you'd need to write some sort of str_replace(); that actually replaced the "text" with the substance you expect. For instance...$string = '{scripturl}' -> str_replace('{scripturl}', $scripturl, $string);

If the data is not in an existing variable, you have to retrieve it somehow with a query or what not, so it can definitely get more complicated depending on what you are trying to access. What is your goal here?

Offline FireDitto

  • Full Member
  • ***
  • Posts: 617
  • Gender: Female
  • Shadow In The Flame
    • @SPWeyr on Twitter
    • Second Pass Weyr RPG
Re: Email Template Editor
« Reply #110 on: January 16, 2013, 10:14:16 AM »
I think I understood that, lol. I need to go to bed, so I'll re-read that and make sense of it in the morning.

Namely, to make whatever crops up in the default email style work as it was intended to; I just want to easily edit the flowery text around the needed information. So that would be those above, and whatever others crop up in the other email templates, I expect.
Second Pass Weyr
An AU Pernse RPG

SMF 2.0.6 with SP 2.3.5

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 73,189
Re: Email Template Editor
« Reply #111 on: February 19, 2013, 04:03:29 PM »
As a suggestion, would it not be worth taking the time to go through the email templates, finding out what variables they use (not just what they claim to use, but what the source actually exposes to the email loader), and providing that as a list to users?

I've been doing that today and I've gone through all the templates, figuring out what's available, it's pretty dull to backtrace everything though ;) I did also harmonise some stuff, for consistency as well as provide a description to users of when each email will be sent.

When I first saw the mod, I actually thought the list on the left were actually a set of buttons that one could click to have the variable inserted directly into the body, like bbcode etc. is in the main editor normally. Might be another nice feature to add.

It certainly would be a great addition to 2.1 and I see no reason at all not to include it as a core feature (you're a developer, just implement it and worry about complaints later, hahah). I'd also be inclined to move it to Admin > Maintenance > Mail as a subitem rather than in the main area, though. Keeps all the mail stuff together.

If it does get added, spending the extra day to collate all the information is really worth it IMHO.(Screenshot attached for what it can look like. I suck at UI.)
No good deed goes unpunished
All helpful urges should be circumvented

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #112 on: February 19, 2013, 06:51:25 PM »
Hey Arantor!

Thank you for providing your thoughts, and I'll definitely consider it. Also nice to see what you've come up with for Wedge, looks pretty cool.

Best Regards

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #113 on: April 29, 2013, 01:33:12 PM »
I will be rewriting this modification when SMF hits 2.1.

Offline kdmiller45

  • Semi-Newbie
  • *
  • Posts: 73
Re: Email Template Editor
« Reply #114 on: May 17, 2013, 01:03:41 PM »
Will this editor be modified to work with version 2.04 in the near future, sound like what I need, but will not install with smg 2.04.

Offline Colin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,892
  • Gender: Male
  • SMF Developer
    • colinschoen on GitHub
Re: Email Template Editor
« Reply #115 on: May 17, 2013, 01:51:31 PM »
Do you mean 2.0.4? It should work.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Offline Matthew K.

  • SMF Super Hero
  • *******
  • Posts: 12,431
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: Email Template Editor
« Reply #116 on: May 17, 2013, 01:59:13 PM »
Yeah, I've used this on SMF 2.0.4. :P No absolute promises though.

Offline Colin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,892
  • Gender: Male
  • SMF Developer
    • colinschoen on GitHub
Re: Email Template Editor
« Reply #117 on: May 17, 2013, 01:59:59 PM »
What error are you getting?
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Offline srs

  • Semi-Newbie
  • *
  • Posts: 18
Re: Email Template Editor
« Reply #118 on: May 18, 2013, 12:49:16 PM »
Does this work on SMF version 2.0.4 ?

Offline Colin

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,892
  • Gender: Male
  • SMF Developer
    • colinschoen on GitHub
Re: Email Template Editor
« Reply #119 on: May 18, 2013, 01:14:26 PM »
Indeed.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin