Forums

Code Troubleshoot Request - Compare Comment Author to Current User (3 posts)

  1. asechrest
    Member
    Posted 8 months ago #

    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. :)

  2. whooami
    Member
    Posted 8 months ago #

    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

  3. asechrest
    Member
    Posted 8 months ago #

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

Reply

You must log in to post.

About this Topic