Quantcast

Force People to Read Your Comments Policy

Get the WebProNews Newsletter:


[ Business]

As recently shown, people don’t read your terms of service. My stats also show that people don’t read my comments policy before posting a comment. Sometimes I am forced to delete comments from possibly well meaning people who don’t realise that their comment might be looked on as spam .

This is especially true on a blog which is generous providing followable links when you comment. Some people go to the trouble of writing "nice post!", filling in a manual captcha, and departing, thinking their comment will not be deleted.

Over the last month my comments policy, which is fairly prominent, had been viewed a total of 36 times according to MBL stats, and that actually included my own visits.

I wasn’t very impressed.

So today I set about devising a system so that people have to read your comment policy before being able to comment. I am sure this would take a programmer a few minutes, but some of the tutorials I read on PHP and cookies missed out an important parameter that left me scratching my head until I explored a few more reference sites.

Code Chunk 1 – The Cookie

I now have this code placed right at the very top of header.php, even before the document type is set.

<?php if ( is_page(’104′) ) { ?>
<?php
$Month = 5184000 + time();
//this adds 60 days to the current time
//seconds * minutes * hours * days + current time
setcookie(Cpolicy, date("F jS – g:i a"), $Month , ‘/’);
?>
<?php } ?>

The first line is to determine if you are on the correct page. My comment policy is ID "104"

The setcookie defines the name, data (in this case date and time), the length of the cookie, and the "/" says that the cookie is for the whole domain (missed in the tutorials I saw).

The Magically Appearing Comment Box

The next piece of code goes in comments.php and wraps around the div for your comments box.

<?php
if(isset($_COOKIE['Cpolicy']))
{
$lastcom = $_COOKIE['Cpolicy'];
echo "You last read the comments policy on ". $lastcom;
?>
<p>Replace this paragraph with your comments form code, which is normally enclosed with a DIV</p>
<?php }
else
{
echo "You should read my comments policy before commenting". "<br />";
}
?>

This code first checks the existence of a cookie – if it exists then it is read and echoed to give some visual indicator. Between the paragraph tags is where you would insert your comment form code.

If the cookie isn’t set, you post a suggestion to read your comments policy. In this situation, the comment form wouldn’t appear at all.

Now I am sure I am going to find some bugs in this, so it is not going to be implemented to turn off the comments for people who haven’t read the comments policy yet.

I would love some feedback on if the code seems to be working on your browser, or if someone more familiar with cookies can suggest better code for this I am all ears.

*Originally published at AndyBeard.eu

Comments

Bookmark WebProNews:

About the Author

Andy Beard – Niche Marketing – Blog search engine perfomance, WordPress and general niche and affiliate marketing tips

Force People to Read Your Comments Policy
Comments Off


Top Rated White Papers and Resources

Comments are closed.

  • Join for Access to Our Exclusive Web Tools
  • Sidebar Top
  • Sidebar Middle
  • Sign Up For The Free Newsletter
  • Sidebar Bottom