The human verification is disabled in the setting. Now, can someone please look at this and tell my why this is not writing the user to the database? Nothing is being saved to the database.
PHP Code:
<?php
//init the vBulletin system
require_once( '/forum/core/vb/vb.php' );
vB::init();
// Connection
$admin = 'superadmin';
$api = init_api( $admin );
function init_api( $admin ) {
define( "CSRF_PROTECTION", false );
require_once( '/forum/includes/vb5/autoloader.php' );
vB5_Autoloader::register( '/forum' );
vB5_Frontend_Application::init( 'config.php' );
vB::getDbAssertor()->delete( "session", array( "sessionhash" => vB::getCurrentSession()->get( "dbsessionhash" ) ) );
$username = vB_String::htmlSpecialCharsUni( $admin );
$userinfo = vB::getDbAssertor()->getRow( "user", array( "username" => $username ) );
$auth = array_intersect_key( $userinfo, array_flip( [ "userid", "secret", "lastvisit", "lastactivity" ] ) );
$loginInfo = vB_User::processNewLogin( $auth );
vB5_Auth::setLoginCookies( $loginInfo, "", false );
$api = Api_InterfaceAbstract::instance();
return $api;
}
//get user info
$username = $_POST[ 'form' ][ 'username' ];
$email = $_POST[ 'form' ][ 'email' ];
$password = $_POST[ 'form' ][ 'password' ];
$data = array(
'userid' => 0,
'password' => $password,
'user' => array( 'username' => $username, 'email' => $email ),
array(),
array(),
'userfield' => false,
array(),
'',
array( 'registration' => true )
);
$response = $api->callApi( 'user', 'save', $data, false, true );
?>