Rohit D
asked 9 years ago

Hi.Thanks for the awesome dw answer plugin. How can i add a register link on the question page for logged out user ? Login form is there by default. But i also need to add a register link so that user can register through buddypress signup and are redirected back on the same question page.

This is how it looks:
![This is how it looks]( "enter image title here")
I want to add the Register link just below the login button for both desktop and mobile. Please help. :}

1 Answers
answered 9 years ago

If you want to use the default register of WordPress, you can log in to Dashboard > Settings > General then check the Anyone can register.
See the screenshot:
Also, if you want to redirect to another pages, you can open the \wp-content\plugins\dw-question-answer\inc\templates\default\answer.php file and then find the line 107.
printf( '%1$s <a href="%2$s" title="%3$s">%3$s</a> %4$s', __( 'Please login or', 'dwqa' ), wp_registration_url(), __( 'Register', 'dwqa' ), __( 'to Submit Answer', 'dwqa' ) );

Note: change the href=’%2$s’
example: href=’

replied 8 years ago

I checked the "Anyone can register" option but i still don’t see the login/register link for unregistered users though… can you help?

dominic Staff
replied 8 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 2.

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' ) ?></div>
    <?php } else { ?>
    <h3 class="dwqa-title">
            printf( '%1$s <a href="%2$s" title="%3$s">%3$s</a> %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 ) ) ); ?>


Hope this helps!

Spencer Hill
replied 7 years ago

This does not work for me. I continue to get “You do not have permission to submit a question” on /ask-a-question/

Dominic Staff
replied 7 years ago

Please log into Dashboard > Settings > General setting then enable the Anyone can register option.
See the screenshot:
If you still face their issue, please send me username & password of your site for further checking.

Powered by DW Question & Answer Pro