Skip to content

Commit

Permalink
Fixed: Anonymous name is not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
rahularyan committed Aug 24, 2016
1 parent 6459cbc commit a064f33
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion includes/answer-form.php
Expand Up @@ -55,7 +55,7 @@ function ap_get_answer_form_fields( $question_id = false, $answer_id = false ) {
// Add name fields if anonymous is allowed.
if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) ) {
$fields[] = array(
'name' => 'name',
'name' => 'anonymous_name',
'label' => __( 'Name', 'anspress-question-answer' ),
'type' => 'text',
'placeholder' => __( 'Enter your name to display', 'anspress-question-answer' ),
Expand Down
4 changes: 2 additions & 2 deletions includes/ask-form.php
Expand Up @@ -82,7 +82,7 @@ function ap_get_ask_form_fields( $post_id = false ) {
// Add name fields if anonymous is allowed.
if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) ) {
$fields[] = array(
'name' => 'name',
'name' => 'anonymous_name',
'label' => __( 'Name', 'anspress-question-answer' ),
'type' => 'text',
'placeholder' => __( 'Enter your name to display', 'anspress-question-answer' ),
Expand Down Expand Up @@ -313,7 +313,7 @@ function ap_save_question($args, $wp_error = false) {
$attachment_ids = $_POST['attachment_ids'];
ap_attach_post_uploads( $post_id, $attachment_ids, $args['post_author'] );
}

var_dump($args);
// Update Custom Meta.
if ( ! empty( $args['anonymous_name'] ) ) {
update_post_meta( $post_id, 'anonymous_name', $args['anonymous_name'] );
Expand Down
6 changes: 3 additions & 3 deletions includes/process-form.php
Expand Up @@ -203,7 +203,7 @@ public function process_ask_form() {

// Check if anonymous post and have name.
if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) && ! empty( $fields['anonymous_name'] ) ) {
$question_array['anonymous_name'] = $fields['name'];
$question_array['anonymous_name'] = $fields['anonymous_name'];
}

if ( isset( $fields['parent_id'] ) ) {
Expand Down Expand Up @@ -264,7 +264,7 @@ public function edit_question() {

// Check if anonymous post and have name.
if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) && ! empty( $this->fields['anonymous_name'] ) ) {
$question_array['anonymous_name'] = $this->fields['name'];
$question_array['anonymous_name'] = $this->fields['anonymous_name'];
}

$post_id = ap_save_question( $question_array );
Expand Down Expand Up @@ -359,7 +359,7 @@ public function process_answer_form() {

// Check if anonymous post and have name.
if ( ! is_user_logged_in() && ap_opt( 'allow_anonymous' ) && ! empty( $fields['anonymous_name'] ) ) {
$answer_array['anonymous_name'] = $fields['name'];
$answer_array['anonymous_name'] = $fields['anonymous_name'];
}

$answer_id = ap_save_answer( $question->ID, $answer_array );
Expand Down

0 comments on commit a064f33

Please sign in to comment.