Author Highlighting in Textpattern
Posted 3. november 2004, 10:04 [Edited 10. mars 2005, 11:34]
Note! Since 1.0 RC3 rev180 This hack should be replaced with a proper plugin instead.
I’ve made a little change to Textpattern to highlight the author in comments.
Find comment.php file that is located in the publish directory. Look for following line around line 128:
$out .= n.t.'<li id="c'.$discussid.'" style="margin-top:2em">'.$temp.'</li>';- Download this code: /code/028.txt
Replace that with following
/* Author Highlighting hack */$me = "";if ($email == "secretpassword")$me = " class=\"me\"";$out .= n.t.'<li id="c'.$discussid.'" style="margin-top:2em"'.$me.'>'.$temp.'</li>';/* End Author Highlighting */// $out .= n.t.'<li id="c'.$discussid.'" style="margin-top:2em">'.$temp.'</li>';- Download this code: /code/029.txt
What is done?
Well it´s really simple, all we do is to check the value of the email field, and if the email is the same as the “secretpassword” then we add the class me to the listitem. The use of the email field came to me by reading a comment to Dan Cederholms post about Author Highlighting in MT
I got the idea to this from the TXP forum, thanks for that Jeff C. Bostick.
How do you deal with the e-mail address in this if a website is not provided? In Textpattern comments if you don’t put in a website address then your name is linked to your e-mail. Wouldn’t people be able to see the secret code then?
James, in textpattern/lib/admin_config.php change the setting for 'never_display_email' => 0, to 'never_display_email' => 1, then emails will never be displayd in the comments.
I use TXP 4.03 and my comment.php-file doen’t look like Your line obouve. Hm. Do You hava an idea for the actual version, too?
Thanks a lot.
Hi Robert, Andrew has made a sweet to plugin that should be used instead of this hackish aproach, this hack was made before (pre 1.0 RC3 rev180 ) it was possible to do comments plugins.
good luck!