Changes in trunk/wp-comments-post.php [2984:4260]
- File:
-
- 1 edited
-
trunk/wp-comments-post.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-comments-post.php
r2984 r4260 13 13 } elseif ( 'closed' == $status->comment_status ) { 14 14 do_action('comment_closed', $comment_post_ID); 15 die( __('Sorry, comments are closed for this item.') );15 wp_die( __('Sorry, comments are closed for this item.') ); 16 16 } elseif ( 'draft' == $status->post_status ) { 17 17 do_action('comment_on_draft', $comment_post_ID); … … 25 25 26 26 // If the user is logged in 27 get_currentuserinfo();28 if ( $user _ID ) :29 $comment_author = $wpdb->escape($user _identity);30 $comment_author_email = $wpdb->escape($user _email);31 $comment_author_url = $wpdb->escape($user _url);27 $user = wp_get_current_user(); 28 if ( $user->ID ) : 29 $comment_author = $wpdb->escape($user->display_name); 30 $comment_author_email = $wpdb->escape($user->user_email); 31 $comment_author_url = $wpdb->escape($user->user_url); 32 32 else : 33 33 if ( get_option('comment_registration') ) 34 die( __('Sorry, you must be logged in to post a comment.') );34 wp_die( __('Sorry, you must be logged in to post a comment.') ); 35 35 endif; 36 36 37 37 $comment_type = ''; 38 38 39 if ( get_ settings('require_name_email') && !$user_ID ) {39 if ( get_option('require_name_email') && !$user->ID ) { 40 40 if ( 6 > strlen($comment_author_email) || '' == $comment_author ) 41 die( __('Error: please fill the required fields (name, email).') );41 wp_die( __('Error: please fill the required fields (name, email).') ); 42 42 elseif ( !is_email($comment_author_email)) 43 die( __('Error: please enter a valid email address.') );43 wp_die( __('Error: please enter a valid email address.') ); 44 44 } 45 45 46 46 if ( '' == $comment_content ) 47 die( __('Error: please type a comment.') );47 wp_die( __('Error: please type a comment.') ); 48 48 49 49 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID'); 50 50 51 wp_new_comment( $commentdata );51 $comment_id = wp_new_comment( $commentdata ); 52 52 53 if ( !$user_ID ) : 54 setcookie('comment_author_' . COOKIEHASH, stripslashes($comment_author), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 55 setcookie('comment_author_email_' . COOKIEHASH, stripslashes($comment_author_email), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 56 setcookie('comment_author_url_' . COOKIEHASH, stripslashes($comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 53 $comment = get_comment($comment_id); 54 if ( !$user->ID ) : 55 setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 56 setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 57 setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 57 58 endif; 58 59 59 $location = ( empty( $_POST['redirect_to'] ) ) ? get_permalink( $comment_post_ID ) : $_POST['redirect_to']; 60 $location = ( empty($_POST['redirect_to']) ? get_permalink($comment_post_ID) : $_POST['redirect_to'] ) . '#comment-' . $comment_id; 61 $location = apply_filters('comment_post_redirect', $location, $comment); 60 62 61 wp_redirect( $location);63 wp_redirect($location); 62 64 63 65 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)