Maurizio Martinoli
asked 8 years ago

Hello
i have disabled the option to post a question for anonymous, although now there is not link to signup/registration page on the submit question page for unregistered users.
How can i ad a form or a link to show to unregistered users in that page?
Thanks

PS: what is this theme you are using here? is it possible to use it or purchase it?

2 Answers
DominicStaff
answered 8 years ago

To resolve this issue, you can add the following code to the templates.php file of your DW Q&A plugin.

    function dwqa_get_ask_question_link( $echo = true, $label = false, $class = false ){
    global $dwqa_options;
    $submit_question_link = get_permalink( $dwqa_options['pages']['submit-question'] );
    if ( $dwqa_options['pages']['submit-question'] && $submit_question_link ) {

        if ( dwqa_current_user_can( 'post_question' ) ) {
            $label = $label ? $label : __( 'Ask a question', 'dwqa' );
        } elseif ( ! is_user_logged_in() ) {
            $label = $label ? $label : __( 'Login to ask a question', 'dwqa' );
            $submit_question_link = wp_login_url( $submit_question_link );
        } else {
            return false;
        }
        //Add filter to change ask question link text
        $label = apply_filters( 'dwqa_ask_question_link_label', $label );

        $class = $class ? $class  : 'dwqa-btn-success';
        $button = ''.$label.'';
        $button = apply_filters( 'dwqa_ask_question_link', $button, $submit_question_link );
        if ( ! $echo ) {
            return $button;
        }
        echo $button;
    }
}

And find around line 1051.
Replace the following code:

if ( $name == 'question-submit-form' && ! dwqa_current_user_can( 'post_question' ) ) {
            echo '<div class="alert">'.__( 'You do not have permission to submit a question','dwqa' ).'</div>';
            return false;

With new code:

if ( $name == 'question-submit-form' && ! dwqa_current_user_can( 'post_question' ) ) {
            echo '<div class="alert">'.__( 'You do not have permission to submit a question','dwqa' ).'</div>';
            dwqa_get_ask_question_link( );
            return false;
  • what is this theme you are using here? is it possible to use it or purchase it?
    ==> The current plugin and theme used for DesignWall has made for only our site and not officially released. So it’s hard for you to have it, unfortunately.

Hope this helps!

Maurizio Martinoli
answered 8 years ago

thanks!

Powered by DW Question & Answer Pro