I am using the code in a page below to let users delete their posts from the front in. I have wp-admin totally blocked off to site users.
What i want to do is when they click the delete button the post actually goes into draft or pending mode so there is still a record of the post but the front end cant view it.
<!-- buyer-home.php -->
<?php
if( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
set_query_var( 'postid1', $_POST['postid'] );
wp_delete_post( get_query_var( 'postid1'), true ); }; ?>
<?php query_posts( array( 'author' => $current_user->ID,'post_status' => 'publish' , 'post_type' => array( 'user_lists' ) ) ); ?>
<?php if ( !have_posts() ): ?>
<div class="info" id="message">
<p>
<?php _e( 'No Lists found.', 'lists' ); ?>
</p>
</div>
<?php endif; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h1 class="entry-title center">Your Lists</h1>
</header>
<div class="entry-content">
<div class="table style1">
<div class="tr">
<div class="td style2">
<h2>Date And Time</h2>
</div>
<div class="td">
<h2>Delete</h2>
</div>
</div>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php echo '<div class="tr"><div class="td style2">';
echo '<a href="'; the_permalink(); echo '">'; the_time('F j, Y'); ?> at
<?php the_time('g:i a'); echo '</a>';
echo '</div><div class="td">'; ?>
<?php change_post_status( the_ID, 'private'); ?>
<form class="delete-list" action="" method="post">
<input type="hidden" name="postid" value="<?php the_ID(); ?>" />
<input class="more-button" type="submit" value="Delete" />
</form>
<?php echo '</div></div>'; ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<div class="tr">
<div class="td style2">
<h2>Date And Time</h2>
</div>
<div class="td">
<h2>Delete</h2>
</div>
</div>
</div>
</div><!-- .entry-content -->
</article><!-- #post -->
<!-- /buyer-home.php -->
Simply replace
with
That is assuming that the rest of your logic does already work.