Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.4k views
in Q2A Core by
edited by
Is it possible, and what should I do to add users to q2a from an external script?

Let's say that I have a list of users, email-addresses and passwords.

Now,I want to add all of them as users to the website. What should I add to the database to make this happen?

edit: I can write programming code and noticed the qa_users table, but I don't know whether this is the only table which should be changed and how the encoding of passwords etc.. happens.
Q2A version: 1.5.2
by
What format is your originating user database?
by
I do not have a proper original database. I just have a text file with usernames exported from another system.
by
You can use this free plugin as a starting point and modify it to your needs: http://www.question2answer.org/qa/59233/new-free-plugin-create-new-user-admin

2 Answers

+4 votes
by
selected by
 
Best answer

Add a user by calling:

qa_db_user_create($email, $password, $handle, $level, $ip);

You will need to include some other qa files to use this.

Also, look through qa-db-users.php and qa-app-users.php. There are some functions in these that you will find useful.

If you need to fill other user fields, do it after qa_db_user_create() by calling qa_db_user_set().

   

 

 

+1 vote
by
Yes you can write a PHP script to insert the records you have into your QA_users table in the Q2A database.

I know how to write the PHP script, however it depends on what format the originating user database / table is in as to what code will need to be written for the PHP script.
...