Ticket #10975: wp-comment-nonce-refresh.patch
File wp-comment-nonce-refresh.patch, 1.3 KB (added by , 14 years ago) |
---|
-
wp-comments-post.php
52 52 $comment_author_url = ( isset($_POST['url']) ) ? trim($_POST['url']) : null; 53 53 $comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null; 54 54 55 // required for the nonce to work 56 $user = wp_get_current_user(); 57 58 // see comment_form_nonce() in wp-includes/comment.php 59 if ( !isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], "comment_form_{$comment_post_ID}") ) { 60 do_action('comment_nonce_failed', $comment_post_ID); 61 wp_die( __('Sorry, automated comments are not accepted.') ); 62 } 63 55 64 // If the user is logged in 56 $user = wp_get_current_user();57 65 if ( $user->ID ) { 58 66 if ( empty( $user->display_name ) ) 59 67 $user->display_name=$user->user_login; -
wp-includes/comment.php
1981 1981 return $open; 1982 1982 } 1983 1983 1984 /** 1985 * Include a nonce in comment forms. 1986 */ 1987 function comment_form_nonce($post_id) { 1988 wp_nonce_field("comment_form_{$post_id}", '_wpnonce', false); 1989 } 1990 1991 add_action('comment_form', 'comment_form_nonce'); 1992 1984 1993 ?>