Get the URL of the concrete5 account associated to a user.

@param \Concrete\Core\User\User|\Concrete\Core\User\UserInfo|\Concrete\Core\Entity\User\User|int $user

@return string|null Returns null if the user is not bound to a concrete5 account.
15993
public function getConcrete5ProfileURL($user)
    {
        $result = null;
        $binding = $this->getBindingForUser($user);
        if ($binding !== null) {
            $concrete5UserID = (int) $binding;
            if ($concrete5UserID !== 0) {
                $result = "https://www.concrete5.org/profile/-/view/$concrete5UserID/";
            }
        }

        return $result;
    }
70283
public function getLastPinsFromUser($user)
  {
    $pins = array();
    libxml_use_internal_errors(true);
    $xml = @simplexml_load_file('https://www.pinterest.com/'.$user.'/feed.rss');
    if($xml !== false) {
      for($i = 0; $i < 50; $i++) {
        if(!isset($xml->channel->item[$i])) {
          break;
        }
        $datas = array();
        $tags = array();
        preg_match ('/<img src=\"(?<media>.+?)\"><\/a><\/p><p>(?<text>.+?)<\/p>/', $xml->channel->item[$i]->description, $datas);
        preg_match_all('/(?<=#)\w+/', $datas['text'], $tags);
        $pins[] = array(
          'url'       => $xml->channel->item[$i]->link->asXML(),
          'media'     => $datas['media'],
          'text'      => $datas['text'],
          'tags'      => $tags[0],
          'timestamp' => strtotime($xml->channel->item[$i]->pubDate)
        );
      }
      return $pins;
    } else {
      $error = libxml_get_last_error();
      return $this->debug_mode && $error ? $error->message : null;
    }
  }
361846
public function getSettingsByUser($user)
    {
        $userId = $user;
        $userEntity = null;
        if ($user instanceof EntityInterface) {
            $userId = $user->getId();
            $userEntity = $user;
        }
        if (isset($this->settingsByUser[$userId])) {
            return $this->settingsByUser[$user];
        }
        if (empty($userEntity)) {
            $UserRepository = $this->getUserRepository();
            $userEntity = $UserRepository->find($userId);
        }
        
        if (isset($userEntity)) {
            $settingsData = $userEntity->getSettings();
            $this->settingsByUser[$userId] = new SettingsEntity($this);
            $this->settingsByUser[$userId]->setData($settingsData)->spawnAsEntities();
            return $this->settingsByUser[$userId];
        }
        return null;
    }
443463
public function getActivation($user)
    {

        return DB::table($this->table)->where('user_id', $user->id)->first();
    }
34361
protected function mod_login($user)
    {
        $login_lc = $this->rc->config->get('login_lc');

        if ($login_lc === true || $login_lc == 2) {
            $user = mb_strtolower($user);
        }
        // lowercase domain name
        else if ($login_lc && strpos($user, '@')) {
            list($local, $domain) = explode('@', $user);
            $user = $local . '@' . mb_strtolower($domain);
        }

        return $user;
    }
1339742
protected function getLoginRedirect(array $user)
    {
        $redirect = "account/{$user['user_id']}";

        if (!empty($user['role_redirect'])) {
            $redirect = $user['role_redirect'];
        }

        if ($this->user->isSuperadmin($user['user_id'])) {
            $redirect = 'admin';
        }

        return $redirect;
    }
428215
public function findDraft($user)
    {
        if ($user instanceof UserInterface) {
            $user = $user->getId();
        }

        return $this->findOneDraftBy(['user' => $user]);
    }
1199397
public static function maybe_switch_url( WP_User $user ) {
		$old_user = self::get_old_user();

		if ( $old_user && ( $old_user->ID === $user->ID ) ) {
			return self::switch_back_url( $old_user );
		} elseif ( current_user_can( 'switch_to_user', $user->ID ) ) {
			return self::switch_to_url( $user );
		} else {
			return false;
		}
	}
1247073
public function currentVotesByUser($user = null) {
		if (!$user) {
			$user = $this->securityContext->getMember();
		}
		$votes = MicroPostVote::get()->filter(array('UserID' => $user->ID, 'PostID' => $this->ID));
		return $votes->toArray();
	}
1041244
public function lookupNorthstarUser($user)
  {
    $northstarAPIConfig = $this->mbConfig->getProperty('northstar_config');
    if (empty($northstarAPIConfig['host'])) {
      throw new Exception('MB_Toolbox->lookupNorthstarUser() northstar_config missing host setting.');
    }

    $northstarUrl =  $northstarAPIConfig['host'];

    // Append port if exists.
    if (!empty($northstarAPIConfig['port'])) {
      $port = (int) $northstarAPIConfig['port'];
      // Port is within allowed range:
      // https://en.wikipedia.org/wiki/Port_(computer_networking)#Details
      if ($port > 0 && $port < 65536) {
        $northstarUrl .= ':' . $port;
      }
    }

    // Api version.
    $northstarUrl .= '/' . self::NORTHSTAR_API_VERSION . '/';

    // Lookup by email.
    if (!empty($user->email)) {
      $endpoint = $northstarUrl . 'users/email/' . $user->email;
      $result = $this->mbToolboxcURL->curlGet($endpoint);

      try {
        $northstarUser = $this->parseNorthstarUserResponse($result);
        echo '- User loaded from Northstar by email: '
          . $user->email . PHP_EOL;
        return $northstarUser;
      } catch (Exception $e) {
        echo '- Coundn\'t load user from Northstar by email: '
          . $user->email . PHP_EOL;
      }
    }

    // Lookup by phone.
    if (!empty($user->mobile)) {
      $endpoint = $northstarUrl . 'users/mobile/' . $user->mobile;
      $result = $this->mbToolboxcURL->curlGet($endpoint);

      try {
        $northstarUser = $this->parseNorthstarUserResponse($result);
        echo '- User loaded from Northstar by mobile: '
          . $user->mobile . PHP_EOL;
        return $northstarUser;
      } catch (Exception $e) {
        echo '- Coundn\'t load user from Northstar by mobile: '
          . $user->mobile . PHP_EOL;
      }
    }

    return false;
  }
1175913
protected function getUserInformation($user = null)
    {
        // Defaults
        if (is_null($user)) {
            return [
                'name' => 'Guest',
                'user' => ['guest' => true],
            ];
        }

        // The default auth identifer is the ID number, which isn't all that
        // useful. Try username and email.
        $identifier = $user->getAuthIdentifier();
        if (is_numeric($identifier)) {
            try {
                if ($user->username) {
                    $identifier = $user->username;
                } elseif ($user->email) {
                    $identifier = $user->email;
                }
            } catch (\Exception $e) {
            }
        }

        return [
            'name' => $identifier,
            'user' => $user instanceof Arrayable ? $user->toArray() : $user,
        ];
    }
328804
private function getUserFullName($user)
    {
        $strReturn = '';
        if ($user && method_exists($user, 'getContact')) {
            $strReturn = $user->getContact()->getFirstName() . ' ' . $user->getContact()->getLastName();
        }

        return $strReturn;
    }
470491
private function resolveProfilePictureField(ApiUser $user): ?Field
    {
        $contentType = $user->getContentType();
        foreach ($user->getFields() as $field) {
            $fieldDef = $contentType->getFieldDefinition($field->fieldDefIdentifier);

            if ('ezimage' === $fieldDef->fieldTypeIdentifier) {
                return $field;
            }
        }

        return null;
    }
1129072
public final function withUserInfo($user, $password = null): UriInterface
   {
       return $this->with(
           "user",
           $user . ($password ? static::HOST_SEPARATOR . $password: ""));
   }
195246
public static function getRecent($user)
    {
        $records = static::where('user_id', $user->id)
            ->orderBy('created_at', 'desc')
            ->limit(2)
            ->get()
        ;

        if (!count($records)) {
            return null;
        }

        $first = $records->first();

        return !$first->created_at->isToday() ? $first : $records->pop();
    }
1314007
protected function GroupsFormUrl(User $user)
    {
        $args = array('user'=>$user->GetID());
        return BackendRouter::ModuleUrl(new UsergroupAssignmentForm(), $args);
    }
732972
public static function getNonBlameds($user = null)
    {
        $noInit = static::buildNoInitModel();
        /* @var $noInit static */
        $createdByAttribute = $noInit->createdByAttribute;
        if (!$user) {
            $user = \Yii::$app->user->identity;
        }
        $cond = [
            $createdByAttribute => $user->getGUID(),
            $noInit->multiBlamesAttribute => ''
        ];
        return static::find()->where($cond)->all();
    }