Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.9k views
in Q2A Core by
Whenever I attempt to remove a question I get the following error message:

Question2Answer query failed:  SELECT qa_users.userid, handle, level FROM qa_users WHERE level>=20 ORDER BY level DESC

It appears that the message is actually removed however the error message is pretty serious looking. Is there anything I can do to prevent this problem?
Q2A version: current version q2a
by
it might be a script error due to "Removing Questions that it's user had been removed before".
by
I have not touched the users, although I am using my Wordpress users database, could that be a conflict of some sort?

1 Answer

0 votes
by
That query won't work with external user integration, including WordPress integration, because there is no users table. But I don't understand why it's being run, since in the Q2A core it is only called from a page which also isn't available with external user integration. Do you have any non-standard plugins installed?
by
Hi Gid, I turned off all the plugins now I get duplicate posts and Error 1146: Table 'rabideau_genealogyaid.qa_users' doesn't exist when I try to remove the duplicates.  I feel special! ;)
by
Is it possible you installed it in self user management mode, and then later on added the qa-config.php setting for WordPress integration? That could explain a messed up database.
by
Hi Gid I think I'm not smart enough to know what self user management mode is.  I brought the system up using WordPress on the first day.  I never ran it in stand alone mode.  Perhaps that answers the question. This is from my qa-config.php file:
*/
    define('QA_WORDPRESS_INTEGRATE_PATH', '../');
/*
q2a is located in a subdirectory of WP called /q2a
WP is in /username/public_html/sitename.com
by
Well that might well be the problem. QA_WORDPRESS_INTEGRATE_PATH must be defined as the *full* path to your WordPress directory, not the relative path.
by
Hi Gid.  I changed it to the full path.  I still get the same answer... Duplicate on an Answer. Database error on a Vote.

Here's the path statement [slightly modified]:
/home/<username>/public_html/<domain url>/
by
OK, I tried it on your site and can see the problem. Can you please check your web server error log and report the recent rows containing Question2Answer.
by
Hi Gideon.  There are no recent errors from Q2A on the wordpress side.  On the q2a portion, I have these:

[13-Oct-2012 11:26:23] PHP Question2Answer MySQL query error 1146: Table 'rabideau_genealogyaid.qa_users' doesn't exist - Query: SELECT qa_users.userid, handle, level FROM qa_users WHERE level>=20 ORDER BY level DESC
[13-Oct-2012 11:26:58] PHP Question2Answer fatal error: User login is handled by external code
[13-Oct-2012 11:45:55] PHP Question2Answer MySQL query error 1146: Table 'rabideau_genealogyaid.qa_users' doesn't exist - Query: SELECT qa_users.userid, handle, level FROM qa_users WHERE level>=20 ORDER BY level DESC
by
OK, so it's still that same query. I don't understand why it's being called, but here's how I'm hoping we can find out. In qa-db.php, find the line beginning @error_log inside function qa_db_fail_error(). After that line, please insert:

error_log('PHP Question2Answer stack trace: '.print_r(debug_backtrace(), true));

Then do something that triggers the usual error, and then post here the recent Question2Answer lines from the web server error log.
by
I'll email the message it exceeds the allowable length here...
by
Thanks. I got it. It's the Q2A-Email-Notifications plugin that's causing the problem. It seems not to be compatible with WordPress integration.
by
So what do I need to do?  Should I shut down all email integration?
by
I'm afraid you need to remove that plugin, since it seems to be entirely built around Q2A's internal user management database tables, which don't exist in your case.
by
I just did... and now things seem to work.  Hopefully I won't anything else so exciting.
...