Visibility section of Publish Module for Posts. Pages later.

git-svn-id: https://develop.svn.wordpress.org/trunk@9639 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2008-11-12 18:36:48 +00:00
parent 52c008dd98
commit fa2bd6f96e
5 changed files with 220 additions and 60 deletions
+28
View File
@@ -153,6 +153,20 @@ function edit_post( $post_data = null ) {
if ( is_wp_error($post_data) )
wp_die( $post_data->get_error_message() );
switch ( $post_data['visibility'] ) {
case 'public' :
unset( $post_data['post_password'] );
break;
case 'password' :
unset( $post_data['sticky'] );
break;
case 'private' :
$post_data['post_status'] = 'private';
$post_data['post_password'] = '';
unset( $post_data['sticky'] );
break;
}
// Meta Stuff
if ( isset($post_data['meta']) && $post_data['meta'] ) {
foreach ( $post_data['meta'] as $key => $value )
@@ -442,6 +456,20 @@ function wp_write_post() {
if ( is_wp_error($translated) )
return $translated;
switch ( $_POST['visibility'] ) {
case 'public' :
$_POST['post_password'] = '';
break;
case 'password' :
unset( $_POST['sticky'] );
break;
case 'private' :
$_POST['post_status'] = 'private';
$_POST['post_password'] = '';
unset( $_POST['sticky'] );
break;
}
// Create the post.
$post_ID = wp_insert_post( $_POST );
if ( is_wp_error( $post_ID ) )