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.
Add Discussion Subject in Email Body
How can I add the discussion subject in the email body?
0
Comments
class EMailSubscribe extends Gdn_Plugin {
public function PostController_AfterDiscussionSave_Handler(&$Sender){
$Session = Gdn::Session();
$UserName = $Session->User->Name;
$ActivityHeadline = $UserName . " has started a new discussion";
$DiscussionID = $Sender->EventArguments['Discussion']->DiscussionID;
$DiscussionName = $Sender->EventArguments['Discussion']->Name;
$CategoryID = $Sender->EventArguments['Discussion']->CategoryID;
$Story = "Entitled..." . $Sender->EventArguments['Discussion']->Name;
Now my emails basically look like...
"MikeBerry has started a new discussion....
Entitled.... How to fix something"
Could you possible supply the code for your whole default.php, or at least the bit that displays the text in the email body? Think its wrapped around $Message parameter. I'm trying to figure out what the parameter is to include the discussion title in the email body, but I'm struggling to work out your example above, as its quite different from my file... I've tried $DiscussionName and $Story so far.
thanks,
<?php if (!defined('APPLICATION')) exit();
/**
* Changelog
* 0.1.1
* * fixed bug sending email to deleted users
* 0.1.22
* * fix typo
* 0.1.30
* * enforcing permissions - users can't subscribe to Categories that they don't have Vanilla.Discussions.View permission
* 0.1.31
* * reestablish the "Subscribe everyone to everything" and improve it with "everything they can view" via some SQL juggling.
* 0.1.32
* * fix bug where I left a die() in the code.
* 0.1.33
* * finally understood how categories and permissions work, despite the lack of documentation in the code.
*/
$PluginInfo['EMailSubscribe'] = array(
'Description' => 'Enables users to subscribe to receive e-mails when new posts in different Categories are posted',
'Version' => '0.1.33',
'RequiredApplications' => NULL,
'RequiredTheme' => FALSE,
'RequiredPlugins' => FALSE,
'HasLocale' => FALSE,
'Author' => 'Catalin David',
'AuthorEmail' => 'c.david@jacobs-university.de'
);
class EMailSubscribe extends Gdn_Plugin {
public function PostController_AfterDiscussionSave_Handler(&$Sender){
$Session = Gdn::Session();
$UserName = $Session->User->Name;
$ActivityHeadline = $UserName . " has started a new discussion";
$DiscussionID = $Sender->EventArguments['Discussion']->DiscussionID;
$DiscussionName = $Sender->EventArguments['Discussion']->Name;
$CategoryID = $Sender->EventArguments['Discussion']->CategoryID;
$Story = "Entitled..." . $Sender->EventArguments['Discussion']->Name;
After line 53 ish of the default.php you shoudl have something similar to:
$Subject = "blah blah blah";
Add underneath:
$PostTitle = $_REQUEST['Discussion/Name'];
$PostContent = $_REQUEST['Discussion/Body'];
Within the email section below that (contained within the $Message container), you can then reference $PostTitle and $PostContent to make the discussion title and body copy appear as appropriate.
Works well for me anyway...
Thanks Bezzoh, very much this was the only solution to stopping PHP code being sent in the emails when WYSIWYG plugins are installed. Save me a sleepless night.
Please help I'm at total loss where to find this problem: where do i find the code???
No 1::
admin started a discussion. email testing --- Follow the link below to check it out: http://www.korat-expatsforum.services-thai.com/discussion/53/email-testing Have a great day!
I recive this without the link highlighted on one Forum then on the other forum I receive the one below which is correct >
No 2::
admin has started a new discussion
Entitled...Case of Central World arson to be ruled in late March
Follow the link below to check it out:
http://www.surin-expatsforum.services-thai.com/discussion/6/case-of-central-world-arson-to-be-ruled-in-late-march
Have a great day!
This was solved this morning: Thanks to help from Vrijvlinder.
I think this is the code thats tell what to send out in EMailDiscussion/default.php:
<
p>A new message has been posted by ' . $Name . '. It can be accessed at Link
If i wanted to ad the "Discussion Title" because this is what would make members click the link. How would add "Discussion Title" ? I want to use this not just as a message email but to generate visits.
I have tried many ways but just keep coming up with line errors. I only been learning PHP/ HTML for about 4 weeks so need some help.
Thanks, Denis
I never did get this working to sen Title so I tried again today but get the error> Parse error: syntax error, unexpected T_STRING in /home3/hannahas/public_html/isaan-expatsforum/plugins/EMailDiscussion/default.php on line 56
This the code:
'. $Subject .'
$PostTitle = $_REQUEST['Discussion/Name'];
A new message has been posted by ' . $Name . '.$PostTitle .' It can be accessed at Link
where am I going wrong. I really want to send Tiles
Try this
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I don't want Member to use the emaildiscussion plugin only Admin or Moderators and only send discussion title, eg: " Border insecurity mounts as tourist visa abuse is targeted " Is this what this will do?
I did put this code in and got this error:
Parse error: syntax error, unexpected $end in /home3/hannahas/public_html/isaan-expatsforum/plugins/EMailDiscussion/default.php on line 88
you most likely didn't cut and paste the code correctly.
check to make sure you have all the closing brackets }
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks peregrin and vrijvlinder. Yes must have been me somehow not pasteing correctly. I tried again today and it sends the discussion title now. but it sends the full link address not just "link" and the message is different to what's in the code, how?
Recieved today > deniss started a discussion.
On the Thai Expats facebook page we get a lot of invitations
Follow the link below to check it out:
http://isaan-expatsforum.services-thai.com/discussion/1863/on-the-thai-expats-facebook-page-we-get-a-lot-of-invitations
Have a great day!
Received before: > A new message has been posted by deniss
It can be accessed at Link
In the code it's still the same, where does it get the message and how can i edit it?
ok you need to see in your config.php if you have
$Configuration['Garden']['Email']['MimeType']= 'text/html';
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
That message is in the locale $Definitions as a Email story.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
ok you need to see in your config.php if you have
$Configuration['Garden']['Email']['MimeType']= 'text/html';
No don't have, should i put in?
vrijvlinder: That message is in the locale $Definitions as a Email story. not in mine
/conf/locale.php >>>>>
<?php if (!defined('APPLICATION')) exit();
$Definition['Howdy, Stranger!'] = 'Welcome to Thai Expats!';
$Definition["GuestModule.Message"] = "If you want to take part in the discussions, sign in or apply for membership below!";
its the same old story add them if they are not there!
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.