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

Hi, I want to create Q&A website for personal purposes (not publicly availbale) but I want to bulk register users so non tech savy ones wont have to do it. All users would have the same password. Is there a way to do this? Also I would like to make a dropdown list of all registered users from which users could select their user name and at a click of a button log in. I did similar thing for OSQA system but I decided to do this website with Question2Answer. 

On OSQA, I basiclly made form like this:

<form method="post" action="http://www.website.com/user/local/login/">

            <select name="username">
                <option value="User1">User1</option>
 
                <option value="User2">User2</option>
            </select>
 
            <input type="hidden" name="password" value="password" />
 
            <input type="submit" value="Login!">
 
        </form>
 
 

Could something similar be done with Q2A? 

Thank you.

Q2A version: latest

1 Answer

–1 vote
by

This is just hint. I don't try it really, but I think that you can do it if you make one php.

Reference program:

  • qa-include/qa-page-register.php
  • qa-include/qa-app-users-edit.php

Incomplete example:

require_once QA_INCLUDE_DIR.'qa-base.php';
require_once QA_INCLUDE_DIR.'qa-db-users.php';
require_once QA_INCLUDE_DIR.'qa-app-users-edit.php';
 
for($i=1 ; $i<=1000 ; $i++) {
  $handle = 'user'.$i;
  $email = $handle . '@example.com';
  $password = 'fixedpassword';
  qa_create_new_user($email, $password, $handle);
}

Attention:

Comment out welcome notification email. qa_send_notification() of qa_create_new_user().

by
Thank you for your answer. But this would (maybe) add users like user1, user2, user3 etc.. I would be able to add a list of usernames with fixed password. Also would this php script needed to be run from terminal? I have shared hosting without terminal access.
...