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
This commit is contained in:
wpmuguru 2010-05-04 19:31:24 +00:00
parent 1beb7406da
commit 96153a63ae
4 changed files with 17 additions and 3 deletions

View File

@ -379,7 +379,11 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
$post->post_status = 'draft'; $post->post_status = 'draft';
$post->to_ping = ''; $post->to_ping = '';
$post->pinged = ''; $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->ping_status = get_option( 'default_ping_status' );
$post->post_pingback = get_option( 'default_pingback_flag' ); $post->post_pingback = get_option( 'default_pingback_flag' );
$post->post_category = get_option( 'default_category' ); $post->post_category = get_option( 'default_category' );

View File

@ -42,6 +42,12 @@ include('./admin-header.php');
<?php _e('Allow people to post comments on new articles') ?></label> <?php _e('Allow people to post comments on new articles') ?></label>
<br /> <br />
<small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small> <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
<br />
<label for="default_comment_status_page">
<input name="default_comment_status_page" type="checkbox" id="default_comment_status_page" value="open" <?php checked('open', get_option('default_comment_status_page')); ?> />
<?php _e('Allow people to post comments on new pages') ?></label>
<br />
<small><em><?php echo '(' . __('These settings may be overridden for individual pages.') . ')'; ?></em></small>
</fieldset></td> </fieldset></td>
</tr> </tr>
<tr valign="top"> <tr valign="top">

View File

@ -56,7 +56,7 @@ if ( is_multisite() && !is_super_admin() && 'update' != $action )
$whitelist_options = array( $whitelist_options = array(
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ), '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' ), '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' ), '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' ), 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ),

View File

@ -2159,7 +2159,11 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
if ( $update ) if ( $update )
$comment_status = 'closed'; $comment_status = 'closed';
else 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) ) if ( empty($ping_status) )
$ping_status = get_option('default_ping_status'); $ping_status = get_option('default_ping_status');