WordPress.org

Support

Support » Plugins and Hacks » Need Code to Alter Comments

Need Code to Alter Comments

  • I know that this code lets me alter the way my comment looks as opposed to others:

    <?php
    $isByAuthor = false;
    if($comment->comment_author_email == ‘me@myemail.com’) {
    $isByAuthor = true;
    }
    ?>

    What I’m wondering is…

    How can I alter that code to apply to everyone EXCEPT a certain e-mail?

    I assume it would mean altering this part of the code:

    if($comment->comment_author_email == ‘me@myemail.com’)

    Anyone know how to accomplish this?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • if( !($comment->comment_author_email == 'me@myemail.com') ) {

    ! = NOT in PHP lingo. So you’re saying if comment author’s email is NOT me@myemail.com, do the following. This works the same:

    if($comment->comment_author_email != 'me@myemail.com') {

    That works. Thank you so much, I’ve been messing with the code all night trying to figure this out.

    Appreciate it 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need Code to Alter Comments’ is closed to new replies.
Skip to toolbar