How to Force People to Read Your Comments Policy

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') ) { ?>
$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;

Replace this paragraph with your comments form code, which is normally enclosed with a DIV

echo "You should read my comments policy before commenting". "

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.

Liked this post? Follow this blog to get more. Follow


  1. says

    Good idea Andy, though I think you give some of these “nice site!” guys a little too much credit. I’d question whether some of them they even read english. Though if you actually put up the barrier, that would stop some of them. Others will jump through the hoops and comment anyway. Every bit helps.

    The cookie code all looks right to me, and it works on my browser (safari).

    You could definitely get more streamlined with this. For example, replace the comment form with an inline version of your comment policy and have the user read and click [ok]. when they do, the form gets replaced with the actual comment form. no jumping around, etc. …just my initial thoughts.

    Also, you’re hacking the actual worpress code which makes for difficult upgrades in the future. I realize that you’re just testing and surely have visions of plugins in mind.

  2. says

    This is just hacking the templates rather than core files

    I have actually no intention of making this into a plugin. The inline stuff could work and make things more streamlined.

    I am not sure of the technical aspects of cookies in php, but I read on at least one site that the cookie code has to be at the top of the code. I am not sure how well that would work with something “inline”. Also the inline content would somehow have to be loaded only on request to reduce server load for the people who wouldn’t want to comment anyway.
    The click ok and then a redirect that sets the cookie might be a good option, as then I could send people back to the original page they were on based on referrer but it does add something that might break.

    I also don’t want to do anything that might cause accessibility problems for the disabled, or that might require javascript.
    Requiring one cookie to be able to post a comment for me seems to be an easy option.

  3. says

    Yes, the cookie code definitely has to be at the top, before any html is sent to the browser, even a space, as the cookies are set in the HTTP headers.

    That’s not the inline part. I was more talking about the interface so they’re not forced to click away and find their way back. There’s got to be a good solution that doesn’t affect accessibility and doesn’t dissuade legit commenters.

  4. says

    I like the idea of the comment policy being enforced, though perhaps a better wording would be “by making a comment you are agreeing to the comment policy found here” with a simple ok button I know it doesn’t help people not looking, but you can’t totally baby sit users if they won’t read your policy then they won’t read your policy.

  5. says

    This has always been an experimental blog, so we will see what happens. The cookie approach could also be used in some way to determine follow / nofollow at the time of posting a link.

    To anyone who hasn’t read the policy, comments will effectively be closed – I don’t want to close comments on old posts – they do get a penalty on Spam Karma currently but not enough to put them any further than the moderation queue, and my email notifications of spam also help to highlight anything that has been given too much penalty so I can rescue it.

  6. says

    I didn’t notice anything unusual when I was writing this comment.. I just visited your comment policy and a message indicated that a cookie was set for 60 days.

    Was that what I was supposed to see?

  7. says

    Hi Maki – thanks for testing

    By the “Post a Comment” headline just above the comment box it should say something like

    You last read the comments policy on February 15th – 4:09 am

    Comments will soon be automatically switched off for people who have not read my comments policy – thanks for taking the time, it is appreciated.

  8. says

    Just posting a comment to see how it works for me. I don’t like jumping through hoops just to comment but then again who wants a “nice post” comment on your blog. Anyway nice post, let’s see how this goes.

  9. says

    Well I have been nudging people to use a dofollow plugin for some time, as I have done since I launched this blog. I don’t want to do anything that discourages legitimate comments.

    On the other hand I have seen a trend in the comments on a number of blogs over the last few days that many people wouldn’t adopt dofollow because of the “nice post” comments.

    Lots of bloggers leave those types of comments unmoderated, because in some ways they are social proof, but for anyone subscribing to comments it becomes aggravating to see updates all the time with junk.

    If it proves successful, it is going to be great for people who have a number of blogs where they don’t want to spend time pulling comments out of the moderation queue, or where they would prefer subscribers to comments to not be burdened by junk.

  10. says

    Nice, i like it.

    One small thing. I had to click back to the home page to find the link to the comments policy. Might be more user friendly if the link to it was included in the !$cookie message.

  11. says

    In the “leave a comment with a link” section there is a link to the comments policy, but you are right, as thie list of comments gets longer, it is too far out of sight.

    I actually had to switch this on earlier than I expected because one spam message actually got through and emailed to people a day or so back, which is extremely annoying.

    I hope this blocks manual spam a little more.

  12. says


    Great Idea – but I think I know why your comments policy form isn’t read much. It’s not at all well linked to within actual posts.

    Many people visiting will land on an actual post page, rather than the home page – thus it’s really not that evident you have any policy at all..

    Have you considered replacing the ‘missing form’ with a suitably sized “Can’t see a comment form? Perhaps you should read the Comment Policy first..” – at present it’s buried at the very top of the comments.. again there is an assumption folks will read an entire page of content. Few actually will.

    It’s a great idea – but you need to make sure people can easily gain access to the policy page.. otherwise it will frustrate many who have valid comments and they’ll simply not comment.

  13. says

    Hi Brendan,

    I do intend to improve the visibility, although it should be noted that not every one of my posts gets this many comments.

    Engtech mentioned the same thing on the Akismet post and Rob just above.

    This is something that will be fixed very soon

    I had to implement this quickly due to manual spam on a certain topic that was becoming annoying, and making it through Spam Karma on definitely hit a few email boxes.