Maurice Green
asked 9 years ago

Is it possible to change the wording of messages which are displayed to the user?
For example, the message for Anonymous users (not logged in) is:
“You do not have permission to submit a question”
I would like to change it to a suggestion to register and/or login in order to post a question.
Where do I make that kind of change?
I plan to make a child theme for the plugin.

5 Answers
DominicStaff
answered 9 years ago

I think you should send me your FTP, I will help you create a child theme to custom the Q&A plugin. After finished, you can check your site for clearly about the child theme.

DominicStaff
answered 9 years ago

To change the You do not have permission to submit a question, you can open the templates/question-submit-form.php line 68
Or use the .po file to change it.
If you want to create a child theme for the plugin. Currently, you can create a template for DW Q&A based on WordPress child theme, so you may want to check out this link: https://codex.wordpress.org/Child_Themes
Basically, here is the instruction to create a template for DWQ&A:
1) Follow the guide in the link above to create a WP child theme.
2) Go to your child theme folder, and create a new folder, named it dwqa-templates. Inside your new folder, create the style.css file.
3) Go to plugins/dw-question-answer/inc/templates/default folder, and copy all the .php files in that folder to the dwqa-templates folder that you created above.
4) Open up the functions.php file in your child theme folder, and add the code below to bottom of the file:

/* load style for DW Q&A plugin */

if( !function_exists(\'dwqa_tmpl_scripts\') ){

 function dwqa_tmpl_scripts(){

 wp_enqueue_style( \'dwqa-tmpl\', get_stylesheet_directory_uri() . \'/dwqa-templates/style.css\' );

 }

 add_action( \'wp_enqueue_scripts\', \'dwqa_tmpl_scripts\' );
}

5) After 4 steps above, you can now edit both the .php file and the style.css file in dwqa-templates folder as you want without any effect on the Q&A plugin.
Hope this helps!

DominicStaff
answered 9 years ago

At the moment, we have disable temporary this option in the latest version. If you want to display the login/register link in the single question, you can open the single-question.php file in the templates folder and add the following code under line 20.

<?php

if ( dwqa_current_user_can( 'post_answer' ) ) {
dwqa_load_template( 'answer', 'submit-form' );

} else { ?>

<?php if ( is_user_logged_in() ) { ?>

<div class="alert"><?php _e( 'You do not have permission to submit answer.','dwqa' ) ?>

<?php } else { ?>

<h3 class="dwqa-title">

<?php

printf( '%1$s <a href="%2$s" title="%3$s">%3$s %4$s', **( 'Please login or', 'dwqa' ), wp_registration_url(), **( 'Register', 'dwqa' ), __( 'to Submit Answer', 'dwqa' ) );

?>

<div class="login-box">

<?php wp_login_form( array( 'redirect' => get_post_permalink( $question_id ) ) ); ?>

<?php

}

}

?>

Hope this helps!

Maurice Green
replied 9 years ago

Thanks Dominic,
But I am a bit confused. I was familiar with the first answer you gave for the creation of the child theme because I had seen it on another question.
But your second answer makes me ask…What option did you temporarily discontinue in the latest version?
Is it the ability to create a child theme?

Maurice Green
replied 9 years ago

@Dominic
I should also mention that the emails I received with the answer were impossible to read in Outlook because the system kept trying to load your Gravatar and couldn’t find it. I finally came to the website to read the answers.
Maury

Dominic Staff
replied 9 years ago

1/ We have removed this section in the latest version of the Q&A free version. We are planning to update and improve this option. If you want to display the login section, you can make it in the child theme.
Hope this helps!

Maurice Green
replied 9 years ago

Thanks Domiinic,
I think you misunderstood my comment about the email notification. I am getting your email from my POP server on Comcast. I have no problems receiving emails from other GMail users. The problem is that when Outlook tries to download your email from Comcast, it can’t find the image link to Gravatar.com to load your gravatar image and that hangs up the email. When I cancel the loading of the image, I can read the email.

Dominic Staff
replied 9 years ago

Now, I see. Thank you for interesting in our product and your feedback. We appreciate it.
I sent and notified our technical team about this problem. We will check it.
Please let me know, if you have any issue or question. I will check and help you resolve it.

Maurice Green
answered 9 years ago

@Dominic

I need to understand. Are you saying that it is not possible to create a child theme with DWQA?

Your instructions said:

1) Follow the guide in the link above to create a WP child theme. OK I AM ALREADY USING A CHILD THEME. IT HAS A STYLE.CSS FILE WITH A LINK TO THE PARENT THEME.

2) Go to your child theme folder, and create a new folder, named it dwqa-templates. Inside your new folder, create the style.css file. THERE IS ALREADY A STYLE.CSS FILE IN THE CHILD THEME ITSELF. DO YOU WANT ME TO CREATE A SECOND ONE IN THE DWQA-TEMPLATES FOLDER? SHOULD IT BE A COPY OF THE ONE IN THE CHILD THEME ITSELF?

3) Go to plugins/dw-question-answer/inc/templates/default folder, and copy all the .php files in that folder to the dwqa-templates folder that you created above. THERE IS NO ‘/TEMPLATES’ FOLDER IN THE ‘/INC’ FOLDER. THE /INC AND /TEMPLATES ARE SEPARATE FOLDERS AT THE SAME ROOT LEVEL. THERE IS NO ‘DEFAULT’ FOLDER IN EITHER THE /INC OR THE /TEMPLATES FOLDER.

4) Open up the functions.php file in your child theme folder, and add the code below to bottom of the file: THE FUNCTIONS.PHP FILE IS IN THE /INC/HELPER FOLDER.

i HAVE GONE BACK TO VERSION 1.3.8 AND THEY ARE ALL THE SAME DIRECTORY LAYOUT. SO WHAT IS THE STORY ON CREATING A CHILD THEME?

Maury

jacobstrom
replied 8 years ago

@Dominic

I have exactly the same problems. There is no templates folder in the inc folder. And from where should I copy the style.css file? There is already one in my child folder.

Dominic Staff
replied 8 years ago

Go to your child theme folder, and create a new folder, named it dwqa-templates. Inside your new folder, create the style.css file.
See the screenshot: http://prntscr.com/c01cup

Go to plugins/dw-question-answer/templates/ folder (exclude the assets and email folder), and copy all the .php files in that folder to the dwqa-templates folder that you created above.
Open up the functions.php file in your child theme folder, and add the code that I have sent in first answer.

jacobstrom
replied 8 years ago

Thanks, I got it working now.

I had to exchange the \’ to ‘ when copying the code, could be good if someone else wants to follow this.

Maurice Green
answered 9 years ago

@Dominic

Thank you very much. You guys have provided great help.

I have been able to make changes to the message on the dwqa-ask-question page and I will mark this question resolved. I can also make changes in the style.css file to match the style of the dwqa pages to my site theme.

I will be looking at the DWQA-Focus theme. It actually may be better suited to my site than the one I am using.

DominicStaff
answered 8 years ago

@jacobstrom
Please let me know if you have any issue or question, I will check and help you resolve it.

jacobstrom
replied 8 years ago

Thanks, got it working now!

Powered by DW Question & Answer Pro