Skip to content

Custom properties of the current user's profile #4905

Answered by leigh-pointer
pnicosia80 asked this question in Q&A
Discussion options

You must be logged in to vote

@pnicosia80
you will need to inject a couple of services

@inject IUserService UserService
@inject IProfileService ProfileService

in code declare

private List<Profile> profiles;
private Dictionary<string, string> settings;

in your OnInitializedAsync() method you can poputlate the declared variables

profiles = await ProfileService.GetProfilesAsync(ModuleState.SiteId);
settings = await SettingService.GetUserSettingsAsync(PageState.User.UserId);

You can extract the Profile values from the settings using this function

    private string GetProfileValue(string SettingName, string DefaultValue)
    {
        string value = SettingService.GetSetting(settings, SettingName, DefaultValue);
      …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@pnicosia80
Comment options

Answer selected by pnicosia80
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants