Support » Plugins » help with writing a plugin

  • holographic


    Bear with me here, I’ve never tried writing a plugin before…
    I’m trying to write a plugin that will highlight the comment_author where the comment has been posted by a specific email address (ie, comments made by the blog author). I know this can be done easily by editing the coding, but I thought I might try my hand at plugins, because I have nothing better to do at the moment 😉
    So far, I’ve got it working as a filter on the comment_author hook
    However, if I activate the plugin it adds the span class to every comment author, even those comments posted without an email address.
    here is my function:
    function hilite_author($comment_author) {
    if ($comment_author_email == $youremail) {
    $comment_author="<span class=\"adminhilite\">$comment_author</span>";
    return $comment_author;

    Any suggestions would be much appreciated

Viewing 2 replies - 1 through 2 (of 2 total)
  • Stevarino


    hm…. $comment_author_email isn’t set anywhere, did you mean $comment_author? Also $youremail is not set either… Perhaps it should be set at the top of the function? Combine these two facts, and I guess that shows why it’s placing span’s on every commenter… It evaluates NULL == NULL – which of course is true.



    $youremail is set before the function, but forgot to mention that on the original post
    I assumed that $comment_author_email would give the email entered by the comment poster, but perhaps this is wrong. Any idea how I can get the email address of the commenter from the database if this variable doesn’t exist?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘help with writing a plugin’ is closed to new replies.