Error on edit history insert when using external authentication
Opened this issue · 1 comments
On my first test of this plugin I got a query fail error:
[Mon Dec 04 19:52:49 2017] [notice] [client 10.1.11.92] PHP Question2Answer MySQL query error 1366: Incorrect integer value: 'c067284' for column 'userid' at row 1 - Query: INSERT INTO qa_edit_history (postid, updated, title, content, tags, userid)\n\t\t\t VALUES (40, NOW(), '{post content}', '{post tags}', 'c067284'), referer: {post url}?state=edit-40
As you can see, I'm using a VARCHAR(7) userid, but edit-history seems to initialyze its table with a hard-coded INT(10).
Changing the column data type fixed the issue for me, but I think it should be corrected in the initialization query. I'm yet to study how to get the custom data type from qa-external and plan on making a pull request, but if someone more proficient at q2a development steps in, I'd be glad =)
Ah yes, I didn't consider this situation. Q2A core generally checks for QA_FINAL_EXTERNAL_USERS
throughout the code so we can probably do that and then call qa_get_mysql_user_column_type()
to get the correct type.