mail: "there is a new comment in your story"

Register an Account
Reply
 
Thread Tools Display Modes
  #21 (permalink)  
Old 12-18-2007, 01:31 AM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 784
I also had an error,


Quote:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, support@supportwebsite.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/1.3.33 Server at Blog Engage / Published Blog Articles Port 80
when submitting a Comment
Reply With Quote
  #22 (permalink)  
Old 12-18-2007, 09:56 AM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 784
Anyone get this to work?
Reply With Quote
  #23 (permalink)  
Old 12-30-2007, 01:04 PM
redwine's Avatar
Pligg Donor
Pligg Version: 9.8
Pligg Template: custom templat
 
Join Date: Jul 2007
Location: Canada
Posts: 216
Thanks to inggenia for the idea.

I came up with a fix for providing the user with an option to subscribe or not to a certain news/story that he or she posts. The user can always turn off/on this option by clicking on the “admin links” within the story post and then clicking on “Edit the title or description.”. I tested it thoroughly and it works with no problems.
Start by adding a new column to the links table in your database. This is needed to mark the stories that the user wants to receive emails whenever a comment is added to the story. It is “0” by default, meaning that this option was not selected. If selected, the value would be “1”.
Code:
 
ALTER TABLE `pligg_links` ADD COLUMN `link_subscribe` TINYINT( 1 ) NULL DEFAULT '0';
Open “/libs/lang.conf” and add the following under “SUBMIT - STEP 2” section:

Code:
 
//<SECTION>SUBMIT - STEP 2</SECTION><ADDED>0.5</ADDED>
PLIGG_Visual_Submit2Subscribe_To = "Check this option if you want to receive emails whenever other users comment on your story."
Save and close.
Open “submit_step_2.tpl” in your template folder and add the following right before the “{checkActionsTpl location="submit_step_2_pre_extrafields"}” line:
Code:
 
<br />
<label for"subscribeto"><input type="checkbox" name="subscribeto" id="subscribeto"> {#PLIGG_Visual_Submit2Subscribe_To#}</label><br/>
Save and close.
Open “submit_step_3.tpl” in your template folder and search for “$linkres->category=” and place the following in the same section:
Code:
$linkres->subscribe=$_POST['subscribeto'];

Search for “$main_smarty->assign('submit_content” and add the following to the same section:
Code:
$main_smarty->assign('submit_subscribe', $linkres->subscribe); 
Save and close.
Now we have to provide an option to turn on and off this option. To do so, we modify the “editlink_edit_center.tpl” in your template folder by adding a checkbox like we did in the “submit_step_2.tpl”. However, we have to check the database for the value of the link_subscribe to set the checkbox as CHECKED or not. Remember that the author of the story can edit/modify the story by clicking on the “admin links” within the story post and then clicking on “Edit the title or description.”.
Open “editlink_edit_center.tpl” in your template folder and add the following anywhere you want before the submit button:
Notice the conditions (in red) to accurately set the checkbox state.
Code:
 
<br />            
<label for"subscribeto">{if $submit_subscribe eq 1}<input type="checkbox" name="subscribeto" id="subscribeto" CHECKED> {else} <input type="checkbox" name="subscribeto" id="subscribeto">{/if}{#PLIGG_Visual_Submit2Subscribe_To#}</label>
<br/><br/>
Save and close.
Now, we have to edit the “/libs/link.php” file to accommodate the new changes we have made.
Open “/libs/link.php” and add the following code:
In the “class link {“ section.
Add:
Code:
var $subscribe = 0;

Right after the global declaration in the store() function, add:
Code:
if(isset($_POST['subscribeto'])){
$this->subscribe = "1";
}
Within the same store() function:
anywhere before the “$sql = "UPDATE " line add:
Code:
$link_subscribe = $db->escape($this->subscribe);

Add the following to the “$sql = "UPDATE " line right before the “WHERE” condition:
Code:
, link_subscribe='$link_subscribe'
Look for “if($link) {“ section and add:

Code:
$this->subscribe = $link->link_subscribe;

Look for the “function fill_smarty” section and add the following (make sure not to add it within an IF statement:
Code:
$smarty->assign('subscribe', $this->subscribe);

Save and close.
Now open the “editlink.php” and look for “$edit = false;” then go down few lines and add the following after the “$linkres->read();”:
Code:
$link_subscribe=$linkres->subscribe;

Go down few more lines to where the “$main_smarty->assign” begin and add:
Code:
$main_smarty->assign('submit_subscribe', $link_subscribe);

Save and close.

Now the last step is to add the code to send the email if the option is selected.

Open “story.php”

Change this:

Code:
if(isset($_POST['process'])){
         if ($_POST['process']=='newcomment') {
                     insert_comment();
         }
}
Change it to:

Code:
if(isset($_POST['process'])){
         if ($_POST['process']=='newcomment') {
                     if ($link->subscribe==1) {
//If you find that most users do not provide a public email, it would be safer to change the query below to "Select user_email FROM" instead.
$authormail = $db->get_var("SELECT public_email FROM " .table_users ." WHERE user_id = $link->author;");
 
$subject= 'You have a new comment about your story ' . $link->title;
$message = "The following user '". $current_user->user_login . "' commented on your impact '" . $link->title . "'\r\n\r\n\t" . "'".$_POST['comment_content']. "\r\n\r\nHere is the link to the story: " . my_base_url . my_pligg_base . "/story.php?title=". $link->title_url . "\r\n\r\nRegards,\r\nAdministrator";
                                 $headers = "From: admin@yoursite.com"  . "\r\nReply-To: admin@yoursite.com " . "\r\nX-Priority: 1\r\n";
                                             $to=$authormail;
                                             @mail($to, $subject, $message, $headers);
                                 }
 
                                 insert_comment();
                     }
         }
The files that you need to upload:
  1. /libs/lang.conf
  2. /libs/link.php
  3. story.php
  4. editlink.php
  5. /templates/yourtemplate/editlink_edit_center.tpl
  6. /templates/yourtemplate/submit_step_2.tpl
  7. /templates/yourtemplate/submit_step_3.tpl

Last edited by redwine; 02-12-2008 at 06:55 PM. Reason: Modified the $message in the last step to add a direct link to the story in the sent email
Reply With Quote
  #24 (permalink)  
Old 12-30-2007, 02:14 PM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 784
This is great. I will try this for sure just not sure when I will have the time
Reply With Quote
  #25 (permalink)  
Old 12-30-2007, 07:20 PM
not2serious's Avatar
Pligg Donor
Pligg Version: 1.1.5
Pligg Template: Westie
 
Join Date: Apr 2007
Location: East Coast, USA
Posts: 229
Looks great. I am in the process of trying to make some updates and changes to my site and will include this mod.

Please check my PM suggestion for a minor enhancement to this mod.
Reply With Quote
  #26 (permalink)  
Old 12-31-2007, 08:17 AM
New Pligger
 
Join Date: Sep 2007
Posts: 15
Thank's a lot for this mod, i'll try this, in a couple of days when i have some time and tell you if it works well in my site... Thank's
Reply With Quote
  #27 (permalink)  
Old 12-31-2007, 10:17 AM
netwb's Avatar
Casual Pligger/Coder
Pligg Version: 1.0
Pligg Template: wistie
 
Join Date: Dec 2006
Location: Bruxelles
Posts: 86
i'have installed the mod and i not receved the comment!
Reply With Quote
  #28 (permalink)  
Old 12-31-2007, 11:33 AM
redwine's Avatar
Pligg Donor
Pligg Version: 9.8
Pligg Template: custom templat
 
Join Date: Jul 2007
Location: Canada
Posts: 216
Sometimes it is not delivered instantly and sometimes it it is. It all depends on the server. I have received around a 100 some of them a couple of hours after they were sent.
Reply With Quote
  #29 (permalink)  
Old 12-31-2007, 12:26 PM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 784
Quote:
Originally Posted by redwine View Post
Sometimes it is not delivered instantly and sometimes it it is. It all depends on the server. I have received around a 100 some of them a couple of hours after they were sent.
I don't think this is a server issue rather than a pligg issue. I run many software scripts on many sites and my server only has issues with sending mail from pligg scripts and no other scripts. Maybe I am wrong?
Reply With Quote
  #30 (permalink)  
Old 12-31-2007, 01:08 PM
redwine's Avatar
Pligg Donor
Pligg Version: 9.8
Pligg Template: custom templat
 
Join Date: Jul 2007
Location: Canada
Posts: 216
As I said, I tried thoroughly and it works well. I received all the emails, some of them instantly and some after a couple of hours but none failed!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail not working from local system mrigank Questions and Comments 3 02-23-2009 03:06 AM
Special character problems in RSS and mail subject ditto Questions and Comments 8 04-22-2008 05:28 PM
Editing a reply to a comment? bbrian017 Questions and Comments 0 01-10-2008 05:30 PM
A proposal for a more robust way of comment deletion. sefs Questions and Comments 0 10-12-2007 05:30 PM
Comment Count Update Simon Questions and Comments 4 06-01-2007 10:45 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development