There are more than one user profile of type

Posted by Community Admin on 04-Aug-2018 16:46

There are more than one user profile of type

All Replies

Posted by Community Admin on 04-May-2011 00:00

Messed around with the profile types in 4.1 now I keep getting this error when on the 'Pages' Tab. Users tab doesn't load anything

There are more than one user profile of type: "Telerik.Sitefinity.Security.Model.SitefinityProfile" for the user with Id: "fdd59712-80c4-404e-af0f-6125d916dc37"
   

Posted by Community Admin on 09-May-2011 00:00

Hello Kristian,

I suppose you created a custom profile type and added some users of that type. Then using the Users widget on a page nothing is displayed. I hope i understood your description right.
There are some problems with custom profile types and we suggest using the basic profile type and extending it with custom fields to avoid  this.

Regards,
Stanislav Velikov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 18-Sep-2012 00:00

Was this ever resolved? I'm running 5.1 and have added some custom fields to the Basic Profile type. It works locally on my laptop but when I deployed to our dev server I get the same error.

Jeff

Posted by Community Admin on 18-Sep-2012 00:00

Was this ever resolved? I'm running 5.1 and have added some custom fields to the Basic Profile type. It works locally on my laptop but when I deployed to our dev server I get the same error.

Jeff

Posted by Community Admin on 27-Nov-2012 00:00

Same issue, now my list of users on the back-end won't even load (10 minutes, spinning spinning spinning).  Any resolution for this?  

Posted by Community Admin on 30-Nov-2012 00:00

Hello,

The duplicated profile for the user with ID: fdd59712-80c4-404e-af0f-6125d916dc37 can be removed with this API

UserProfileManager profileManager = UserProfileManager.GetManager();
           UserManager userManager = UserManager.GetManager();
           Guid userId =  new Guid("fdd59712-80c4-404e-af0f-6125d916dc37");
           User user = userManager.GetUser(userId);
  
        
            SitefinityProfile profile = profileManager.GetUserProfile<SitefinityProfile>(user);
  
            profileManager.Delete(profile);
  
            profileManager.SaveChanges();
            SitefinityProfile profile2 = profileManager.GetUserProfile<SitefinityProfile>(user);
            if(profile2 != null)
            
                profileManager.Delete(profile);
                profileManager.SaveChanges();
            
This will delete the original user profile and the additional one if any. The original sitefinity profile will be created for the user when you go to Administration->Users and edit this user.

Greetings,
Stanislav Velikov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 30-Nov-2012 00:00

@Stanislav
  Could we not just get a PITS bug report to make it so it's physically IMPOSSIBLE for sitefinity to store a duplicate?  Like if you're not going to use DB keys to manage it, the API should at least prevent it from happening.

Steve

Posted by Community Admin on 30-Nov-2012 00:00

I fixed the issue by going into the SQL and doing the below.  Here, this is just a paste-dump from my support ticket.  Perhaps the details about the sql tables will help a SQL jockey not versed in the API or code aspect of Sitefinity.  I'm trying to add the original 5 screenshots I sent over about the tables as well.  Hope this helps someone sometime.  Thanks.  -Corby-

Corby Posted 2 days ago
I was not able to delete this through the UI, I had to go into the database and delete the records with SQL statements.

I can confirm this morning that I am able to log into Sitefinity and view the list of users just fine so perhaps my inability to do so was a caching issue yesterday.  Thank you and have a nice day.

Telerik Admin
Posted 2 days ago
Hello Corby,

Thank you for contacting us.

The entries you have deleted from the database should be all you need to do. I was able to replicate the scenario. I am curious as to how you were able to do this in the UI. I had to use the API to do it.

Before deleting the duplicate profile, I shut down the site and restarted after the deletions.

Have you tried clearing the cache and restarting the site?

Please try that and let me know how it goes.

All the best,
Randy Hodge 
the Telerik team

Corby
Posted 2 days ago
(There are more than one user profile of type: "Telerik.Sitefinity.Security.Model.SitefinityProfile" for the user with Id: "27c2fca8-6ec7-4bb8-90ef-2bba0a74f300")

When logged into the backend of Sitefinity and attempting to view the list of users, we are met with the above error message and the list of users never populates.

I have an admin user that did something funny in the back-end while creating a user.  She can not recall exactly what was done but here is what I have been able to piece together.

See image 1 attached.  This shows that I have 15 users in sf_users but there are 16 records in sf_user_profile and sf_user_profile_link.

See image 2 attached.  I opened sf_user_profile and see two records that have the same ID, created just moments apart.  I deleted the second in the image, the one created last, at 7:59am.

See image 3 attached.  I opened sf_user_profile_link and ese 2 records, again with the same ID.  I deleted the record that matched the time stamp of 7:59am.

See image 4 attached.  I opened sf_sitefinity_profile and found the two records for the same user.

I deleted the record that matched the ID for the other records I had created, leaving just the one record in sf_sitefinity_profile (see attached 5 image).

I am still getting the error when loading the backend user list.  And the list never actually shows up on the screen.

So my question is where else in the database are things linked to this profile?  What else do I need to delete and from what table in order to make the back-end list of users show once again?  Please advise.  Thank you.

Posted by Community Admin on 08-Apr-2013 00:00

I used the code below to remove ALL profiles from a specific user account.  I ended up using the GetUserProfiles() method from the profileManager object.  If I used the GetUserProfile() method it would through the same exception I get in the UI.  In the case below I just created a single .aspx web page and added the following HTML and code.

I hope this helps users that are also dealing with this issue.

TempRemoveProfile.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TempRemoveProfile.aspx.cs" Inherits="SitefinityWebApp.TempRemoveProfile" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Attempting to remove user 43ebf509-72ca-4e5d-8112-f7abb358b8d7"></asp:Label>
        <br />
        <br />
        <asp:Label ID="Status" runat="server"></asp:Label>
        <br />
    </div>
    </form>
</body>
</html>


TempRemoveProfile.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Sitefinity.Security;
using Telerik.Sitefinity.Security.Model;
 
namespace SitefinityWebApp
    public partial class TempRemoveProfile : System.Web.UI.Page
    
        protected void Page_Load(object sender, EventArgs e)
        
            DeleteProfileByUserId("43EBF509-72CA-4E5D-8112-F7ABB358B8D8");
 
 
        
 
        public void DeleteProfile()
        
            UserProfileManager profileManager = UserProfileManager.GetManager();
        
 
        /// <summary>
        /// Deletes a user profile by user id.  This process does not work if there is more than one profile type associated to a user account
        /// </summary>
        /// <param name="id"></param>
        public void DeleteProfileByUserId(string id)
        
            try
            
                Status.Text = "Starting Profile Removel Process..." + "<br /><br />";
 
                // Get the Sitefinity User and Profile managers
                UserProfileManager profileManager = UserProfileManager.GetManager();
                UserManager userManager = UserManager.GetManager("LdapUsers");
 
                // Get the GUID of the user to remove
                Guid userId = new Guid(id);
 
                // Get the user based on the user id GUID
                User user = userManager.GetUser(userId);
 
                Status.Text += "User account retrieved." + "<br /><br />";
 
                // Get the users profile
                var profiles = profileManager.GetUserProfiles(user).ToList();
 
                Status.Text += "Users profile retrieved." + "<br /><br />";
 
                foreach (var profile in profiles)
                
                    // Delete the users profile
                    profileManager.Delete(profile);
                    profileManager.SaveChanges();
 
                    Status.Text += "User profile DELETED.   " + profile.Id.ToString() + "<br /><br />";
                
 
                Status.Text += "Profile Removel Process Complete." + "<br /><br />";
            
            catch (Exception ex)
            
                Status.Text += "EXCEPTION: <br/><br/>" + ex.Message + "<br /><br />" + ex.Source + "<br /><br />" + ex.StackTrace;
            
        
    

Posted by Community Admin on 11-Apr-2013 00:00

Hi Craig,

I am glad to hear the you have fixed the problem. Thank you for sharing the solution with the community.

Greetings,
Stefani Tacheva
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed