Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.

 

Magnus Rahl
Nov 4, 2010
  5890
(1 votes)

Plugin to edit Profile properties in Edit / Admin

Users who have been around since the days of EPiServer 4 might remember that it was possible to edit user properties (name, address…) directly in the user settings. No such possibility even for the predefined SqlProfile properties exists in CM5 and later.

A long time ago I wrote a plugin to “restore” this functionality. I have been using it every now and then in projects without much modification, but never got around to post it on the web (I think, if this is a double post I apologize…). So here it is now!

Some words on the code

The thought was to build something that could be extended and configured. It therefore uses its own config section which maps different profile properties to use different implementations of the IProfileEditor interface. Simple implementations for string and DateTime are included (very simple, just textboxes, but one with validation).

Configuration

The configuration consists of a config section in web.config. Add the section declaration to /configuration/configSections:

<section name="profileEditor" type="ProfileEditor.Implementation.ProfileEditorConfiguration, ProfileEditor" />

and then add the actual configuration under /configuration, example:

<profileEditor>
    <handlers>
      <add propertyName="FirstName" editHeading="/admin/secedit/firstname" sortIndex="10" type="ProfileEditor.Implementation.Editors.StringEditor, ProfileEditor" />
      <add propertyName="LastName" editHeading="/admin/secedit/lastname" sortIndex="20" type="ProfileEditor.Implementation.Editors.StringEditor, ProfileEditor" />
      <add propertyName="ExpiryDate" editHeading="Datum då kontot upphör" sortIndex="140" options="AllowEmpty='true';DateFormat='yyyy-MM-dd HH:mm';" type="ProfileEditor.Implementation.Editors.DateTimeEditor, ProfileEditor" />
    </handlers>
</profileEditor>

The propertyName should be equal to the one defined in the /configuration/profile/properties section. editHeading takes a string or a language path to show as label. The sortindex attributes are (surprise!) used to control the order in which the properties appear. The type gives the FullName,Assembly path to the IProfileEditor implementation used. Finally there’s an optional options attribute which can be used to pass extra settings to the IProfileEditor implementation. The attribute value is passed to the IProfileEditors init method so it can be stored and used to perform setup.

Example

The configuration shown above renders the following fields in admin mode:

profileeditor

Code

The code is available, for use at your own risk!, from the EPiServer World Code Section: http://world.episerver.com/Code/Magnus-Paulsson/User-profile-properties-edit-plugin/

Nov 04, 2010

Comments

Shoma Gujjar
Shoma Gujjar Aug 4, 2015 05:01 PM

Hi,

I am trying to implement this on EPiServer 7.5. It doesnt seem to work!

Adam B
Adam B Mar 10, 2016 04:22 PM

Hi Shoma,

Did you ever get this working in 7.5?

Thanks

Please login to comment.
Latest blogs
Optimizely CMS easy RSS feed integration library

As I've mentioned in my  previous blog post , while I was developing the Optimizely version of my blog, I tried to look for a library that could...

David Drouin-Prince | Jan 25, 2025 | Syndicated blog

Decimal numbers in Optimizely Graph

Storing prices as decimal numbers on a commerce website and planning to expose them through Optimizely Graph? It might not be as straightforward as...

Damian Smutek | Jan 23, 2025 | Syndicated blog

Find and delete non used media and blocks

On my new quest to play around with Blazor and MudBlazor I'm going back memory lane and porting some previously plugins. So this time up is my plug...

Per Nergård (MVP) | Jan 21, 2025

Optimizely Content Graph on mobile application

CG everywhere! I pull schema from our default index https://cg.optimizely.com/app/graphiql?auth=eBrGunULiC5TziTCtiOLEmov2LijBf30obh0KmhcBlyTktGZ in...

Cuong Nguyen Dinh | Jan 20, 2025