Hey guys,
I have translated some new lines on the latest version of DWQA Pro. You can find the .po and .mo files in the links below
https://www.dropbox.com/s/h7j5dtz93zckxfu/dwqa-el.po?dl=0
https://www.dropbox.com/s/8t7lir89k07mk0d/dwqa-el.mo?dl=0
I also have a couple of requests.
Can you add an option so URLs on questions and answers are only automatically created for staff members, and stripped/blocked for everyone else?
Also, can you have a check if the question is empty before it is submitted? Some of my readers mistakenly post questions before they write anything in the body.
Thanks
Angelos
Hi Angelos Kyritsis,
1. You can go to wp-content/themes/your-theme-folder
and add this code below to functions.php
add_filter( 'the_content', 'dwqa_theme_the_content_url' ); function dwqa_theme_the_content_url( $content ) { if ( ( is_singular( 'dwqa-question' ) || is_singular( 'dwqa-answer' ) ) && dwqa_current_user_can( 'manage_question' ) ) { $url = 'http://www.yoururl.com'; $content = $content . '<br>' . $url; } return $content; }
2. To check use if the question is empty before is submitted, you can add this code below
add_action( 'dwqa_before_submit_question', 'dwqa_theme_check_question_is_empty' ); function dwqa_theme_check_question_is_empty() { if ( empty( $_POST['question-content'] ) ) { dwqa_add_notice( 'Please enter your question content', 'error' ); } }
Hi Kevin. thanks for the answer. The code to avoid empty questions is awesome, it works perfectly.
However, the code for the URL won’t work. As a staff user, it only adds a plain text http://www.yoururl.com at the bottom of each question and answer, but it won’t block the URL.
Hi Angelos Kyritsis,
Sorry for my mistake, you can replace with this code below
https://gist.github.com/oryc9x/d46d4ef6276104358b824e6c5421505e
Please login or Register to submit your answer