29 | | * @param string $author Comment author name. |
30 | | * @param string $email Comment author email. |
31 | | * @param string $url Comment author URL. |
32 | | * @param string $comment Content of the comment. |
33 | | * @param string $user_ip Comment author IP address. |
34 | | * @param string $user_agent Comment author User-Agent. |
35 | | * @param string $comment_type Comment type, either user-submitted comment, |
36 | | * trackback, or pingback. |
| 29 | * @param string $author Comment author name. |
| 30 | * @param string $email Comment author email. |
| 31 | * @param string $url Comment author URL. |
| 32 | * @param string $comment Content of the comment. |
| 33 | * @param string $user_ip Comment author IP address. |
| 34 | * @param string $user_agent Comment author User-Agent. |
| 35 | * @param string $comment_type Comment type, either user-submitted comment, |
| 36 | * trackback, or pingback. |
| 37 | * @param bool|string Optional. $user_id Comment author ID. |
113 | | // expected_slashed ($author, $email) |
114 | | $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1"); |
| 114 | if( false == $user_id ) { |
| 115 | // expected_slashed ($author, $email) |
| 116 | $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM " . $wpdb->comments . " WHERE comment_author = '" . $author . "' AND comment_author_email = '" . $email . "' and comment_approved = '1' LIMIT 1"); |
| 117 | } else { |
| 118 | $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM " . $wpdb->comments . " WHERE user_id = '" . $user_id . "' AND comment_approved = '1' LIMIT 1"); |
| 119 | } |