Try our conversational search powered by Generative AI!

EPiServerProfile / user data

Vote:
 
The EPiServerProfile seems to have some built in support for user data (FirstName, LastName, Company) that isn't displayed/editable in admin mode. Is there a way enable editing this data in admin mode? Regards, Magnus
#15894
Nov 26, 2007 15:33
Vote:
 
No but you can easily add editing of any profile data yourself. To store specific settings for a user use the built-in Profile support in ASP.NET. EPiServer is using this for its own need to store information on a per user basis. (The buildt in values are created by EPiServerProfile subclassing ProfileBase). You can get access to the current users EPiServer’s Profile instance accessing the static property Current on the EPiServerProfile class. There is also an default indexer property inherited from ASP.NET’s ProfileBase class that you can use for you own values. EPiServer.Personalization.EPiServerProfile.Current[“MySetting”] = “Test123”; For performance reasons use only string, Int32, DateTime and avoid objects that must be serialized. There is support for handling anonymous users (not logged in) if needed. Read more: http://msdn2.microsoft.com/en-us/library/at64shx3.aspx /Fredrik
#16586
Nov 28, 2007 11:02
Vote:
 
Thanks, Fredrik. Yes, I know I can set these values myself (for instance EPiServerProfile.Current.FirstName)... but since the EPiServerProfile has the same user data as a user in EPiServer 4.x, I thought maybe you could enable editing this info from the admin mode. That way I wouldn't have to make my own admin plugin/gui for setting the data. Regards, Magnus
#16587
Nov 28, 2007 12:10
Vote:
 
Hi Magnus! This is not a feature we have today but I have suggested this feature to the product manager so we'll see if this feature might be added in the future. Regards Linus Ekström
#16588
Nov 29, 2007 10:39
Vote:
 

We have made a test where we made a copy of the UserMemberShip.ascx file that handles the presentation of creating/changing users. We also "dumped" the code from the EPiServer dll with reflector.

In our own version of UserMemberShip.cs we made it inherit EPiServer.UI.Edit.UserMembership (if it doesn't admin mode won't work), changed the virtual void OnLoad to ovverride OnLoad, removed all protected variabels. We also added presentation/saving of in our testcase firstname at the appropriate place.

Then in web.config you only need to create a virtualpathmappings for "~/EPiServer/UI/Edit/UserMemberShip.ascx" and point it to your implementation.

 Works great.

Br

Per N /Logica

#27235
Jan 21, 2009 17:05
Vote:
 

Hi Per

This is an interesting article, Could we get some clarity on how to add new fields to use and where we can see the new fields being added? should they reflect in table aspnet_Users in the episerver database? e.g using

<profile enabled="true" defaultProvider="SqlProfile" automaticSaveEnabled="true">

<properties>

<add name="Address" type="System.String"/>

I'd assume saving data is not possible until the fields are created first OR is the EPiServer implementaiton different to what I'm thinking?

On that front are the editor users and say custom users all handled in the same manner? in the case of the latter part of creating own users the users will be stored with the editors/administrators and I should manage them by groups?

 

#29055
Apr 02, 2009 18:40
Vote:
 

Hi steven

We didn't add new field we just displayed field that already existed int the default sqlProfile. I haven't tested to add new fields. It you wan't I can email you a zip with our modified files. There are comment where we have added these new fields.

Then you will have something to work with.

/Per

#29231
Apr 16, 2009 16:22
Vote:
 

Hi Per,

I'd appreciate it if you could email your sample code to me please.

will.scott@ultimedia.co.uk

Thanks

#31356
Jul 22, 2009 16:34
Vote:
 
Hi.

I came across the same problem and thought the same way as Per. But then I started researching it a bit and EPiServer CMS 5 has a PluginArea called PlugInArea.SidSettingsArea. This wil show up as an extra tab in the "Edit User" and "Create User" templates.

Here is an example:

Markup:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserCustomSettings.ascx.cs" Inherits="AssemblyName.Plugins.UserCustomSettings" %>
<asp:Label runat="server" Text="CrmId:" AssociatedControlID="CrmId" />
<asp:TextBox ID="CrmId" runat="server" />

Code:

[GuiPlugIn(DisplayName = "User Settings", Description = "Additional settings for the user", Area = PlugInArea.SidSettingsArea, Url = "~/Plugins/UserCustomSettings.ascx")]
public partial class UserCustomSettings : UserControl, IUserSettings, ICustomPlugInLoader
{
public PlugInDescriptor[] List()
{
return new[] { PlugInDescriptor.Load(typeof(UserCustomSettings)) };
}

public void LoadSettings(string userName, EPiServerProfile data)
{
if (!IsPostBack)
{
TextBoxCrmId.Text = data.GetPropertyValue("CrmId").ToString();
}
}

public bool SaveRequiresUIReload { get; set; }

public void SaveSettings(string userName, EPiServerProfile data)
{
data.SetPropertyValue("CrmId", TextBoxCrmId.Text);
data.Save();
}
}

Web.Config:

<add name="CrmId" type="System.String" provider="SqlProfile" />

This way you can easily add new settings to a user, but you can also display all the other fields that already exists(Address, City, Company, Title etc.).

The information will not be displayed on the "User Information" tab, but it is much easier then making your own UserMemberShip.ascx file and create VirtualPathMappings for it. It it also more robust against future upgrades.

Hope this helps!

Br, Tore

#31366
Jul 23, 2009 9:01
Vote:
 

Hi,

 I have a problem with displaying EPiServerProfile user data in a gridview. First i created a gridview and displayed my collection of EPiServerProfile which consisted of UserName, FirstName and Lastname. And that went well, but if i try to add new properties in episerverprofile my gridview can't recognise the newly created fields.

 For example i want to store the name of the role in a episerverprofile property like a string, cause i find it more convinient to find the name of the role that way. So i've added the following to web.config under <profile>

 <add name="UserRole" type="System.String"/>

After that i create new users so the property will recieve a value. But i recieve this error message: A field or property with the name "UserRole" was not found in the selected datasource.

And its just working with the predefined properties which shows up in Intellisense, like FirstName, LastName, Email, etc. for example ZipCode which is'nt in Intellisense is not working.

 Do i need to instantiate the newly added properties somewhere? Or do i need some workaround so they'll show up in Intellisense for the gridview to recognize the fields?

Ideas?

BR Johannes

#32903
Sep 23, 2009 15:00
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.