Fixing the email notification formatting in sNews

Comments (0)

OK, this one has been bugging the crap out of me lately, so I just fixed it, have you ever received a comment notification email or email from your contact form and it looked like this...

A new comment was posted into your site. Here's a copy:
Name: Bob
Email: Bob@bob.com
Comment:
Hello, I don\'t know what\'s wrong, I can\'t seem to make this mod work on my site.

well, that's the slashes added by magic quotes gpc and they need to be stripped before sending the email.

Here's how we'll do that, first back up your snews.php file and open a copy, now look inside function send_email(), near the end of the function, find;

$body .= $text."\n";

add the following code below it.

// begin new code
if (get_magic_quotes_gpc()) {
    $body = stripslashes($body);
}
// end new code

That will strip those annoying slashes from the text, magic quotes will be removed entirely from PHP 6, so plan accordingly. Cheers.

bookmark / share this: Bookmark and Share
rated 5/5 (1 vote)


Comments

No comments posted yet, why not be the first?


Write a comment

* = required field

:

:

:

:

You may insert urls in plain text, urls will be automatically linkified for trusted users and on seasoned posts only. All first comments are moderated, so use your email if you want to be remembered.


Back to top