I found the support topic which will allow for a PDF to be uploaded when a question is submitted, but is is possible to allow a user to add/upload a PDF in a comment? Thanks.
Hi,
I am using latest version.
I have set an image to category without setting an icon class and a color.
But it automatically takes an icon.
Please advice how to overcome this.
Hi,
I learnt from following FAQ about how to create and implement custom forms –
https://anspress.io/resources/faq/anspress-form-and-validation-api/
I tested the demo form provided in the tutorial and it’s working as expected. However the form retains the fields values after the form is submitted. I am unable to figure out how to reset form fields values?
- Is there any way to reset the all fields values at once?
- What if I just want to reset any particular field value (for e.g. if I only want to reset Editor field in sample form of above FAQ). [I am particularly interested in this one.]
Edit 1-
As I have posted gist for inserting question programmatically –
https://gist.github.com/atultiwari/4bc9fd36c5fb2a18081762189fd6a347
In that only for testing purpose, I posted a sample custom form with the help of FAQ, I am still unable to figure out how to reset fields entries after submission. Please look into this?
Edit 2 –
I did try the answer posted by Rahul, but unfortunately it didn’t unset. Maybe I didn’t understand some part properly.
@rahul, can you please little bit elaborate. For e.g., my customized form name is – “at_question_form” (with two fields named “post_title” and “post_content”), so I used following code –
unset( anspress()->forms[’at_question_form’] );
Since it didn’t unset out of the box, I thought of all possible places where I could have used this code –
- In the end of function “at_custom_question_form_in_ap”
- In the end of function “at_submit_question_form”
- And soon after generating this form
But, neither of them could unset the form.
So please help me out with this.
Also is there anything like (unset only specific field)-
unset( anspress()->forms[’at_question_form’][’post_content’] );
Thanks.
Regards
I use Grammarly, and there are millions of people that do the same. It is a browser extension that will underline spelling and grammar mistakes, then you hover your mouse over the mistake, a little box appears above with the suggested correction, when you click on a correction it makes the modal and everything you just wrote, disappear.
There needs to be a way to not have the modal disappear like that so easily.
when inside a question, the menu display of my site is superimposed on all other pages. what can I do?
Rahul – is there any facility to enable users to edit their profile on anspress.io ? For example, there are a number of things I would like to change, but cannot see anywhere this is enabled.
Thanks
Hi – is there any function that can override the voting icons ? I copied /includes/votes.php to /mytheme/anspress/includes/votes.php to make changes, but this doesn’t seem to work.
Any pointers ?
Thanks
Hi,
I tried to insert question programmatically, like you mentioned in your FAQ. In fact, I used almost the same sample code you provided (except that I changed Tag Id and names).
Unfortunately it threw me an error.
Link to my sample gist –
https://gist.github.com/atultiwari/2f0a877e9e63c0c4ed334ecf50189308
I have already downloaded the latest one from master branch (and confirmed that manual mode etc are there).
Similarly I tried to post answer, it threw me error – “the server responded with a status of 500 (Internal Server Error)”‘
Link to Gist file –
https://gist.github.com/atultiwari/a7c5cfb43324b08125a2cbec6bd15a02
Answer is getting posted with –
$post_id = wp_insert_post($values);
but not with Hook.
I tried to look for where am I making mistake for hours now, but I am unable to figure it out.
Edit 1 –
After the fixed pushed by @Rahul, questions are getting inserted programmatically, as described. However still there are some issues, such as –
- Tags are not getting inserted (I tried to find out if it’s with me only or it’s an issue with the script, but I couldn’t), while question and category is inserted correctly
- Question metas and activity didn’t get inserted when using sample code provided in FAQ –>I think it’s because of
$qameta
was never used. I found these working if I use the functions “ap_insert_qameta
” and “ap_update_post_activity_meta
” on$qameta
, however I am not sure if I am using the correct method. - When trying similar method to insert Answer, it didn’t insert
post_parent
and answer got orphan. While reading the source code for Answer form and related submit function, I observed that herepost_parent
is passed under the variable named$question_id
, so I tried to pass it like this, but still it failed.var_dump
revealed that while passing the value for$question_id
it’s storing them in array, first is boolean and in 2nd one it’s strong theparent_post
id, which is never used. While if we use the same function on default answer form (when answering the question from GUI),$question_id
stores the parent post id. How? I couldn’t understand it. - Even if submitting answer programmatically started working, it will also need some metas and activity update for answer as well to complete the all steps.
- I think in complete source section of the FAQ line 15 you forgot to put
;
therefore it’s not working at all (out of the box)
Regards,
Atul