Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
292 views
in Q2A Core by

Hi,

 

I am on the latest version and I was trying to create a user account programmatically with the help of qa_create_new_user(). Here is my entire code snippet I am using right now. I actually don't have any idea about where should I place my script file. So as of now I just placed it inside qa-include directory with a name user-import.php. This is the content of the file : 

<?php
define('QA_VERSION', '1.7.0');
define('QA_BASE_DIR', dirname(dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME'])).'/');
define('QA_EXTERNAL_DIR', QA_BASE_DIR.'qa-external/');
define('QA_INCLUDE_DIR', QA_BASE_DIR.'qa-include/');
define('QA_LANG_DIR', QA_BASE_DIR.'qa-lang/');
define('QA_FINAL_EXTERNAL_USERS', true);
error_reporting(E_ALL);

require_once 'qa-app-blobs.php';
require_once 'qa-app-users.php';
require_once 'qa-app-users-edit.php';
require_once QA_INCLUDE_DIR.'db/blobs.php';

$response = qa_create_new_user('jango@gmail.com', 'password123', 'jango', QA_USER_LEVEL_BASIC, true);
var_dump($response);

?>

The problem of executing this file is that I am getting a fatal error. It says :

 

Fatal error: Call to undefined function qa_to_override() in ..[pathname]/qa-include/app/users-edit.php on line 155

Can any one tell me what I am doing wrong (I am pretty sure that I am doing something wrong since I am new.). Any kind of help will be appreciated from the bottom of my heart :)

 

Thank you.

Q2A version: 1.7.0

1 Answer

+1 vote
by
selected by
 
Best answer
It makes sense because you're trying to setup the whole Q2A environment manually. Although possible, it makes no sense to do that because there are easier ways :) Here are some snippets on how to do this: http://www.question2answer.org/external.php
by
Thank you. I got it :)
...