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

    Good Day ! 
Please help me...

 I want to start Q2A site. This is the way how I proceeded;

1) I installed Q2A as standalone (ask.qsarticle.com) and everything was fine except that EMAILS were not able to be sent to the users (emails including confirmation link email). I tried my best but found no solution for that.

2) Then I decided to integrate Q2A with my current WP site (www.qsarticle.com) as my WP site is already in good working condition.

3) As in step-1, I was already having Q2A installed; I inserted the path to my WP site in Q2A.

4) I accessed my Q2A and it asked me to create the database and I did. It integrated successfully.

5) Then I tried to test the "register" in Q2A. When I clicked on it, I was successfully transferred to my WP site where I registered.

6) Next I tried to login the Q2A. After entering username and password in Q2A, I was redirected to LOGIN page to my WP site where I again entered the same username and password. After successful login, I was redirected to my WP site Dashboard and not to the Q2A.

7) Then I tried to modify qa-external-users.php (in an effort to correct the redirect issues) .The modified form of qa-external-users.php file is Here

8) Even then I was not able to be redirected. So I inserted SOME lines at start and at end of my qa-config.php. The modified file can be accessed Here.

9) When I did changes (described in step 8), Now when I try to access my Q2A (ask.qsarticle.com), I get blank page.

   The error log says:::: [20-Apr-2013 08:30:39] PHP Fatal error:  Call to undefined function  add_filter() in /home2/enggarti/public_html/ask/qa-config.php on line 170
 and line 170 refers to the code which needs to be placed at end of qa-config.php

  Please help. I am trying this Q2A since last three days.

Thanks in advance

Q2A version: 1.5.4

1 Answer

+1 vote

This is obvious error. You are trying to call WordPress function in Q2A config file..

add_filter() is a WordPress function and you haven't included any WP function in Q2A system. Here you need to understand that it's not WordPress is talking to Q2A but Q2A who is talking to WordPress.

So in short add_filter() function is not gonna work in qa-config.php file unless you include wordpress functions file...This function you should use in your Wordpress theme's functions.php file insted of qa-config.php that may works.

Thank you very much. Its now partially working.
1) Now the problem is that when user enters his login and password, he is transferred to other site (qsarticle.com) in which he is again asked to enter login and password.
2) When a user logins in step 1, he is not redirected to question2answer. Please help. You can check the files. (links attached in the question above). I think there might be some problem in qa-external-users.php but I do not know what is wrong in the said file.
What is your site structure? Means is WP your main site and Q2A in sub-directory? Have a look this site http://wpqa.q2amarket.com/qa/users

Here when you login form above link page than it will first redirect to WP login screen than once  you logged in, it will redirect you back to Q2A Users page.

This site is for demo of my WordPress and Q2A Pack ( theme and widget included ) Which has structure like WP(main) and Q2A ( sub-directory) if you have the same than everything should work without any issue..You don't have to use any WP filter to redirect them to Q2A site if they are log in from Q2A site.

However if you want to redirect users when they log in from WP site and want to redirect to Q2A after logged in than you may have to use any filter hook..

There is a plugin for WP called Theme My Login which allows to login from front end and after login redirection.
Thank you soni for your continued help.
My main site is "www.qsarticle.com" and my q2a site is "www.ask.qsarticle.com" . Will you please help me to resolve redirect issue.
The URL for login is fine "http://www.qsarticle.com/wp-login.php?redirect_to=http%3A%2F%2Fwww.ask.qsarticle.com%2F%2Findex.php" which shows that Q2A has sent correct url but when the user logins, he is not redirected.
I have gone through qa-external-users.php file but there are alot of options there and I myself don't know which code to run for redirecting.