WordPress.org

Support

Support » Plugins and Hacks » Hacks » Identify if the comment was wrriten by current user

Identify if the comment was wrriten by current user

  • I have a function get_comment_class in comment-template.php. This returns a class for CSS.

    I want to indicate in the comment class if the person who wrote the comment is the same as the person who is logged in. My code is…

    // For comment authors who are logged in as current user
    if ( $wp_user_id = get_current_user_id() ) {
    if ( $comment->user_id === $wp_user_id )
    	$classes[] = 'cuser';
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    It’s not working and I don’t know why. Can anyone please help?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Identify if the comment was wrriten by current user’ is closed to new replies.