Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
252 views
in Q2A Core by

It's pretty easy to do this with a custom theme... for example:

            if(qa_opt('permit_post_q') == QA_PERMIT_USERS && !qa_get_logged_in_userid()) {
                $userlinks=qa_get_login_links($qa_root_url_relative, isset($topath) ? $topath : qa_path($qa_request, $_GET, ''));                
                $this->content['navigation']['main']['ask']['url'] = 'javascript:if (confirm(\'Asking questions requires you to login or register.  Would you like to register now?\')) document.location.href=\''.qa_html(@$userlinks['register']).'\';';
            }

You can replace 'register' with 'login' if you want it to redirect to the login form.  You could also create your own hybrid login/register page.

Edit: here's a way to do this with the ask-box widget as well, in qa-ask-box.php:

<FORM METHOD="POST" ACTION="<?php  
 
if(qa_opt('permit_post_q') == QA_PERMIT_USERS && !qa_get_logged_in_userid() && isset($qa_content['navigation']['main']['ask'])) {
    $userlinks=qa_get_login_links($qa_root_url_relative, isset($topath) ? $topath : qa_path($qa_request, $_GET, ''));                
    echo 'javascript:if (confirm(\'Asking questions requires you to login or register.  Would you like to register now?\')) document.location.href=\''.qa_html(@$userlinks['register']).'\';';
}
else echo qa_path_html('ask', $params);  
 
?>">

Q2A version: 1.7
related to an answer for: Great Way to get more Signups!

Please log in or register to answer this question.

...