1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Failed User Imports

Discussion in 'Resolved Bug Reports' started by Valhalla, Feb 17, 2014.

  1. Valhalla

    Valhalla Well-Known Member

    I'm attempting to run the Importer coming from MyBB 1.6.

    At the end of the user import stage, I get told "The following users could not be imported due to errors". It then lists about seven users who it was unable to import (I assume due to characters in their username, like commas). But I am not given any option to offer an alternative username.

    I saw a similar thread, here, which suggested there should be a text box for me to correct them, but I cannot see this. I don't think there is one in my case (I checked using Inspect Element). The only option, at the end of the list of usernames, is "Import Users".
  2. Chris D

    Chris D XenForo Developer Staff Member

    Easiest solution is to change the usernames beforehand.

    Usernames containing commas in XenForo aren't valid (due to situations where commas are used as a delimiter, e.g. sending a conversation to multiple users).
    Valhalla likes this.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I think you found a bug. Looking at the code I can see a problem which explains why the text field for the username doesn't show in the MyBB importer.


    Change the red piece to the word 'failure' instead of 'conflict'.

    	public function stepUsersFailed($start, array $options)
    		$sDb = $this->_sourceDb;
    		$manual = $this->_session->getExtraData('userFailed');
    		if ($manual)
    			$users = $this->_sourceDb->fetchAll($this->_getSelectUserSql('users.uid IN (' . $sDb->quote(array_keys($manual)) . ')'));
    			$resolve = $this->_controller->getInput()->filterSingle('resolve', XenForo_Input::ARRAY_SIMPLE);
    			if ($resolve && !empty($options['shownForm']))
    				$this->_resolveUserConflicts($users, $resolve);
    				// prevents infinite loop if redirected back to step
    				$options['shownForm'] = true;
    				$this->_session->setStepInfo(0, $options);
    				$failedUsers = array();
    				foreach ($users AS $user)
    					$failedUsers[$user['uid']] = array(
    						'username' => $this->_convertToUtf8($user['username'], true),
    						'email' => $this->_convertToUtf8($user['email'], true),
    						'message_count' => $user['postnum'],
    						'register_date' => $user['regdate'],
    						'conflict' => $manual[$user['uid']]
    				return $this->_controller->responseView(
    					'XenForo_ViewAdmin_Import_FailedUsers', 'import_failed_users', array('users' => $failedUsers)
    		return $this->_getNextUserStep();
    Then run the import again. That should fix the problem.

    Moving to bugs.
    Jay, Claudio, Valhalla and 1 other person like this.
  4. Valhalla

    Valhalla Well-Known Member

    Thanks, I made that changed and it worked. I think I will modify the usernames beforehand though, just to be sure.
  5. Mike

    Mike XenForo Developer Staff Member

    This appears to be specific to the MyBB importer -- the others are fine. But good catch and fix, Jake.
    Jay and Claudio like this.
  6. gunnerit

    gunnerit New Member

    I met the same error when import VBB 4.x. How to fix it?
  7. Chris D

    Chris D XenForo Developer Staff Member

    gunnerit and Amaury like this.

Share This Page