Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+12 votes
3.4k views
in Q2A Core by

I know the basics, how it will work, but i'm to bad in programming to make this happen and after 3 hours of trying i need your help, you will also benefit from this!

This is my Tip:

The reason why new user sign up is simply, because they want more rights like asking questions or giving answers. So if we dont want to loose some users, we have to make it simple and fast. The Facebook Login was a great thing but we can make it even better:

This is how we can do it:

If a new user wants to post something he gets this message "please log in or register to do xy". A much better way would be to redirect him to a site that allready has the login AND the register form side by side. This would 1. save him one click (for the lazy ones) and 2. He will see that you only need to fill out three fields, so simple and fast that nearly everyone can join in 5 seconds and not (like they will expect) 10-20 fields like in most forums and boards. 3. We can place there a field with benefits that he will have after registration.

This are the things i found out to code it:

qa-page-login.php has the login formular
qa-page-register.php has the register formular
function page_error() in qa-theme.php is were the error message is produced
qa-page-ask is one of the places where we have to insert this

I hope you can understand what i mean, maybe you like this idea too =)

by
Another way to do this would be bait and register approach. An user will be allowed to ask a question or add an answer without any prompt for registration but on submitting he will be taken to the registration page with a message asking to register in order to post. If you happen to give a simple registration form or Facebook login, the user will do another click get registered and whatever he submitted will auto post. I have this setup on Wordpress WMPU QA and it worked very well for me. But Q2A does not provide such a feature and if someone is a hacker here please let me know how to implement the same. I understand it must be some sort of a post capture and verify for login then redirect to register then back to form to submit logic.

6 Answers

+4 votes
by
I think it's a good idea. Even better, you could pop up the form with Javascript when you click "Login/Register," similar to how Digg does it.
0 votes
by
yes, it is a good idea, many software works in that way. If the user want to make something that needs to be registered he is redirected to a ligin/register page and next login/register he is redirected to the first page where he wanted to make the action. To solve this I think we can play with the referer.
+1 vote
by
Indeed good thinking.

Allowing quick registration while asking a question (in the same form, with 2-3 more fields of username, email etc.) can be very helpful and quick for users as well.

These login and registration improvements can really boost the amount of users participating in the community.
0 votes
by
good idea!

Gideon: how we can take this idea into Q2A? Thanks!
+3 votes
by
edited 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);  
 
?>">
by
edited by
I think that is fully enough , as allready registered users will login automatically if they want to use the page.

@NOAH, where would You put that code from Your first example in the advanced theme and much more important how to change the code for voting ?

As well it would be adream to have the favorite symbol visible allways, so a new potential user would know when hovering about, that he could save his favorites inside the system...
0 votes
by

if you want ask page redirect to login page

pages/ask.php


    switch ($permiterror) {
        case 'login':
            //$qa_content['error'] = qa_insert_login_links(qa_lang_html('question/ask_must_login'), qa_request(), isset($followpostid) ? array('follow' => $followpostid) : null);
            qa_redirect('login');
break;

...