Visibility section of Publish Module for Posts. Pages later.
git-svn-id: http://svn.automattic.com/wordpress/trunk@9639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -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 ) )
|
||||
|
||||
Reference in New Issue
Block a user