Loads a user from the database
@param integer $user_id
353010
protected function setUserCheckout($user_id)
    {
        $this->data_user = array();

        if (!is_numeric($user_id)) {
            $this->outputHttpStatus(403);
        }

        $this->data_user = $this->user->get($user_id);

        if (empty($this->data_user['status'])) {
            $this->outputHttpStatus(404);
        }

        $this->order_user_id = $user_id;
        $this->order_store_id = $this->data_user['store_id'];
    }
156721
public function load($id)
    {

        // if not, try to load the customer with the passed entity ID
        $this->customerAddressStmt->execute(array(MemberNames::ENTITY_ID => $id));
        return $this->customerAddressStmt->fetch(\PDO::FETCH_ASSOC);
    }
1014575
private function load($id = null)
    {

        $this->initialize();
        $this->id = $id;
        return $this->getDataConnector()->loadContext($this);

    }
937156
def get_user_by_id(self, id):
        """"""
        return self.db_adapter.get_object(self.UserClass, id=id)
1226586
public function loadByLoginName(string $login_name): ?UserInterface
    {
        if(array_key_exists($login_name, $this->users)){
            return $this->convertUser($this->users[$login_name]);
        }

        return null;
    }
1266850
public static function find_by_user_id($user_id = null)
	{
		if (empty($user_id))
		{
			return false;
		}

		$l = self::blank()->getTableName();
		$d = Domain::blank()->getTableName();

		$results = self::all()
			->select($l . '.*')
			->select($d . '.authenticator', 'auth_domain_name')
			->join($d, $d . '.id', $l . '.auth_domain_id', 'inner')
			->whereEquals($l . '.user_id', $user_id)
			->rows();

		if (empty($results))
		{
			return false;
		}

		return $results->toArray();
	}
718255
private function _mysql_load($user)
	{
		$db = \App::get('db');

		if (empty($user))
		{
			$this->setError('No user specified');
			return false;
		}

		// zooley: Removed check for >= 0 because profiles without acounts have negative IDs
		//if (is_numeric($user) && $user >= 0)
		if (is_numeric($user))
		{
			$query = "SELECT * FROM `#__xprofiles` WHERE uidNumber = " . $db->quote(intval($user)) . ";";
		}
		else
		{
			$query = "SELECT * FROM `#__xprofiles` WHERE username = " . $db->quote($user) . " AND uidNumber>0;";
		}

		$db->setQuery($query);

		$result = $db->loadAssoc();

		if ($result === false)
		{
			$this->setError('Error retrieving data from xprofiles table: ' . $db->getErrorMsg());
			return false;
		}

		if (empty($result))
		{
			$this->setError('No such user [' . $user . ']');
			return false;
		}

		$this->clear();

		$this->_params = new Registry($result['params']);

		foreach ($result as $property => $value)
		{
			$this->set($property, $value);
		}

		$classvars = get_class_vars(__CLASS__);

		foreach ($classvars as $property => $value)
		{
			if ('_auxv_' == substr($property, 0, 6) || '_auxs_' == substr($property, 0, 6))
			{
				$this->$property = false; // This property is loaded on demand
			}
		}

		$this->_params->merge($this->params);

		return true;
	}
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];
    }
1013229
public function loadPoliciesByUserId($userId)
    {
        try {
            return $this->innerGateway->loadPoliciesByUserId($userId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1322328
public function getClientUser($client_id, $user_id)
    {
        $sql = 'SELECT * from %s where client_id = :client_id and user_id = :user_id';
        $sql = sprintf($sql, $this->config['client_user_table']);

        return $this->fetch($sql, compact('client_id', 'user_id'));
    }
746078
public function authRoleUserDelete($user_id){
        self::where(['user_id'=>$user_id])->delete();
        AuthAccess::where(['role_id'=>$user_id,'type'=>'admin'])->delete();
    }
491631
public static function getCredential($user_id)
    {
        $sql = new Pluf_SQL('login=%s', array(
            $user_id
        ));
        return Pluf::factory('User_Account')->getOne($sql->gen());
    }
242150
public function findUser ($userId) {
    $query = $this->database->pdo->prepare('SELECT username, points FROM users WHERE userId = :userId');
    $query->bindParam(':userId', $userId);

    $query->execute();
    return (object) $query->fetch(PDO::FETCH_ASSOC);
  }
181238
public function getByUser($product_id, $user_id)
    {
        $result = null;
        $this->hook->attach('rating.get.user.before', $product_id, $user_id, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $user_ids = (array) $user_id;
        $conditions = array_merge($user_ids, array($product_id));
        $placeholders = rtrim(str_repeat('?,', count($user_ids)), ',');

        $sql = "SELECT * FROM rating_user WHERE user_id IN($placeholders) AND product_id=?";

        $result = $this->db->fetchAll($sql, $conditions, array('index' => 'user_id'));

        if (!is_array($user_id) && isset($result[$user_id])) {
            $result = $result[$user_id];
        }

        $this->hook->attach('rating.get.user.after', $product_id, $user_id, $result, $this);
        return $result;
    }
879716
public function canDelete($user_id)
    {
        if ($this->isSuperadmin($user_id)) {
            return false;
        }

        $result = $this->db->fetchColumn('SELECT * FROM orders WHERE user_id=?', array($user_id));
        return empty($result);
    }
301650
public static function create($user_id) {
	$text  = bootstrap::get_library('text');
	$mysql = bootstrap::get_library('mysql');
	
	$new_token  = $text::generate_token(self::TOKEN_LENGTH);
	$expiration = (time() + self::EXPIRATION);
	
	$sql   = "INSERT INTO `login_tokens` SET `code` = '%s', `user_id` = %d, `expire_at` = %d;";
	$binds = [$new_token, $user_id, $expiration];
	$mysql::query($sql, $binds);
	
	return new static($mysql::$insert_id);
}
293124
public function isOnline(int $user_id): bool
    {
        if (isset($this->_online_status_cached[$user_id])) {
            return $this->_online_status_cached[$user_id];
        }

        // Check session for current user exists
        $sessions = new UsersSessionEntityRepository();
        $sessions->setWhereUserId($user_id);
        $sessions->setLimit(1);
        $sessions->addWhereFieldIsHigher('ts', (NOW - 120)); // 2 minutes

        return $this->_online_status_cached[$user_id] = $sessions->hasAnyObjectInCollection();
    }