| | 177 | * Number of approved comments the user has written. |
| | 178 | * |
| | 179 | * @since 2.84 |
| | 180 | * @uses $wpdb WordPress database object for queries. |
| | 181 | * |
| | 182 | * @param int $userid User ID. |
| | 183 | * @return int Amount of approved comments user has written. |
| | 184 | */ |
| | 185 | function get_usernumcomments($userid) { |
| | 186 | global $wpdb; |
| | 187 | $userid = (int) $userid; |
| | 188 | $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1'", $userid)); |
| | 189 | return apply_filters('get_usernumcomments', $count, $userid); |
| | 190 | } |
| | 191 | |
| | 192 | /** |