Need to call class to add user outside concrete5


I trying to add a user from other php system to my other concrete5 site, but I can't to do.
In the other system I have a form to add users in this system and need to add at the same time, in the concrete5 site. But when I use the class to add user, the logs said that don't found the class in the path of my other system.
The question is, how add the path or how to give the correct instruction in my other php, to use the class of concrete5?

To proof, I do a single php file, with this:

namespace Concrete\Core\User;
use Concrete\Core\User\UserInfo;
use Concrete\Core\Foundation\Object;
use Loader;
use Config;
use Database;
use User;
use UserInfo as CoreUserInfo;
use Request;
use Concrete\Core\Authentication\AuthenticationType;
use Events;
use Page;
use GroupList;
use Session;
use Hautelook\Phpass\PasswordHash;
use Concrete\Core\Permission\Access\Entity\Entity as PermissionAccessEntity;
use Core;
use Group;
use \Concrete\Core\User\Point\Action\Action as UserPointAction;
use View;
$userData['uName'] = 'xxxxxxxx';
$userData['uEmail'] = [email protected]';
$userData['uPassword'] = 'xxxxxxx';

$ui = UserInfo::register($userData);

But I receive this message -->

PHP Fatal error: Class 'Concrete\Core\User\UserInfo' not found in /home4/markexf4/public_html/multilevel/whouser.php on line 36


Any can help me?


View Replies:
johandalabacka replied on at Permalink Reply
Just write it like this

# DIR_BASE should point to base of your installation
define('DIR_BASE', '/var/www/html'); 
define('C5_ENVIRONMENT_ONLY', true);
include(DIR_BASE . '/index.php');
use Concrete\Core\User\UserInfo;
$userData['uName'] = 'test';
$userData['uEmail'] = [email protected]';
$userData['uPassword'] = 'test123';
$ui = UserInfo::register($userData);

See this howto: