Hi,
Could someone please help me alter the script a little. I want it so that:
When a user clicks submit comment, when making a comment to an entry, as well as putting the comment at the bottom of the display entry page, an e-mail is sent to the admin with the comment and the question ID or link (or something similar).
I have asked a friend to try and alter the code (he knows some php), but I thought that the creators would probably have a quick solution to it.
Thanks!
Sergey
e-mail the comment
Moderator: Thorsten
Re: e-mail the comment
Hi Sergey,
.
Locate these lines below in savecomment.php:
and change them to read these lines below:
That's all
.
Regards,
Matteo
everything is already in place, see savequestion.phpsergey.khodjamirian wrote:I have asked a friend to try and alter the code (he knows some php), but I thought that the creators would probably have a quick solution to it.
Locate these lines below in savecomment.php:
Code: Select all
...
$result = $db->query("INSERT INTO ".SQLPREFIX."faqcomments (id_comment, id, usr, email, comment, datum, helped) VALUES (".$db->nextID(SQLPREFIX."faqcomments", "id_comment").", ".$id.", '".$comment_by_user."', '".$comment_by_mail."', '".$comment."', ".time().", '".$helped."')");
$tpl->processTemplate ("writeContent", array(
...Code: Select all
...
$result = $db->query("INSERT INTO ".SQLPREFIX."faqcomments (id_comment, id, usr, email, comment, datum, helped) VALUES (".$db->nextID(SQLPREFIX."faqcomments", "id_comment").", ".$id.", '".$comment_by_user."', '".$comment_by_mail."', '".$comment."', ".time().", '".$helped."')");
$commentMail = "User: ".$comment_by_user.", mailto:".$comment_by_mail."\n".
"New comment posted on: http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?action=artikel&cat=".$cat."&id=".$id."&artlang=".$lang.
"\n\n".
wordwrap($_POST["comment"], 72);
$additional_header = array();
$additional_header[] = 'MIME-Version: 1.0';
$additional_header[] = 'Content-Type: text/plain; charset='. $PMF_LANG['metaCharset'];
if (strtolower($PMF_LANG['metaCharset']) == 'utf-8') {
$additional_header[] = 'Content-Transfer-Encoding: 8bit';
}
$additional_header[] = 'From: '.'<'.$IDN->encode($comment_by_mail).'>';
$body = strip_tags($commentMail);
$body = str_replace(array("\r\n", "\r", "\n"), "\n", $body);
$body = str_replace(array("\r\n", "\r", "\n"), "\n", $body);
if (strstr(PHP_OS, 'WIN') !== NULL) {
// if windows, cr must "\r\n". if other must "\n".
$body = str_replace("\n", "\r\n", $body);
}
mail($IDN->encode($PMF_CONF['adminmail']), $PMF_CONF['title'], $body, implode("\r\n", $additional_header), '-f'.$IDN->encode($comment_by_mail));
$tpl->processTemplate ("writeContent", array(
...Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist
-
sergey.khodjamirian
- Posts: 35
- Joined: Wed Aug 09, 2006 11:36 am
Hi Sergey,
yes, you should be able to read the text that the admin will receive here:
As you can see, you have:
Matteo
yes, you should be able to read the text that the admin will receive here:
Code: Select all
$commentMail = "User: ".$comment_by_user.", mailto:".$comment_by_mail."\n".
"New comment posted on: http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?action=artikel&cat=".$cat."&id=".$id."&artlang=".$lang.
"\n\n".
wordwrap($_POST["comment"], 72); - The user name and email;
- The link to the faq record on which the comment has been submitted;
- the text of the comment.
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist
Hi all,
FYI, this feature request has been commited into PMF 2.0.0 code.
Regards,
Matteo
FYI, this feature request has been commited into PMF 2.0.0 code.
Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist
-
sergey.khodjamirian
- Posts: 35
- Joined: Wed Aug 09, 2006 11:36 am
I made this modification. Now what happens is when submit comment is clicked, a blank page shows up with the following in the address:
http://lonvmmldap02/rfpqakb/index.php?a ... avecomment
The comment doesn't get sent to the admin AND it doesn't get added to the bottom of the entry that was commented on.
Is something missing?
http://lonvmmldap02/rfpqakb/index.php?a ... avecomment
The comment doesn't get sent to the admin AND it doesn't get added to the bottom of the entry that was commented on.
Is something missing?
Hi Sergey,
Ciao,
Matteo
the hack is working as expected on my server @home so could you kindly configure your server to let PHP print out warning and notice errors (this seems to be the same issue as depicted in viewtopic.php?t=2740)?sergey.khodjamirian wrote:Is something missing?
Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist