Hoppa över navigering, gå direkt till textinnehållet



Author Highlighting in Textpattern

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:

  1. $out .= n.t.'<li id="c'.$discussid.'" style="margin-top:2em">'.$temp.'</li>';
  2. Download this code: /code/028.txt

Replace that with following

  1. /* Author Highlighting hack */
  2. $me = "";
  3. if ($email == "secretpassword")
  4. $me = " class=\"me\"";
  5. $out .= n.t.'<li id="c'.$discussid.'" style="margin-top:2em"'.$me.'>'.$temp.'</li>';
  6. /* End Author Highlighting */
  7. // $out .= n.t.'<li id="c'.$discussid.'" style="margin-top:2em">'.$temp.'</li>';
  8. 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.

3. november 2004, 10:07
This is me :)
3. november 2004, 11:04
test
3. november 2004, 11:09
testar mera
Jeff sa,
5. november 2004, 17:26
Oddly enough, I found this from my referal logs, not the Textpattern forums. I had to hack it a little (I use DIVs), but it works great. Thanks!
Tobias Bergius sa,
26. januari 2005, 22:29

Aah, nice one! :)

31. januari 2005, 06:56

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?

31. januari 2005, 08:02

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.

23. april 2005, 09:40
test
23. februari 2006, 05:28

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.

23. februari 2006, 10:01

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!

SladdröraProblem med li i Internet Explorer