Make WordPress Core

Ticket #17976: 17976.patch

File 17976.patch, 2.9 KB (added by SergeyBiryukov, 12 years ago)
  • wp-comments-post.php

     
    9090$comment_id = wp_new_comment( $commentdata );
    9191
    9292$comment = get_comment($comment_id);
    93 if ( !$user->ID ) {
    94         $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);
    95         setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    96         setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    97         setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    98 }
    9993
    10094$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
    10195$location = apply_filters('comment_post_redirect', $location, $comment);
  • wp-includes/comment.php

     
    20142014        return $open;
    20152015}
    20162016
     2017/** 
     2018 * Sets the cookies used to store an unauthenticated commentator's identity. Typically used 
     2019 * to recall previous comments by this commentator that are still held in moderation. 
     2020 * 
     2021 * @param int $comment_id Comment ID.
     2022 */ 
     2023function wp_set_comment_cookies($comment_id) { 
     2024        global $user;
     2025
     2026        if ( !$comment = get_comment($comment_id) )
     2027                return false;
     2028
     2029        if ( !$user->ID ) {
     2030                $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);
     2031                setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
     2032                setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
     2033                setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
     2034        }
     2035
     2036
    20172037?>
  • wp-includes/default-filters.php

     
    253253add_action( 'save_post',                  '_save_post_hook',          5, 2 );
    254254add_action( 'transition_post_status',     '_transition_post_status',  5, 3 );
    255255add_action( 'comment_form', 'wp_comment_form_unfiltered_html_nonce'        );
     256add_action( 'comment_post',               'wp_set_comment_cookies'         );
    256257add_action( 'wp_scheduled_delete',        'wp_scheduled_delete'            );
    257258add_action( 'before_wp_tiny_mce',         'wp_print_editor_js'             );
    258259add_action( 'after_wp_tiny_mce',          'wp_preload_dialogs',      10, 1 );