24/06/04

Comments 10

Textpattern Notes Part 3

Here is a way to prevent you receiving an email notification of your own comments. Go to the end of the /textpattern/publish/comment.php file, and find this code:

$out = "Dear $RealName,\r\n\r\nA comment on your post on your post 
\"$Title\" was recorded.\r\n\r\nName: $cname\r\nEmail: $cemail\r\nWeb: 
$cweb\r\nComment:\r\n$message";
		mail($email, "[$sitename] comment received: $Title", $out,
		 "From: $RealName <$email>\r\n"
		."Reply-To: $cname <$cemail>\r\n"
		."X-Mailer: Textpattern\r\n"
		."Content-Transfer-Encoding: 8bit\r\n"
		."Content-Type: text/plain; charset=\"UTF-8\"\r\n");
	}

Change to this:

if ($cemail != $email) {
$out = "A comment on your post on your post \"$Title\" was recorded.
\r\n\r\nName: $cname\r\nEmail: $cemail\r\nWeb: $cweb\r\nComment:\r\n$message";
		mail($email, "[$sitename] comment received: $Title", $out,
		 "From: $cname <$email>\r\n"
		."Reply-To: $cname <$cemail>\r\n"
		."X-Mailer: Textpattern\r\n"
		."Content-Transfer-Encoding: 8bit\r\n"
		."Content-Type: text/plain; charset=\"UTF-8\"\r\n");
	}
}

This then only sends an email if the commenters email isn't the same as your email. I also changed it so that when the email comes in, the 'from' is the commenters name, not your own!

Comments | RSS

Comments are now closed, but you can still have a jolly time reading what others have left:

#1

andrew said 1625 days ago:

Very nice!   Ideally, this should be incorporated via Feature Request and an additional preference setting could be added to admin_config.php via something like ‘comments_notify_author’ => 1.

Then, this would be possible by just adding $txpac and using $txpac[‘comments_notify_author’] in the ‘if’ clause.

I’m not sure when Feature Requests will again start being incorporated into the package. As quoted from the TXP Forum,

“The next version, g1.19, will be the last gamma. As of its release, feature additions will be frozen, some cleanup will be done, and a 1.0 release candidate will appear…” – Dean Allen
#2

Jon Hicks said 1625 days ago:

Yeah, I’ve already requested this in the forum, but who knows? Its such a simple fix, it’d be shame not to have the option.
#3

Hans said 1625 days ago:

Thank you, Jon, for writing the previous “notes.” I had been planning on doing the “flipflop” thing a month ago, but never knwe how; you made my dream come true. :)

By the way, your link to “zlog interviews Drew” is leading to your front blog page.
#4

Matt Brubeck said 1624 days ago:

Hmm. So you won’t get notified when someone forges your identity in your comments section?
#5

Jon Hicks said 1624 days ago:

True – but then no one that visits here is beastly enough to do that sort of shenanigans! If they do, I shall excommunicate them forthwith!!
#6

Etienne said 1622 days ago:

Thanx Jon for all those hints.

One cool thing mays be to show us your templates (TXP isn’t so easy to manage the first time)

Thanx for all
#7

Matt said 1620 days ago:

Shouldn’t those rn’s have backslashes before them?
#8

Jon Hicks said 1620 days ago:

Matt – yes they should. I hope you’re not picking holes because I didn’t go with WordPress! ;o)
#9

Mike said 1616 days ago:

Thank you, thank you for taking time to document these tips, techniques, and observations. I am determined to get my head around Textpattern, and I find this info very encouraging.
#10

Ben Smith said 1613 days ago:

Hi Jon,

Great inspiring site you have here. Out of interest is your dhtml menu powered by textpattern or is this hardcoded?

Elsewhere

The Rissington Podcast - weekly shenanigans with Jon Oxton

Hicksmade - unique handmade goods by Leigh Hicks width=

love

Brit Pack: A proud member I love Omniweb Coda Segment Publishing I buy my type from Veer The Forgiveness Project