chiara Mazzucco
asked 9 years ago

I’d like for a user to ask a question and as soon as they submit, they’d be redirected to a different custom page. Is there any way to do that?

1 Answers
DominicStaff
answered 9 years ago

Dear chiara Mazzucco,

To redirect users to a different page when user submit a question, please open the actions.php file in the folder path "wp-content -> plugins -> dw-question-answer -> inc -> actions.php".
Find the line code around line 511:

exit( wp_safe_redirect( get_permalink( $new_question ) ) );

Then replace with the following code to redirect to home page:

exit( wp_safe_redirect( home_url() ) );

Notice: you can use similar to redirect user to any other page as you wish (in your case to the question listing page)

Eg: like this is my url : http://mysite/discussion-forum/
exit( wp_safe_redirect( home_url() .'discussion-forum/' ) );

Hope this helps !
Best Regards,

cmazzucco
replied 9 years ago

Yes, thank you so much!

ofirbeigel
replied 8 years ago

Hello.
I can’t find action.php in that folder. Could it be that the file has been renamed?
Ofir

Dominic Staff
replied 8 years ago

In the latest version, we have some change in the layout and add some new files. To resolve this issue, you can open the Handle.php file in the Inc folder and find around line 480 to line 500 the following code:

exit( wp_safe_redirect( get_permalink( $new_question ) ) );

ofirbeigel
replied 8 years ago

Hey I changed the code in handle.php like the example you gave but it still doesn’t work. Here is what I replaced it with:
exit( wp_safe_redirect( home_url() .’/thanks-asking-question/’ ) );

Dominic Staff
replied 8 years ago

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

John Murphy
replied 8 years ago

I would like to do the same but the example isn’t working for me either.

exit( wp_safe_redirect( home_url() .’thank-you-for-submitting-an-idea/’ ) );

John Murphy
replied 8 years ago

Actually I came up with a solution to my question …
I didn’t notice that this message appeared on the page after the question is submitted “Your question is waiting moderator.”

I just made the message more visible by adding this css to my child theme:
p.dwqa-alert.dwqa-alert-success { font-size: 2em; color: #0093d1;}

and changing the message in the Handle.php file in the Inc folder (as above):

Thank you for submitting a question.
Your question is now awaiting moderator approval.

Powered by DW Question & Answer Pro