Try Now
More in this section

Forums / Developing with Sitefinity / UserProfileManager.GetUserProfile returns null

UserProfileManager.GetUserProfile returns null

1 posts, 0 answered
  1. Jeremy
    Jeremy avatar
    10 posts
    13 May 2015
    22 Nov 2015
    Link to this post

    In the following code, the function getUserProfile was returning null.

    private static UserProfile GetUserProfile(User user = null) {

                UserProfileManager profileManager = UserProfileManager.GetManager();

                if (user == null) {
                    UserManager userManager = UserManager.GetManager();
                    user = userManager.GetUser(SecurityManager.CurrentUserId);
                SitefinityProfile profile = null;
                if (user != null) {
                    profile = profileManager.GetUserProfile<SitefinityProfile>(user);
                return profile;

    It returned null, because the user created in sitefinity did not have any data in some required fields (first name, last name, phone # - which I made as a required custom field). 

    If anyone in the future is creating front end crud for users, I hope this information helps them.

1 posts, 0 answered