Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
950 views
in Q2A Core by
I'm trying to add extra field(s) in Registration, but getting "Insufficient parameters" SQL errors on registration. I've successfully altered the qa_users table as needed, and added the info needed to INSERT in /qa-include/qa-db-users.php.

Is there another file I need to edit to add/edit/define these parameters? Thanks for any help.

1 Answer

+1 vote
by

It may be that you're not understanding the way that parameter substitution works in Q2A's qa_db_query_sub(...) function. It's worth reading some of the comments in qa-db.php. For each new parameter, you need to add something in 4 places:

  1. Add the parameter to the function qa_db_user_create(...) declaration.
  2. Add the column name (e.g.  inside the brackets after INSERT...
  3. Add a $ (or # for numbers) sign inside the brackets after VALUES...
  4. Add the parameter after the other parameter to qa_db_query_sub(...).

Here's an example using a new column named gender:

function qa_db_user_create($email, $password, $handle, $level, $ip, $gender)
{

require_once QA_INCLUDE_DIR.'qa-util-string.php';
 
$salt=isset($password) ? qa_random_alphanum(16) : null;
 
qa_db_query_sub(
'INSERT INTO ^users (created, createip, email, passsalt, passcheck, level, handle, loggedin, loginip, gender) '.
'VALUES (NOW(), COALESCE(INET_ATON($), 0), $, $, UNHEX($), #, $, NOW(), COALESCE(INET_ATON($), 0), $)',
$ip, $email, $salt, isset($password) ? qa_db_calc_passcheck($password, $salt) : null, (int)$level, $handle, $ip, $gender
);
 
return qa_db_last_insert_id();
}
...