How do I get the current user’s profile in a custom controller file?
I tried:
$profile = Profile();
$profile = Container(“user.profile”);
none of these seem to work…
How do I get the current user’s profile in a custom controller file?
I tried:
$profile = Profile();
$profile = Container(“user.profile”);
none of these seem to work…
$profile should have value, you may check by var_dump().I figured it out:
if (IsLoggedIn() && !IsSysAdmin()) {
$userName = $this->security->currentUserName();
$user = UserRepository()->loadUserByIdentifier($userName);
$profile = Profile()->setUser($user);
...
Using v2025.12. Thanks!