Plugin pour WordPress: affichage personnalisé des commentaires

Tuesday, November 1, 2005
By GF

Plugin for WordPress: comments custom display
Plugin para WordPress: presentacion personalizada de los comentarios

Download here

< English >

About
CustomComments is a plugin for WordPress blogging software. It enables you to set up 2 CSS styles (i.e. changing background, foreground, font style, size, etc.): one style for comments submitted by the blog owner, and another style for comments submitted by other people.

Install

  1. (Optional) Check your user id (the first user, the blog owner, is num. 1) and change the value of $my_id if necessary.

  2. Upload customcomments.php to your WordPress plugins folder. Choose the file according to you blog encoding (if you don’t understand what I’m talkink about, just use UTF-8 or go into your WP admin panel and Options > Read to see the charset used by your blog).
  3. Activate the plugin in WordPress admin panel
  4. Call the function custom_comments() in wp-comment.php or in comment.php if you use a custom theme:
    • FIND: <li id=”comment-<?php comment_ID() ?>”>
    • REPLACE BY: <li id=”comment-<?php comment_ID() ?>” <?php custom_comments(); ?>>
  5. Open wp-style.css or style.css if you use a custom theme, and create 2 classes (put custom content between { and } ):
    • .mycomments { } < = highlighted comments

    • .otherscomments { } < = normal comments

Credits
Copyright © 2005 Guillaume Florimond – Valhalla GFBlog.com
This plugin can be distributed, with the name of the author and the copyright in the source code. The plugin can’t be sold.

< Français >

A propos
CustomComments est un plugin pour le logiciel de blog WordPress. Son but et de permettre au propriétaire du blog de démarquer ses commentaires de ceux des autres utilisateurs en les affichant de manière différente.

Installation

  1. (Optionnel) Vérifiez votre id d’utilisateur et modifiez $my_id en conséquence (si vous êtes le premier utilisateur à vous être enregistré, ce qui est probablement le cas si vous êtes le propriétaire du blog, votre id sera 1.

  2. Uploadez customcomments.php dans le dossier des plugins de WordPress. Choisissez le fichier correspondant à l’encodage de votre blog (si vous ne savez pas, choisissez UTF-8 ou allez voir dans l’interface d’administration WP Options > Lecture).
  3. Activez le plugin depuis l’interface d’administration de WordPress
  4. Appelez la fonction custom_comments() dans wp-comment.php ou dans comment.php si vous utilisez un thème personnalisé:
    • TROUVEZ: <li id=”comment-<?php comment_ID() ?>”>
    • REMPLACEZ PAR: <li id=”comment-<?php comment_ID() ?>” <?php custom_comments(); ?>>
  5. Ouvrez wp-style.css ou style.css si vous utilisez un thème personnalisé, et créez 2 classes (mettez le contenu entre { et } ):
    • .mycomments { } < = commentaires à mettre en relief

    • .otherscomments { } < = commentaires normaux

Crédits
Copyright © 2005 Guillaume Florimond – Valhalla GFBlog.com
Ce plugin peut être librement redistribué dès lors qu’il est fait mention de l’auteur. Il ne peut en aucun cas être vendu.

< Español >

A proposito
CustomComments est un plugin para el software de blog WordPress. Su papel es de dar la posibilidad al webmaster de crear 2 clases CSS diferentes: la primera para sus propios comentarios, y la segunda para los comentarios sometidos por los demas.

Instalacion

  1. (Opcional) Cambia el “1″ de $my_id por tu numero de usuari. Si fuiste el primer usuario del blog (sera asi si eres el propietario del blog), tu id sera “1″.

  2. Pon customcomments.php en el repertorio de los plugins WordPress. Tienes que utilisar el archivo correspondiente a tu charset (si no sabes, puedes utilizar UTF-8 o ir en la interfaz de administracion de WP, y ver cual es el charset utilisado en Opciones > Leer).
  3. Activa en plugin desde la interfaz de administracion de WordPress
  4. Llama la funccion custom_comments() en wp-comment.php o en comment.php si tienes un tema personalizado:
    • ENCUENTRA: <li id=”comment-<?php comment_ID() ?>”>
    • REMPLAZA POR: <li id=”comment-<?php comment_ID() ?>” <?php custom_comments(); ?>>
  5. En wp-style.css o style.css si tienes un tema personalizado, crea 2 clases (pon el contenido entre { y } ):
    • .mycomments { } < = comentarios que hay que poner de realce

    • .otherscomments { } < = comentarios de los demas

Creditos
Copyright © 2005 Guillaume Florimond – Valhalla GFBlog.com
Este plugin puede ser redistribuido libremente, siempre que no se quita el nombre del autor del archivo. No puede ser en ningun caso objeto de compraventa.

No TweetBacks yet. (Be the first to Tweet this post)

Tags: , ,

18 Responses to “Plugin pour WordPress: affichage personnalisé des commentaires”

  1. GF

    This Plugin works with WordPress 2.0 (as well WP 1.2 and 1.5 Strayhorn)

    #292
  2. jessenco

    Your plugin crash all the time with WordPress 2.0.2

    Warning: Cannot modify header information – headers already sent by (output started at /mounted-storage/……/……./……/www/bA/wp-content/plugins/customcomments.php:1) in /mounted-storage/……/……./……/www/bA/wp-login.php on line 9

    #430
  3. GF

    This is probably due to a conflict with another plugin which try to send headers already sent in the wp loop.

    #431
  4. There is a little mistake in your “replace” tag. There needs to be a space between the second ” and the ” >

    Otherwise, in the HTML, it puts the class reference is counted as part of the id, so it doesn’t read the CSS properly.

    Thanks.

    #471
  5. GF

    L’archive a été mise à jour avec un nouveau fichier, Bonus.php, qui contient deux fonctions de remplacement pour 1) attribuer un style CSS personnalité pour *plusieurs* utilisateurs (le même pour tous les utilisateurs) ; 2) attribuer un style CSS individualisé à plusieurs utilisateurs (différent pour chaque utilisateur).

    #491
  6. J’ai le même type d’erreur que Jessenco sous WP 2.0.2 : “headers already sent”, même lorsque je désactive tous les plugins…

    Warning: Cannot modify header information – headers already sent by (output started at /…/blog/wp-content/plugins/customcomments.php:1) in /…/blog/wp-admin/plugins.php on line 16

    #517
  7. brianMan

    There’s actually a much simpler way to add “custom” comments for everybody, at least if you’re going to edit the source of the comments file anyway.

    Open comments.php and find the <li> which starts the comment. It probably looks a bit like this:
    <li class=”<?php echo $oddcomment; ?>” id=”comment-<?php comment_ID(); ?>”>

    Now simply add the following *right after* the ‘$oddcomment;’ :
    if ($comment->user_id) echo ‘ commentUID-’ . $comment->user_id;

    Voila, now each comment can be styled according to userID’s.

    I’m not completely sure if the user_id is set when the comment is posted by an anonymous users, or if it’s just user_id 0 or something.

    #553
  8. hi there,

    why do I get this when I install the plugin, activate it and save any modifications there after?

    Warning: Cannot modify header information – headers already sent by (output started at /homepages/12/d171621781/htdocs/blogtest/wp-content/plugins/customcomments.php:1) in /homepages/12/d171621781/htdocs/blogtest/wp-admin/plugins.php on line 15

    #832
  9. I can confirm that it works fine with WP 2.2

    I was wondering if you could think of a way so that it identified not just comments made by the blog owner but ones made by the post author. I have a number of authors on my blog.

    #14794
  10. [...] is built-in (but optional) support for my favourite plugins—Akismet, Custom Comments, Get Recent Comments, Gravatar and Paged [...]

    #17018
  11. the plugin is working fine on wp 2.0

    #24827
  12. The download link results in a 404.

    #24836
  13. GF

    Yes, sorry, it’s now fixed.

    #24837
  14. Concerning “Warning: Cannot modify header information…”:

    The following is at the very beginning of the UTF-8 version.

    

    Delete it and leave no spaces or blank lines before the <?php.

    That’s it.

    God Bless.

    #25127
  15. Floroskop

    Hello!
    I think this try.

    #25166
  16. RaiulBaztepo

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language ;)
    See you!
    Your, Raiul Baztepo

    #25483

Leave a Reply