Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 01:00:01 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155538 Posts in 21712 Topics by 7737 Members
Latest Member: deanmacullam
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Droplet or snippet request for notification when news is commented  (Read 1203 times)
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« on: November 10, 2010, 01:39:04 PM »

I tried to implement a function that sends an email notification when a news item is commented. There is a topic that has code, but I can't get it to work. See http://www.websitebaker2.org/forum/index.php/topic,4699.0.html

Ideal would be a droplet that I can just put in the settings of the news module, but code snippet to put in a php file would be okay as well. Can anyone help? Thanks in advance!
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2858



WWW
« Reply #1 on: November 10, 2010, 02:00:17 PM »

Hoi Argos,

Can't be done with a droplet in settings.

You need extra code wich mail a warning when and only when a submission is made, therefore the best option is to add that code to submit_comment.php,
search for: around line 121,
   // Insert the comment into db
A few lines later, right before the header statement this code can be added.

   // Sending the email
               $mail_to = 'address@tosendmail.to';
               $mail_subject = 'A comment has been made';
               $mail_message = 'One newsitem has been commented on this page: '.$wb->page_link($page['link']).'?post_id='.$post_id.' !';
   $wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message);

Didn't test it!! but think it'll get you started Wink

Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #2 on: November 10, 2010, 02:09:56 PM »

Works right away John, thank you very much!  grin

I'll post a reference in the other topic.

I have edited the snippet to contain a working link and the comment itself:

 
Code:
$mail_to = 'address@tosendmail.to';
   $mail_subject = 'A comment has been made';
   $mail_message = 'One newsitem has been commented on this page: <a href="'.$wb->page_link($page['link']).'">'.$wb->page_link($page['link']).'</a>
   
   Comment:
   '.$comment.'' ;
   
   $wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message);
« Last Edit: November 10, 2010, 02:25:16 PM by Argos » Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2858



WWW
« Reply #3 on: November 10, 2010, 03:09:40 PM »

Cool to know I can still make working code without testing Wink

PS Will be incoörporated in articles.
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Argos
Moderator
**
Offline Offline

Posts: 2161


WWW
« Reply #4 on: November 10, 2010, 03:13:33 PM »

Cool to know I can still make working code without testing Wink
I'm jealous  wink
Quote
PS Will be incoörporated in articles.
Nice. Maybe you can use language variables instead of the hardcoded English text lines.
Logged

Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase: http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2858



WWW
« Reply #5 on: November 10, 2010, 03:20:18 PM »

will be in settings
adminsettings, use comments? use mail notification?
settings - comments, comment layout template and email template if the above is true

Will be a heap of settings Wink

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
nuke

Offline Offline

Posts: 27


« Reply #6 on: February 24, 2011, 09:33:14 PM »

Thanks for this Argos and John - this works great, just what I was looking for =)

-Mike

Works right away John, thank you very much!  grin

I'll post a reference in the other topic.

I have edited the snippet to contain a working link and the comment itself:

 
Code:
$mail_to = 'address@tosendmail.to';
   $mail_subject = 'A comment has been made';
   $mail_message = 'One newsitem has been commented on this page: <a href="'.$wb->page_link($page['link']).'">'.$wb->page_link($page['link']).'</a>
   
   Comment:
   '.$comment.'' ;
   
   $wb->mail(SERVER_EMAIL,$mail_to,$mail_subject,$mail_message);
Logged
snark
Guest
« Reply #7 on: February 27, 2011, 08:53:14 PM »

@pcwacht

Any progress on the articles module yet?

What i saw à while ago was very promising, i have made quite some additions to the news3,5 newsmodule, I will include the commentnotification and send you a version
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2858



WWW
« Reply #8 on: February 28, 2011, 08:43:37 AM »

Please do.

Artcles is still an ongoing work in progress. The progress is being slowed down cause of the promised 2.9, ,  allso I was/am bizzy with some other modules needed for work. And work itself.
Allso had some operation on my hip last september, I needed a new one wich slowed me down as well.

Am coding articles when I have some spare time left wich is rarely the case Wink


John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
snark
Guest
« Reply #9 on: March 01, 2011, 01:12:10 PM »

you will receive it today

Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!