Private Answers not working

2.73K viewsIssues
0

Hi,

I can’t write private answers and think it’s a bug.

I’ve had a look at the ap_save_answer  function and saw that ‘private_post’ is correctly set as value of the $status variable. Which is later used as default value for ‘post_status’ in wp_parse_args

if ( isset( $args['is_private'] ) && $args['is_private'] ) {
   $status = 'private_post';
}

$args = wp_parse_args( $args, array(
  'post_title' 		=> $question->post_title,
  'post_author' 	=> get_current_user_id(),
  'post_status' 	=> $status,
  'post_name' 		=> '',
  'comment_status' 	=> 'open',
  'attach_uploads' 	=> false,
) );

But it will never have a chance to get applied to the $args array because the ‘post_status’ is already set.

As I could see, ap_save_answer  is used only in process-form.php in both methods process_answer_form  and edit_answer. Both define ‘post_status’ before calling ap_save_answer 

 

$answer_array['post_status'] = ap_new_edit_post_status( $user_id, 'answer', false );

 

cheers,

Patrick