Grab the revenue value from the event tags. "revenue" is a reserved keyword.

@param  $userProfileMap array Representing the user profile.
@return true if the given user profile map is valid, false otherwise.
179347
public static function isValidUserProfileMap($userProfileMap)
    {
        if (!is_array($userProfileMap)) {
            return false;
        }

        if (!isset($userProfileMap[self::USER_ID_KEY])) {
            return false;
        }

        if (!isset($userProfileMap[self::EXPERIMENT_BUCKET_MAP_KEY])) {
            return false;
        }

        if (!is_array($userProfileMap[self::EXPERIMENT_BUCKET_MAP_KEY])) {
            return false;
        }

        // validate the experiment bucket map
        $experimentBucketMap = $userProfileMap[self::EXPERIMENT_BUCKET_MAP_KEY];
        foreach ($experimentBucketMap as $experimentId => $decision) {
            if (!is_array($decision)) {
                return false;
            }

            // make sure that there is a variation ID property in every decision
            if (!isset($decision[self::VARIATION_ID_KEY])) {
                return false;
            }
        }

        // Looks good to me
        return true;
    }
552036
public function view(UserPolicy $user, Tag $tag)
    {
        if ($user->canDo('news.tag.view') && $user->isAdmin()) {
            return true;
        }

        return $tag->user_id == user_id() && $tag->user_type == user_type();
    }
889760
public function getUser($credentials, UserProviderInterface $userProvider)
    {
        if (isset($credentials[$this->username_attribute])) {
            return $userProvider->loadUserByUsername($credentials[$this->username_attribute]);
        } else {
            return null;
        }
    }
211811
public function isFeatureEnabled($featureFlagKey, $userId, $attributes = null)
    {
        if (!$this->_isValid) {
            $this->_logger->log(Logger::ERROR, "Datafile has invalid format. Failing '".__FUNCTION__."'.");
            return false;
        }

        if (!$this->validateInputs(
            [
                self::FEATURE_FLAG_KEY =>$featureFlagKey,
                self::USER_ID => $userId
            ]
        )
        ) {
            return false;
        }

        $featureFlag = $this->_config->getFeatureFlagFromKey($featureFlagKey);
        if ($featureFlag && (!$featureFlag->getId())) {
            // Error logged in ProjectConfig - getFeatureFlagFromKey
            return false;
        }

        //validate feature flag
        if (!Validator::isFeatureFlagValid($this->_config, $featureFlag)) {
            return false;
        }

        $featureEnabled = false;
        $decision = $this->_decisionService->getVariationForFeature($featureFlag, $userId, $attributes);
        $variation = $decision->getVariation();
        if ($variation) {
            $experiment = $decision->getExperiment();
            $featureEnabled = $variation->getFeatureEnabled();
            if ($decision->getSource() == FeatureDecision::DECISION_SOURCE_FEATURE_TEST) {
                $experimentKey = $experiment->getKey();
                $variationKey = $variation->getKey();
                $sourceInfo = (object) array(
                    'experimentKey'=> $experimentKey,
                    'variationKey'=> $variationKey
                );

                $this->sendImpressionEvent($experimentKey, $variationKey, $userId, $attributes);
            } else {
                $this->_logger->log(Logger::INFO, "The user '{$userId}' is not being experimented on Feature Flag '{$featureFlagKey}'.");
            }
        }

        $attributes = is_null($attributes) ? [] : $attributes;
        $this->notificationCenter->sendNotifications(
            NotificationType::DECISION,
            array(
                DecisionNotificationTypes::FEATURE,
                $userId,
                $attributes,
                (object) array(
                    'featureKey'=>$featureFlagKey,
                    'featureEnabled'=> $featureEnabled,
                    'source'=> $decision->getSource(),
                    'sourceInfo'=> isset($sourceInfo) ? $sourceInfo : (object) array()
                )
            )
        );

        if ($featureEnabled == true) {
            $this->_logger->log(Logger::INFO, "Feature Flag '{$featureFlagKey}' is enabled for user '{$userId}'.");
            return $featureEnabled;
        }

        $this->_logger->log(Logger::INFO, "Feature Flag '{$featureFlagKey}' is not enabled for user '{$userId}'.");
        return false;
    }
309349
public function loadUser($user) {
        global $DB;

        $userid = $user->getRecordId();
        $fields = 'id, resourcelinkid, ltiuserkey, ltiresultsourcedid, created, updated';
        if (!empty($userid)) {
            $row = $DB->get_record($this->userresulttable, ['id' => $userid], $fields);
        } else {
            $resourcelinkid = $user->getResourceLink()->getRecordId();
            $userid = $user->getId(ToolProvider\ToolProvider::ID_SCOPE_ID_ONLY);
            $row = $DB->get_record_select(
                $this->userresulttable,
                "resourcelinkid = ? AND ltiuserkey = ?",
                [$resourcelinkid, $userid],
                $fields
            );
        }
        if ($row) {
            $user->setRecordId($row->id);
            $user->setResourceLinkId($row->resourcelinkid);
            $user->ltiUserId = $row->ltiuserkey;
            $user->ltiResultSourcedId = $row->ltiresultsourcedid;
            $user->created = $row->created;
            $user->updated = $row->updated;
            return true;
        }

        return false;
    }
357325
public function refreshProfile(array $userProfile = [])
    {
        if (count($userProfile) == 0) {
            $userProfile = $this->getProfileFromApi();
        }

        $success = false;

        if (is_array($userProfile)) {
            $info = $this->mapPropertiesFromApi($userProfile);

            $this->grantAllPermissions();
            $success = $this->set($info);
            $this->enforcePermissions();
        }

        return $success;
    }
357682
public static function validateUser($userinfo)
	{
		$plugins = Factory::getPlugins();

		foreach($plugins as $plugin) {
			$user = Factory::getUser($plugin->name);
			if (!$user->validateUser($userinfo)) {
				throw new \RuntimeException('unknown validation: ' . $plugin->name);
			}
		}
		return true;
	}
133281
public function ensureDefaultUserValues(array $values, \Gems_User_UserDefinitionInterface $definition, $defName = null)
    {
        if (! isset($values['user_active'])) {
            $values['user_active'] = true;
        }
        if (! isset($values['user_staff'])) {
            $values['user_staff'] = $definition->isStaff();
        }
        if (! isset($values['user_resetkey_valid'])) {
            $values['user_resetkey_valid'] = false;
        }
        if (! isset($values['user_two_factor_key'])) {
            $values['user_two_factor_key'] = null;
        }
        if (! isset($values['user_enable_2factor'])) {
            $values['user_enable_2factor'] = null;
        }


        if ($defName) {
            $values['__user_definition'] = $defName;
        }

        return $values;
    }
133823
private function isUserProfileUpdateRequested(UserUpdateStruct $userUpdateStruct)
    {
        return
            !empty($userUpdateStruct->contentUpdateStruct) ||
            !empty($userUpdateStruct->contentMetadataUpdateStruct) ||
            !empty($userUpdateStruct->email) ||
            !empty($userUpdateStruct->enabled) ||
            !empty($userUpdateStruct->maxLogin);
    }
683964
public function scopeForUser(Builder $query, $userId)
    {
        $participantsTable = Models::table('participants');
        $threadsTable = Models::table('threads');

        return $query->join($participantsTable, $this->getQualifiedKeyName(), '=', $participantsTable . '.thread_id')
            ->where($participantsTable . '.user_id', $userId)
            ->where($participantsTable . '.deleted_at', null)
            ->select($threadsTable . '.*');
    }
1095431
public function isChildOf($user_id, $fk) {
        if (!$user_id || !$fk) {
            return false;
        }

        try {
            $aros = $this->node(array(
                'model' => USER_MODEL,
                'foreign_key' => $user_id
            ));
        } catch (Exception $e) {
            return false;
        }

        if ($aros) {
            foreach ($aros as $aro) {
                if (is_string($fk) && $aro['RequestObject']['alias'] == $fk) {
                    return true;
                } else if (is_numeric($fk) && $aro['RequestObject']['id'] == $fk) {
                    return true;
                }
            }
        }

        return false;
    }
156911
public function checkAccess($userId, $permissionName)
    {
        if (ValidatorHelper::isInteger($userId) == false) {
            throw new InvalidArgumentException('User identifier must be number.');
        }

        /** @var integer $permissionId */
        $permissionId = $this->repositoryRegistry
            ->getPermissionRepository()
            ->getPermissionIdByName($permissionName);

        if (ValidatorHelper::isInteger($permissionId)) {

            /** @var integer[] $rootRoleIds */
            $rootRoleIds = $this->repositoryRegistry
                ->getUserRoleRepository()
                ->getUserRoleIds($userId);

            if (count($rootRoleIds) > 0) {

                /** @var integer[] $allRoleIds */
                $allRoleIds = $this->repositoryRegistry
                    ->getRoleHierarchyRepository()
                    ->getAllRoleIdsHierarchy($rootRoleIds);

                return $this->repositoryRegistry
                    ->getRolePermissionRepository()
                    ->isPermissionAssigned($permissionId, $allRoleIds);
            }
        }

        return false;
    }
892009
public static function convertUserProfileToMap($userProfile)
    {
        $userProfileMap = array(
            self::USER_ID_KEY => $userProfile->getUserId(),
            self::EXPERIMENT_BUCKET_MAP_KEY => array()
        );
        $experimentBucketMap = $userProfile->getExperimentBucketMap();
        foreach ($experimentBucketMap as $experimentId => $decision) {
            $userProfileMap[self::EXPERIMENT_BUCKET_MAP_KEY][$experimentId] = array(
                    self::VARIATION_ID_KEY => $decision->getVariationId()
                );
        }
        return $userProfileMap;
    }
409361
public function register(UserInterface $user, RegisterInfoInterface $registerInfo) {
		
		$database_profile = $this->socialProfileRepository->findByUserAndProvider($user, 'UserProfile');
		if($database_profile === null) {
			$profile = $registerInfo->getProfile();
			
			$this->copyProfileToDatabase($user, $profile);
			
		}
	}
578058
public function isIgnoring($user_id)
    {
        if ((new Query)->select('id')->from('{{%podium_user_ignore}}')->where([
                'user_id' => $this->id,
                'ignored_id' => $user_id
            ])->exists()) {
            return true;
        }
        return false;
    }
404152
public function userGet(int $user_id)
    {
        $value = get_user_meta($user_id, $this->getName(), true);

        if (! empty($value)) {
            $this->setValue($value);
        }
    }
1080470
private function getCustomerData(UserProfile $profile)
    {
        $customerData = [];
        foreach (['firstName', 'lastName', 'email'] as $field) {
            $data = $profile->{$field};
            $customerData[strtolower($field)] = $data !== null ? $data : '-';
        }
        return $customerData;
    }