From 96153a63aee2cb112f9f279b5e595df0234cd668 Mon Sep 17 00:00:00 2001 From: wpmuguru Date: Tue, 4 May 2010 19:31:24 +0000 Subject: [PATCH] add default comment status setting for pages, props messenlehner, see #12991 git-svn-id: http://svn.automattic.com/wordpress/trunk@14448 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/post.php | 6 +++++- wp-admin/options-discussion.php | 6 ++++++ wp-admin/options.php | 2 +- wp-includes/post.php | 6 +++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 69facf61db..6d03db1b8e 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -379,7 +379,11 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) $post->post_status = 'draft'; $post->to_ping = ''; $post->pinged = ''; - $post->comment_status = get_option( 'default_comment_status' ); + if ( 'page' == $post_type ) { + $post->comment_status = get_option( 'default_comment_status_page' ); + } else { + $post->comment_status = get_option( 'default_comment_status' ); + } $post->ping_status = get_option( 'default_ping_status' ); $post->post_pingback = get_option( 'default_pingback_flag' ); $post->post_category = get_option( 'default_category' ); diff --git a/wp-admin/options-discussion.php b/wp-admin/options-discussion.php index 8802f76317..d9457bbbb4 100644 --- a/wp-admin/options-discussion.php +++ b/wp-admin/options-discussion.php @@ -42,6 +42,12 @@ include('./admin-header.php');
+
+ +
+ diff --git a/wp-admin/options.php b/wp-admin/options.php index 15f489d3e2..0a4e8817e1 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -56,7 +56,7 @@ if ( is_multisite() && !is_super_admin() && 'update' != $action ) $whitelist_options = array( 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ), - 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), + 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status_page', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type', 'embed_autourls', 'embed_size_w', 'embed_size_h' ), 'privacy' => array( 'blog_public' ), 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), diff --git a/wp-includes/post.php b/wp-includes/post.php index 8c54b01db4..e6a73717a4 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2159,7 +2159,11 @@ function wp_insert_post($postarr = array(), $wp_error = false) { if ( $update ) $comment_status = 'closed'; else - $comment_status = get_option('default_comment_status'); + if ( 'page' == $post_type ) { + $comment_status = get_option( 'default_comment_status_page' ); + } else { + $comment_status = get_option( 'default_comment_status' ); + } } if ( empty($ping_status) ) $ping_status = get_option('default_ping_status');