]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-comments-post.php
Wordpress 2.0.4
[autoinstalls/wordpress.git] / wp-comments-post.php
index 953de6848b6381c3a30bce539547b7d8c0fe8364..3be6142c62a3ab501f24b2023f41125cdfbf142b 100644 (file)
@@ -24,11 +24,11 @@ $comment_author_url   = trim($_POST['url']);
 $comment_content      = trim($_POST['comment']);
 
 // If the user is logged in
-get_currentuserinfo();
-if ( $user_ID ) :
-       $comment_author       = $wpdb->escape($user_identity);
-       $comment_author_email = $wpdb->escape($user_email);
-       $comment_author_url   = $wpdb->escape($user_url);
+$user = wp_get_current_user();
+if ( $user->ID ) :
+       $comment_author       = $wpdb->escape($user->display_name);
+       $comment_author_email = $wpdb->escape($user->user_email);
+       $comment_author_url   = $wpdb->escape($user->user_url);
 else :
        if ( get_option('comment_registration') )
                die( __('Sorry, you must be logged in to post a comment.') );
@@ -36,7 +36,7 @@ endif;
 
 $comment_type = '';
 
-if ( get_settings('require_name_email') && !$user_ID ) {
+if ( get_settings('require_name_email') && !$user->ID ) {
        if ( 6 > strlen($comment_author_email) || '' == $comment_author )
                die( __('Error: please fill the required fields (name, email).') );
        elseif ( !is_email($comment_author_email))
@@ -50,7 +50,7 @@ $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_emai
 
 $comment_id = wp_new_comment( $commentdata );
 
-if ( !$user_ID ) :
+if ( !$user->ID ) :
        $comment = get_comment($comment_id);
        setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
        setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);