Jo Burbidge
asked 8 years ago

Is is possible to force people to login before posting a question? At the moment I just get a message “You do not have permission to submit a question” and if I add a link to the login page they are then redirected to the home page AND the link still appears when they are logged in.

Help please

1 Answers
DominicStaff
answered 8 years ago

At the moment, we have disable temporary this option to improve and update the plugin.
If you want to have it, you can open the archive-question.php file then add the following code under line 30:

<div>
 <?php if ( ! dwqa_current_user_can( 'post_question' ) ) {

 echo '<div class="alert">'.__('You do not have permission to Ask Questions','dwqa').'</div>';

 }

 if( is_user_logged_in() ) {

 global $dwqa_options;

 if( isset($dwqa_options['pages']['submit-question']) ) {

 $submit_link = get_permalink( $dwqa_options['pages']['submit-question'] );

 if( $submit_link ) {

 _e('You can ask question <a href="'.$submit_link.'">here</a>', 'dwqa' );

 }

 }

 } else {

 _e('Please <a href="'.wp_login_url( get_post_type_archive_link( 'dwqa-question' ) ).'">Login</a>', 'dwqa' );

 $register_link = wp_register('', '',false);

 if( ! empty($register_link) && $register_link ) {

 echo __(' or','dwqa').' '.$register_link;

 }

 _e(' to submit question.','dwqa');

 wp_login_form();

 }

 echo '</p>';

 ?>

</div>
Powered by DW Question & Answer Pro