• Howdy, folks. I’m using the Comment Vote plugin on my site. Loving the plugin, but I’m attempting to add functionality. The plugin doesn’t prevent the author of a comment from rating his own comment.

    The applicable function code is here.

    I’m using something like this

    elseif( $comment_email->comment_author_email == $current_user->user_email ) {
    $response['message'] = 'You cannot rate your own comment.';
    }

    I’m trying to test if the current logged-in user’s email matches the comment author’s email, and if so, return the proper response. All the coding I know is from banging around in WordPress for the past month, so I’m sure I’ve just screwed up the PHP.

    Anyone have a moment to suggest where I went wrong? Thanks. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • it looks fine to me.. make sure those globals are actually being captured. echo back that data, is it there? get_currentuserinfo is a widely discussed function on these forums — notorious for being a pita

    Thread Starter asechrest

    (@asechrest)

    Ok, I’ll do some more work with it and see what happens. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code Troubleshoot Request – Compare Comment Author to Current User’ is closed to new replies.