Some people asked me to explain how to modify the dofollow plug in to start “dofollowing” after April 1, 2007, but leave nofollow intact on comments posted before that date. Here is what you need to do:
- Go somewhere and save a copy of your original dofollow plug in, just in case you screw up.
- Find Click the Edit button in your plugin control panel.
- Find this function: function nofollow_del($text).
- In the appropriate spot, ad this line, with no line break and ending with the semi-colon:
if (mysql2date(‘U’, $comment->comment_date) < 1175458042) return $text;
The 1175458042 corresponds to April 1, 2007. Semi-colons are very important; don't forget it.
- Save.
- Check to see if the plug in is working by examining the source on comments prior to April 1, 2007 and the source on comments after April 1, 2007. You should see “nofollow” on the older comments, but no “nofollow” on the more recent comments.
This is what the function should look like when you are done. Don’t worry about matching line breaks. WordPress is sticking those in. The line in red is the important key line. The lines starting with // are comments. They do nothing!
function nofollow_del($text)
{
global $comment;
if (mysql2date('U', $comment->comment_date) > $this->ldate)
return $text;
// This is a comment to tell you the next line is the one to add.
if (mysql2date('U', $comment->comment_date) < 1175458042) return $text;
// This is also a comment. The stuff that follows was already in the plug in.
$text = preg_replace('||i',
'', $text);
$text = preg_replace('||i',
'', $text);
$text = preg_replace('||i',
'', $text);
$text = preg_replace('||i',
'', $text);
return $text;
}
Note: I added three lines. But the two lines that beging with // are comments. They can say anything you like. They do nothing!
That’s it!