Which PHP files do I need to modify in order to add a new field in the question form?

4.53K viewsGeneral
0

I want to add a new field to the question form. I would like this field to be where the user can enter a dollar amount. This field will ALSO be used as the field for my payment processor (Braintree). I’ve been looking through the PHP files and I know that process-form.php might need to be changed as so:

 

$question_array = array(
‘post_title’ => $fields[’title’],
‘post_author’ => $user_id,
‘post_content’ => apply_filters(‘ap_form_contents_filter’, $fields[’description’]),
‘post_type’ => ‘question’,
‘post_status’ => $status,
‘comment_status’ => ‘open’,
‘post_amount’ => $fields[’amount’],
);

But I think I also need to modify $fields. Where do I find the components of $fields? Also, any tips on what else I would need to modify in order to successfully add a new field that is tied to the question and posted to the database?

Thanks,

Aaron

0

https://gist.github.com/rahularyan/0b37680c1a24c1e78baf#file-gistfile1-php

I don’t understand. I want to add a brand new field named ”amount”. Is it similar to how you would add ”category”?

Also, where would I even put the above code? What file do I put that in?

Yes its taken from category extension, modify as per your need and paste it in theme functions.php

Ok so I used this and changed anywhere it says category/categories to amount. But it still won’t post to the database. What other file needs to be edited?