Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Adding custom fields to standard Community modules

Vote:
 

I know that it's possible to add custom modules to Community, but is there any way of customizing the standard modules?

For example in the Community tab -> System Settings -> Groups/Users -> Add User, I'd like to add a custom field. Is this possible?

#31869
Aug 13, 2009 10:46
Vote:
 

Hi,

 This is possible. It requires that you create a class that inherit that page, and extends it.

namespace EPiServer.Templates.RelatePlus.Templates.RelatePlus.AdminExtension {
public class EditUserPage : EPiServer.Community.Web.Administration.EditUserPage
{
protected System.Web.UI.WebControls.TextBox txtExtraBox;
protected override void OnInit(EventArgs e)
{
buttonSave.Click += new EventHandler(buttonSave_Click);
base.OnInit(e);
}
void buttonSave_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
// Save the text in the added field txtExtraBox
string text = txtExtraBox.Text;
}
}
}
}

Then, you open up EPiServerCommunity\Security\EditUser.aspx, and change the @Page directive so that the page inherits the class above instead of the default implementation:

@Page ... Inherits="EPiServer.Templates.RelatePlus.Templates.RelatePlus.AdminExtension.EditUserPage" 

And also in this file, add the user control that is handled by your class:

<asp:TextBox ID="txtExtraBox" runat="server"></asp:TextBox>

This should be it!

/Kristoffer

#31901
Edited, Aug 14, 2009 10:31
Vote:
 
Thanks, I'll try it out! :)
#31906
Aug 14, 2009 12:45
Vote:
 
Works perfectly! Thanks again!
#31907
Aug 14, 2009 14:17
This thread is locked and should be used for reference only. Please use the Legacy add-ons 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.