From 4a8a424bdfc5e536fd24fc2a4b92dd794fd22911 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 18 Apr 2011 09:04:11 -0400 Subject: [PATCH] Use mail templates for invite text --- actions/invite.php | 37 +++++++++++++++---------------------- mail-src/invite | 24 ++++++++++++++++++++++++ mail-src/invitepersonal | 28 ++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 22 deletions(-) create mode 100644 mail-src/invite create mode 100644 mail-src/invitepersonal diff --git a/actions/invite.php b/actions/invite.php index 9522cac900..fc2d17e03d 100644 --- a/actions/invite.php +++ b/actions/invite.php @@ -262,37 +262,30 @@ class InviteAction extends CurrentUserDesignAction return false; } + $confirmUrl = common_local_url('register', array('code' => $invite->code)); + $recipients = array($email); $headers['From'] = mail_notify_from(); $headers['To'] = trim($email); + $headers['Content-Type'] = 'text/html; charset=UTF-8'; + // TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral // TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is // TRANS: the StatusNet sitename. + $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); - // TRANS: Body text for invitation email. Note that 'them' is correct as a gender-neutral - // TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, %2$s is the - // TRANS: StatusNet sitename, %3$s is the site URL, %4$s is the personal message from the - // TRANS: inviting user, %s%5 a link to the timeline for the inviting user, %s$6 is a link - // TRANS: to register with the StatusNet site. - $body = sprintf(_("%1\$s has invited you to join them on %2\$s (%3\$s).\n\n". - "%2\$s is a micro-blogging service that lets you keep up-to-date with people you know and people who interest you.\n\n". - "You can also share news about yourself, your thoughts, or your life online with people who know about you. ". - "It's also great for meeting new people who share your interests.\n\n". - "%1\$s said:\n\n%4\$s\n\n". - "You can see %1\$s's profile page on %2\$s here:\n\n". - "%5\$s\n\n". - "If you'd like to try the service, click on the link below to accept the invitation.\n\n". - "%6\$s\n\n". - "If not, you can ignore this message. Thanks for your patience and your time.\n\n". - "Sincerely, %2\$s\n"), - $bestname, - $sitename, - common_root_url(), - $personal, - common_local_url('showstream', array('nickname' => $user->nickname)), - common_local_url('register', array('code' => $invite->code))); + $title = (empty($personal)) ? 'invite' : 'invitepersonal'; + + $inviteTemplate = DocFile::fromTitle($title, DocFile::mailPaths()); + + $body = $inviteTemplate->toHTML(array('inviter' => $bestname, + 'inviteurl' => $profile->profileurl, + 'confirmurl' => $confirmUrl, + 'personal' => $personal)); + + common_debug('Confirm URL is ' . common_local_url('register', array('code' => $invite->code))); mail_send($recipients, $headers, $body); } diff --git a/mail-src/invite b/mail-src/invite new file mode 100644 index 0000000000..469b0cc0ad --- /dev/null +++ b/mail-src/invite @@ -0,0 +1,24 @@ +%%arg.inviter%% has invited you to join them on %%site.name%%. + +%%site.name%% is a micro-blogging service that lets you keep +up-to-date with people you know and people who interest you. + +You can also share news about yourself, your thoughts, or your life +online with people who know about you. + +It's great for meeting new people who share your interests. + +You can see %%arg.inviter%%'s profile page on %%site.name%% here: + + %%arg.inviterurl%% + +If you'd like to try the service, click on the link below to accept +the invitation. + + %%arg.confirmurl%% + +If not, you can ignore this message. Thanks for your patience and your time. + +Sincerely, + +%%site.name%% diff --git a/mail-src/invitepersonal b/mail-src/invitepersonal new file mode 100644 index 0000000000..c9705479d1 --- /dev/null +++ b/mail-src/invitepersonal @@ -0,0 +1,28 @@ +%%arg.inviter%% has invited you to join them on %%site.name%%. + +%%site.name%% is a micro-blogging service that lets you keep +up-to-date with people you know and people who interest you. + +You can also share news about yourself, your thoughts, or your life +online with people who know about you. + +It's great for meeting new people who share your interests. + +They said: + + %%arg.personal%% + +You can see %%arg.inviter%%'s profile page on %%site.name%% here: + + %%arg.inviterurl%% + +If you'd like to try the service, click on the link below to accept +the invitation. + + %%arg.confirmurl%% + +If not, you can ignore this message. Thanks for your patience and your time. + +Sincerely, + +%%site.name%% -- 2.39.5