Import users with importer Concrete 5.5.0

Permalink 1 user found helpful
Just put the following function in your importer.php script and u have the possibility to import users with attributes. Works only for Concrete 5.5.0. Don't forget to call the function in the construct!

protected function importUsers(SimpleXMLElement $sx) {
      if (isset($sx->users)) {
         $nodes = array();
         foreach($sx->users->user as $p) {
            $nodes[] = $p;
         }
         usort($nodes, array('ContentImporter', 'setupPageNodeOrder'));
         Loader::model('attribute/type');
         Loader::model('attribute/categories/user');
         foreach($nodes as $px) {
            $args = array();
            $args['uName'] = $px['username'];
            $args['uEmail'] = $px['username'];
            $args['uPassword'] = $px['password'];
            $args['uPasswordConfirm'] = $px['password'];

brianvandelden
 
jshannon replied on at Permalink Reply
jshannon
Useful. Thanks for sharing.

Just not so sure about the
$u = new User($px['username'], $px['password']);


line.

I BELIEVE that that actually logs the user in, thus logging you out.

I would imagine that you can get a uID or a UserInfo from the ::register() function, and then be able to do User::getByID().

James