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

hi

i dont install q2a and wordpress integration but i want to show q2a login form in wordpress theme

i use wp-snow theme this theme have wp login form but how can i use it for q2a?

 

 

Q2A version: 1.6.2

1 Answer

+2 votes
by
selected by
 
Best answer

Hi You can do this in the following way:

1. Import qa-base

2. import qa-app-users

3. Render the login form

Sample Code:

<?php

include("qa-include/qa-base.php");

include("qa-include/qa-app-users.php");

echo '<!-- Login Form Starts -->'.

'<form id="qa-loginform" action="/login" method="post">'.

'<input type="text" id="qa-userid" name="emailhandle" placeholder="'.trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':').'" />'.

'<input type="password" id="qa-password" name="password" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'" />'.

'<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>'.

'<label for="qa-rememberme" id="qa-remember">'.qa_lang_html('users/remember').'</label></div>'.

'<input type="hidden" name="code" value="'.qa_html(qa_get_form_security_code('login')).'"/>'.

'<input type="submit" value="Submit" id="qa-login" name="dologin" />'.

        '</form>'.'<!-- Login form ends -->';

?>

 

In the line  '<form id="qa-loginform" action="/login" method="post">'    

You can replace the action URL /login with the one your QA is configured. /login is the login page URL for all QA installations.

<?php
include("qa-include/qa-base.php");
include("qa-include/qa-app-users.php");
echo '<!-- Login Form Starts -->'.
'<form id="qa-loginform" action="/login" method="post">'.
'<input type="text" id="qa-userid" name="emailhandle" placeholder="'.trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':').'" />'.
'<input type="password" id="qa-password" name="password" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'" />'.
'<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>'.
'<label for="qa-rememberme" id="qa-remember">'.qa_lang_html('users/remember').'</label></div>'.
'<input type="hidden" name="code" value="'.qa_html(qa_get_form_security_code('login')).'"/>'.
'<input type="submit" value="Submit" id="qa-login" name="dologin" />'.
    '</form>'.
'<!-- Login form ends -->';
?>
...