bason
asked 7 years ago

Hello, I liked your plugin.
I would like to ask. How to make the selection field “category” has become a must for selection.
I have two categories on the site and the shortcode [dwqa-list-questions category = “male”] and [dwqa-list-questions category = “female”] on two pages displaying items for categories of male and female.
When submitting a question, if a person does not choose a category, then the issue is not visible in the list.
Can you help?

5 Answers
DominicStaff
answered 7 years ago

You can open file wp-content/plugins/dwqa-question-answer/inc/Handle.php and add following code from line 293:

if ( !$category ) {
dwqa_add_notice( __( ‘You must choose category.’, ‘dwqa’ ), ‘error’ );
return false;
}
 if ( !is_user_logged_in() && empty( $_POST[‘_dwqa_anonymous_email’] ) && !is_email( $_POST[‘_dwqa_anonymous_email’] ) ) {
dwqa_add_notice( __( ‘You must enter a valid email.’ ), ‘error’ );
return false;
}
bason
replied 7 years ago

1-ask, 1-answer ?((

bason
answered 7 years ago

Added code unfortunately writes an error on the page:
Parse error: syntax error, unexpected ‘must’ (T_STRING), expecting ‘,’ or ‘)’ in / home / host1452973 / site / htdocs / www / wp-content / plugins / dw-question-answer / inc / Handle. php on line 294

bason
answered 7 years ago

I do not do right?

DominicStaff
answered 7 years ago

Please send me username & password of your site, I will help you resolve it.

Powered by DW Question & Answer Pro