Create a new user profile after a valid registration.

@param  array  $data
@param  int    $userId
@return User
329763
protected function createSignup(array $data, $userId)
    {
        return Signup::create([
            'user_id' => $userId,
            'firstname' => $data['firstname'],
            'surname' => $data['surname'],
            'gender' => $data['gender'],
            'email' => $data['email'],
            'mobile_number' => $data['mobile_number'],
        ]);
    }
714988
public static function create($userId, $params = null, $options = null)
    {
        return self::_userBasedCreate($userId, $params, $options);
    }
1276346
public function createNew(array $authData, array $userData) {
        // first save the new user
        $userModel  = new Model_User();
        $userId     = $userModel->insert($userData);
        $userData   = $userModel->find($userId)->current();
        $authData['user_id'] = $userId;
        $this->insert($authData);

        $this->getObserver('Authenticatable')->updateLoginStats($userId);
        return $userData;
    }
974128
public function create($data)
	{
		$this->getResponse()
			->setStatusCode(Response::STATUS_CODE_201);
		
		$request = $this->getRequest();
		$content = $request->getContent();
		$content = !empty($content) ? Json::decode($content, Json::TYPE_ARRAY) : array();
		$post = array_merge_recursive(
			$request->getPost()->toArray(),
			$content
		);
		
		// Inject user data if connected checking if it is not the admin
		// write better this part, peraphs in some service or using doctrine
		$main = $this->getServiceLocator()->get('neobazaar.service.main');
		$userRepository = $main->getUserEntityRepository();
		if($this->zfcUserAuthentication()->hasIdentity()) {
			$identity = $this->zfcUserAuthentication()->getIdentity();
			$userModel = new UserModel($identity, $this->getServiceLocator());
			$classifiedId = 
				isset($post['document']) && isset($post['document']['id']) ? 
				$post['document']['id'] : 
				null;
			
			// Set identity values in any case!!
			$post['user'] = array (
				'email' => $identity->getEmail(),
				'name' => $identity->getName(),
				'id' => $userRepository->getEncryptedId($identity->getUserId())
			);
			
			// admin that want to edit other user classified, 
			// set the correct user to the data.
			if($userModel->isAdmin && null !== $classifiedId) {
				// must check if the classified owner is the admin
				$documentRepository = $main->getDocumentEntityRepository();
				$classified = $documentRepository->findByEncryptedId($classifiedId, 'documentId'); 
				if(null !== $classified) {
					if($classified->getUser()->getUserId() == $identity->getUserId()) {
						$name = $identity->getName();
						$post['user'] = array(
							'email' => $identity->getEmail(),
							'name' => strlen($name) > 2 ? $name : 'xx',
							'id' => $userRepository->getEncryptedId($identity->getUserId())
						);
					} else {
						$user = $userRepository->find($classified->getUser()->getUserId());
						$name = $user->getName();
						$post['user'] = array(
							'email' => $user->getEmail(),
							'name' => strlen($name) > 2 ? $name : 'xx',
							'id' => $userRepository->getEncryptedId($user->getUserId())
						);
					}
				}
			}
		}
		
		try {
			$classifiedService = $this->getServiceLocator()->get('document.service.classified');
			$document = $classifiedService->save($post);
			$data = array(
				'status' => 'success',
				'message' => $document->getDocumentId()
			);
		} catch(\Exception $e) {
			$this->getResponse()
				->setStatusCode(Response::STATUS_CODE_500);
			$data = @unserialize($e->getMessage());
			
			if(!is_array($data)) {
				$data = array(
					'status' => 'danger',
					'message' => $e->getMessage()
				);
			}
		}
		
		return new JsonModel($data);
	}
1358285
protected function processRetrievedData($userId, $data = []): array
    {
        $items = [];

        foreach ($data as $meta) {
            if (! $value = @\unserialize($meta->getAttribute('value'))) {
                $value = $meta->getAttribute('value');
            }

            $key = $meta->getAttribute('name');

            $this->addKey("{$key}/user-{$userId}", [
                'id' => $meta->getAttribute('id'),
                'value' => $value,
            ]);

            $items[$key] = $value;
        }

        return $items;
    }
1153078
public function create($data, $websiteId = null)
    {
        if (isset($websiteId)) {
            return $this->client()->put($data, 'websites/{websiteId}', ['websiteId' => $websiteId]);
        }

        return $this->client()->post($data, 'websites');
    }
981973
public function set($user_id, array $data)
    {
        $existing = $this->getList(array('user_id' => $user_id));

        if (isset($existing['dashboard_id'])) {
            return $this->update($existing['dashboard_id'], array('data' => $data));
        }

        return $this->add(array('user_id' => $user_id, 'data' => $data));
    }
338800
public function col_userid($data) {
        $user = $data->foruser;
        return html_writer::link($user->profileurl, $user->fullname, ['title' => get_string('viewprofile')]);
    }
543524
public function get_user($userid) {
        global $DB;

        if (empty(self::$cachedusers[$userid])) {
            $fields = get_all_user_name_fields(true);
            self::$cachedusers[$userid] = $DB->get_record('user', array('id' => $userid), 'id, ' . $fields);
        }
        return self::$cachedusers[$userid];
    }
1019774
public function updateMysqlUser($serverId, $userId, array $data)
    {
        return new MysqlUser(
            $this->put("servers/$serverId/mysql-users/$userId", $data)['user']
            + ['server_id' => $serverId], $this
        );
    }
235947
protected function create(array $data)
    {
        if (!isset($data['name']) || trim($data['name']) == '') {
            $data['name'] = $data['email'];
        }
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            ]);
        return $user;
    }
1000521
protected function create(array $data)
    {
        $fields = [
            'name'     => $data['name'],
            'email'    => $data['email'],
            'password' => bcrypt($data['password']),
        ];
        if (config('auth.providers.users.field', 'email') === 'username' && isset($data['username'])) {
            $fields['username'] = $data['username'];
        }
        return User::create($fields);
    }
1073057
public function createUserToken(array $data)
    {
        $userToken = new TokenEntity;

        $expires = Arr::get($data, 'expires') ?: strtotime('+1 day', time());

        $defaults = [
            'created' => time(),
            'expires' => $expires,
            'token'   => $userToken->generateToken(),
        ];

        $userToken = $userToken->exchangeArray(array_merge($defaults, $data));

        return $this->tokenMapper->persist($userToken);
    }
1206369
public function getById($userId, array $queryParams = [])
    {
        $response = $this->api->users()->getById($userId, $queryParams);

        return new UserResponse($response);
    }
1363680
public function createMysqlUser($serverId, array $data, $wait = true)
    {
        $user = $this->post("servers/$serverId/mysql-users", $data)['user'];

        if ($wait) {
            return $this->retry($this->getTimeout(), function () use ($serverId, $user) {
                $user = $this->mysqlUser($serverId, $user['id']);

                return $user->status == 'installed' ? $user : null;
            });
        }

        return new MysqlUser($user + ['server_id' => $serverId], $this);
    }
1296857
public static function createNew(
        string $userName,
        int $sourceId,
        string $collectionName,
        array $data,
        Auth $auth
    ) {
        return static::getInstance()
            ->createNew($sourceId, $collectionName, $data);
    }
479107
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['username'])) {
            $self->setUsername($data['username']);
        }
        if (isset($data['name'])) {
            $self->setName($data['name']);
        }

        return $self;
    }